[4/6] go-runtime.inc: do not make installation set dependent on host

Message ID 20220101112959.1866747-4-alex@linutronix.de
State New
Headers show
Series [1/6] go: log build id computations | expand

Commit Message

Alexander Kanavin Jan. 1, 2022, 11:29 a.m. UTC
This cannot be right: what we install for the target should not
depend on what host it's being built on. If this was fixing
some problem, there needs to be a different solution.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/recipes-devtools/go/go-runtime.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Matt Madison Jan. 2, 2022, 12:39 p.m. UTC | #1
On Sat, Jan 1, 2022 at 3:30 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
>
> This cannot be right: what we install for the target should not
> depend on what host it's being built on. If this was fixing
> some problem, there needs to be a different solution.

IIRC, I added this because the go toolchain doesn't really do
host/target separation like gcc does. The runtime packages for both
host and target get populated during the compilation, and if the
target architecture matches the build host's architecture, you'd get
just one copy in the tree. And back then, at least, the go-runtime
package needed those files, so the check was there to make sure they
didn't get deleted just because the two architectures were the same.

That's the way things were 5 years ago, though, and the toolchain has
changed a lot since then. It might not be needed any more.

-Matt

>
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  meta/recipes-devtools/go/go-runtime.inc | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
> index a08d44dd3a..106017bd89 100644
> --- a/meta/recipes-devtools/go/go-runtime.inc
> +++ b/meta/recipes-devtools/go/go-runtime.inc
> @@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
>  do_install() {
>         install -d ${D}${libdir}/go/src
>         cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
> -       if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
> -               rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
> -               rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
> -       fi
> +       rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
> +       rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
>         rm -rf ${D}${libdir}/go/pkg/tool
>         rm -rf ${D}${libdir}/go/pkg/obj
>         rm -rf ${D}${libdir}/go/pkg/bootstrap
> --
> 2.20.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#160097): https://lists.openembedded.org/g/openembedded-core/message/160097
> Mute This Topic: https://lists.openembedded.org/mt/88071321/3618418
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [matt@madison.systems]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin Jan. 2, 2022, 4:30 p.m. UTC | #2
Right, I'll take a closer look at this.

Alex

On Sun, 2 Jan 2022 at 13:40, Matt Madison <matt@madison.systems> wrote:

> On Sat, Jan 1, 2022 at 3:30 AM Alexander Kanavin <alex.kanavin@gmail.com>
> wrote:
> >
> > This cannot be right: what we install for the target should not
> > depend on what host it's being built on. If this was fixing
> > some problem, there needs to be a different solution.
>
> IIRC, I added this because the go toolchain doesn't really do
> host/target separation like gcc does. The runtime packages for both
> host and target get populated during the compilation, and if the
> target architecture matches the build host's architecture, you'd get
> just one copy in the tree. And back then, at least, the go-runtime
> package needed those files, so the check was there to make sure they
> didn't get deleted just because the two architectures were the same.
>
> That's the way things were 5 years ago, though, and the toolchain has
> changed a lot since then. It might not be needed any more.
>
> -Matt
>
> >
> > Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> > ---
> >  meta/recipes-devtools/go/go-runtime.inc | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/recipes-devtools/go/go-runtime.inc
> b/meta/recipes-devtools/go/go-runtime.inc
> > index a08d44dd3a..106017bd89 100644
> > --- a/meta/recipes-devtools/go/go-runtime.inc
> > +++ b/meta/recipes-devtools/go/go-runtime.inc
> > @@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin
> ${B}/pkg"
> >  do_install() {
> >         install -d ${D}${libdir}/go/src
> >         cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
> > -       if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
> > -               rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
> > -               rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
> > -       fi
> > +       rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
> > +       rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
> >         rm -rf ${D}${libdir}/go/pkg/tool
> >         rm -rf ${D}${libdir}/go/pkg/obj
> >         rm -rf ${D}${libdir}/go/pkg/bootstrap
> > --
> > 2.20.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#160097):
> https://lists.openembedded.org/g/openembedded-core/message/160097
> > Mute This Topic: https://lists.openembedded.org/mt/88071321/3618418
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> [matt@madison.systems]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Alexander Kanavin Jan. 2, 2022, 6:13 p.m. UTC | #3
Thanks, I have dropped the patch.

Alex

On Sun, 2 Jan 2022 at 17:30, Alexander Kanavin via lists.openembedded.org
<alex.kanavin=gmail.com@lists.openembedded.org> wrote:

> Right, I'll take a closer look at this.
>
> Alex
>
> On Sun, 2 Jan 2022 at 13:40, Matt Madison <matt@madison.systems> wrote:
>
>> On Sat, Jan 1, 2022 at 3:30 AM Alexander Kanavin <alex.kanavin@gmail.com>
>> wrote:
>> >
>> > This cannot be right: what we install for the target should not
>> > depend on what host it's being built on. If this was fixing
>> > some problem, there needs to be a different solution.
>>
>> IIRC, I added this because the go toolchain doesn't really do
>> host/target separation like gcc does. The runtime packages for both
>> host and target get populated during the compilation, and if the
>> target architecture matches the build host's architecture, you'd get
>> just one copy in the tree. And back then, at least, the go-runtime
>> package needed those files, so the check was there to make sure they
>> didn't get deleted just because the two architectures were the same.
>>
>> That's the way things were 5 years ago, though, and the toolchain has
>> changed a lot since then. It might not be needed any more.
>>
>> -Matt
>>
>> >
>> > Signed-off-by: Alexander Kanavin <alex@linutronix.de>
>> > ---
>> >  meta/recipes-devtools/go/go-runtime.inc | 6 ++----
>> >  1 file changed, 2 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/meta/recipes-devtools/go/go-runtime.inc
>> b/meta/recipes-devtools/go/go-runtime.inc
>> > index a08d44dd3a..106017bd89 100644
>> > --- a/meta/recipes-devtools/go/go-runtime.inc
>> > +++ b/meta/recipes-devtools/go/go-runtime.inc
>> > @@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin
>> ${B}/pkg"
>> >  do_install() {
>> >         install -d ${D}${libdir}/go/src
>> >         cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
>> > -       if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
>> > -               rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
>> > -               rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
>> > -       fi
>> > +       rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
>> > +       rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
>> >         rm -rf ${D}${libdir}/go/pkg/tool
>> >         rm -rf ${D}${libdir}/go/pkg/obj
>> >         rm -rf ${D}${libdir}/go/pkg/bootstrap
>> > --
>> > 2.20.1
>> >
>> >
>> >
>> >
>>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#160105):
> https://lists.openembedded.org/g/openembedded-core/message/160105
> Mute This Topic: https://lists.openembedded.org/mt/88071321/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

Patch

diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index a08d44dd3a..106017bd89 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -43,10 +43,8 @@  do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
 do_install() {
 	install -d ${D}${libdir}/go/src
 	cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
-	if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
-		rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
-		rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
-	fi
+	rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+	rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
 	rm -rf ${D}${libdir}/go/pkg/tool
 	rm -rf ${D}${libdir}/go/pkg/obj
 	rm -rf ${D}${libdir}/go/pkg/bootstrap