Skip to contentSkip to conversation

docker-distribution: fix the inehrit and systemd settings

PATCH Superseded Chen Qi 2 participants 6 messages Jun 10, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/3 docker-distribution: fix the inehrit and systemd settings

In order for systemd variables such as SYSTEMD_AUTO_ENABLE to have effect, we need to inherit the systemd class. We also need to specify the package which contains the service.

As go.bbclass already inherits goarch.bbclass, we only need to inehrit go.bbclass.

---
 .../docker-distribution/docker-distribution_git.bb            | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-containers/docker-distribution/docker-distribution_git.bb +2 -2
index 95e2b66c..1d074bf3 100644
@@ -16,8 +16,7 @@ S = "${WORKDIR}/git/src/github.com/docker/distribution"
 
 GO_IMPORT = "import"
 
-inherit goarch
-inherit go
+inherit go systemd
 
 # This disables seccomp and apparmor, which are on by default in the
 # go package. 
@@ -66,6 +65,7 @@ FILES:docker-registry += "${systemd_unitdir}/system/docker-registry.service"
 FILES:docker-registry += "${sysconfdir}/docker-distribution/*"
 FILES:docker-registry += "${localstatedir}/lib/registry/"
 
+SYSTEMD_PACKAGES = "docker-registry"
 SYSTEMD_SERVICE:docker-registry = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker-registry.service','',d)}"
 SYSTEMD_AUTO_ENABLE:docker-registry = "enable"
 
Signature · 1 line
2.36.0
author
#1 lore raw

PATCH 2/3 docker-distribution: fix build error on new hosts

The CGO_CFLAGS and other related variables have already been set appropriately by the go.bbclass in oe-core. Setting them in this recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is incorrect. We need target flags instead of SDK related flags. Such setting happens to work for some hosts. However, when building on newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires libc.so.6(GLIBC_2.34)(64bit), but no providers found in RDEPENDS_docker-registry? [file-rdeps]

The above error was found on hardknott on host Fedora 35. Tracking down the error and I found it's using host stuff which is likely to be caused by using incorrect CGO_CFLAGS. As the master branch is using the same settings, it has the same issue.

---
 .../docker-distribution/docker-distribution_git.bb       | 9 ---------
 1 file changed, 9 deletions(-)
recipes-containers/docker-distribution/docker-distribution_git.bb +0 -9
index 1d074bf3..679bcf8b 100644
@@ -23,17 +23,8 @@ inherit go systemd
 EXTRA_OEMAKE="BUILDTAGS=''"
 
 do_compile() {
-	export GOARCH="${TARGET_GOARCH}"
 	export GOPATH="${WORKDIR}/git/"
-	export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
-	# Pass the needed cflags/ldflags so that cgo
-	# can find the needed headers files and libraries
-	export CGO_ENABLED="1"
-	export CFLAGS=""
-	export LDFLAGS=""
-	export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export GO_GCFLAGS=""
-	export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
 	export GO111MODULE=off
 
 	cd ${S}
Signature · 1 line
2.36.0
#2 lore raw

Re: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

Quoted 10 lines · Chen Qi

The CGO_CFLAGS and other related variables have already been set appropriately by the go.bbclass in oe-core. Setting them in this recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is incorrect. We need target flags instead of SDK related flags. Such setting happens to work for some hosts. However, when building on newer hosts, we get QA error like below:

Quoted 8 lines

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires libc.so.6(GLIBC_2.34)(64bit), but no providers found in RDEPENDS_docker-registry? [file-rdeps]

The above error was found on hardknott on host Fedora 35. Tracking down the error and I found it's using host stuff which is likely to be caused by using incorrect CGO_CFLAGS. As the master branch is using the same settings, it has the same issue.

And as I mentioned, feel free to adjust the flags and explicit settings, but I won't be dropping them.

I've been through 6 years of getting these recipes working, and continually being broken by changes in the core classes, so I'm not going to drop the explicit settings.

Bruce

Quoted 40 lines
---
 .../docker-distribution/docker-distribution_git.bb       | 9 ---------
 1 file changed, 9 deletions(-)
recipes-containers/docker-distribution/docker-distribution_git.bb +0 -10
index 1d074bf3..679bcf8b 100644
@@ -23,17 +23,8 @@ inherit go systemd
 EXTRA_OEMAKE="BUILDTAGS=''"
 
 do_compile() {
-       export GOARCH="${TARGET_GOARCH}"
        export GOPATH="${WORKDIR}/git/"
-       export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
-       # Pass the needed cflags/ldflags so that cgo
-       # can find the needed headers files and libraries
-       export CGO_ENABLED="1"
-       export CFLAGS=""
-       export LDFLAGS=""
-       export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO_GCFLAGS=""
-       export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO111MODULE=off
 
        cd ${S}
--

2.36.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7356): https://lists.yoctoproject.org/g/meta-virtualization/message/7356
Mute This Topic: https://lists.yoctoproject.org/mt/91662218/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#3 lore raw

RE: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

Hi Bruce,

Got it. I'll adjust these CGO_XXX settings and send out V2 next week.

Regards,
Qi

-----Original Message-----
From: Bruce Ashfield <[email protected]>
Sent: Friday, June 10, 2022 9:01 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

Quoted 15 lines · Chen Qi

The CGO_CFLAGS and other related variables have already been set appropriately by the go.bbclass in oe-core. Setting them in this recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is incorrect. We need target flags instead of SDK related flags. Such setting happens to work for some hosts. However, when building on newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires libc.so.6(GLIBC_2.34)(64bit), but no providers found in
RDEPENDS_docker-registry? [file-rdeps]

Quoted 4 lines

The above error was found on hardknott on host Fedora 35. Tracking down the error and I found it's using host stuff which is likely to be caused by using incorrect CGO_CFLAGS. As the master branch is using the same settings, it has the same issue.

And as I mentioned, feel free to adjust the flags and explicit settings, but I won't be dropping them.

I've been through 6 years of getting these recipes working, and continually being broken by changes in the core classes, so I'm not going to drop the explicit settings.

Bruce

Quoted 36 lines
---
 .../docker-distribution/docker-distribution_git.bb       | 9 ---------
 1 file changed, 9 deletions(-)
(quoted diff) +0 -0

a/recipes-containers/docker-distribution/docker-distribution_git.bb b/recipes-containers/docker-distribution/docker-distribution_git.bb index 1d074bf3..679bcf8b 100644
---
a/recipes-containers/docker-distribution/docker-distribution_git.bb +++ b/recipes-containers/docker-distribution/docker-distribution_git.b +++ b

recipes-containers/docker-distribution/docker-distribution_git.bb +0 -10
@@ -23,17 +23,8 @@ inherit go systemd
 EXTRA_OEMAKE="BUILDTAGS=''"
 
 do_compile() {
-       export GOARCH="${TARGET_GOARCH}"
        export GOPATH="${WORKDIR}/git/"
-       export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
-       # Pass the needed cflags/ldflags so that cgo
-       # can find the needed headers files and libraries
-       export CGO_ENABLED="1"
-       export CFLAGS=""
-       export LDFLAGS=""
-       export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO_GCFLAGS=""
-       export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO111MODULE=off
 
        cd ${S}
--

2.36.0

Quoted 11 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#7356):
https://lists.yoctoproject.org/g/meta-virtualization/message/7356
Mute This Topic: https://lists.yoctoproject.org/mt/91662218/1050810
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/meta-virtualization/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

#4 lore raw

Re: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

Quoted 5 lines · Qi

Hi Bruce,

Got it. I'll adjust these CGO_XXX settings and send out V2 next week.

Sounds good to me. Thanks for adjusting them!

I will merge your docker-distribution fix though, since it is unrelated to the flags.

I'm doing some upgrades to the packages right now, but will make sure to not impact the changes I know you are making.

Bruce

Quoted 89 lines

Regards,
Qi

-----Original Message-----
From: Bruce Ashfield <[email protected]>
Sent: Friday, June 10, 2022 9:01 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [meta-virtualization][master][kirkstone][PATCH 2/3] docker-distribution: fix build error on new hosts

Quoted 15 lines · Chen Qi

The CGO_CFLAGS and other related variables have already been set appropriately by the go.bbclass in oe-core. Setting them in this recipe is not only unncessary but also error prone.

For example CGO_CFLAGS is set to use BUILDSDK_CFLAGS, and this is incorrect. We need target flags instead of SDK related flags. Such setting happens to work for some hosts. However, when building on newer hosts, we get QA error like below:

ERROR: docker-distribution-v2.7.1-r0 do_package_qa:
QA Issue: /usr/sbin/registry contained in package docker-registry requires libc.so.6(GLIBC_2.34)(64bit), but no providers found in
RDEPENDS_docker-registry? [file-rdeps]

Quoted 4 lines

The above error was found on hardknott on host Fedora 35. Tracking down the error and I found it's using host stuff which is likely to be caused by using incorrect CGO_CFLAGS. As the master branch is using the same settings, it has the same issue.

And as I mentioned, feel free to adjust the flags and explicit settings, but I won't be dropping them.

I've been through 6 years of getting these recipes working, and continually being broken by changes in the core classes, so I'm not going to drop the explicit settings.

Bruce

Quoted 36 lines
---
 .../docker-distribution/docker-distribution_git.bb       | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/recipes-containers/docker-distribution/docker-distribution_git.bb b/recipes-containers/docker-distribution/docker-distribution_git.bb index 1d074bf3..679bcf8b 100644
---
a/recipes-containers/docker-distribution/docker-distribution_git.bb +++ b/recipes-containers/docker-distribution/docker-distribution_git.b +++ b

recipes-containers/docker-distribution/docker-distribution_git.bb +0 -10
@@ -23,17 +23,8 @@ inherit go systemd
 EXTRA_OEMAKE="BUILDTAGS=''"
 
 do_compile() {
-       export GOARCH="${TARGET_GOARCH}"
        export GOPATH="${WORKDIR}/git/"
-       export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
-       # Pass the needed cflags/ldflags so that cgo
-       # can find the needed headers files and libraries
-       export CGO_ENABLED="1"
-       export CFLAGS=""
-       export LDFLAGS=""
-       export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO_GCFLAGS=""
-       export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
        export GO111MODULE=off
 
        cd ${S}
--

2.36.0

Quoted 11 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#7356):
https://lists.yoctoproject.org/g/meta-virtualization/message/7356
Mute This Topic: https://lists.yoctoproject.org/mt/91662218/1050810
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/meta-virtualization/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
author
#5 lore raw

PATCH 3/3 docker-distribution: upgrade to 2.8.1

In reply to Chen Qi

v2.8.1 is the latest stable version.

---
 .../docker-distribution/docker-distribution_git.bb          | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
recipes-containers/docker-distribution/docker-distribution_git.bb +3 -3
index 679bcf8b..0d497916 100644
@@ -3,15 +3,15 @@ SUMMARY = "The Docker toolset to pack, ship, store, and deliver content"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=d2794c0df5b907fdace235a619d80314"
 
-SRCREV_distribution= "3b7b534569220c840993aad03e3eafe54b923f4d"
-SRC_URI = "git://github.com/docker/distribution.git;branch=release/2.7;name=distribution;destsuffix=git/src/github.com/docker/distribution;protocol=https \
+SRCREV_distribution= "b5ca020cfbe998e5af3457fda087444cf5116496"
+SRC_URI = "git://github.com/docker/distribution.git;branch=release/2.8;name=distribution;destsuffix=git/src/github.com/docker/distribution;protocol=https \
            file://docker-registry.service \
            file://0001-build-use-to-use-cross-go-compiler.patch \
           "
 
 PACKAGES =+ "docker-registry"
 
-PV = "v2.8.0+git${SRCPV}"
+PV = "v2.8.1+git${SRCPV}"
 S = "${WORKDIR}/git/src/github.com/docker/distribution"
 
 GO_IMPORT = "import"
Signature · 1 line
2.36.0