From d9af46db9aa9060c1ec10118b2cccabfc8264904 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 15 Sep 2022 13:59:39 -0400 Subject: [PATCH] kubernetes: fix more TMPDIR references Changing the clone location of kubernetes allows us to remove the vendor symlink "fix". This reduces the number of TMPDIR references in the binaries. kubernetes takes care of most of the rest via using asmflags and gcflags interally which specify -trimpath, but unfortunately these flags are being recorded into the binaries and leave us with 4 references to the TMDIR: -asmflags=all=-trimpath=/opt/poky/build/tmp/work/core2-64-poky-linux/kubernetes/1_v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f-r0/git/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes -gcflags="all=-trimpath=/opt/poky/build/tmp/work/core2-64-poky-linux/kubernetes/1_v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f-r0/git/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes -asmflags=all=-trimpath=/opt/poky/build/tmp/work/core2-64-poky-linux/kubernetes/1_v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f-r0/git/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes -gcflags="all=-trimpath=/opt/poky/build/tmp/work/core2-64-poky-linux/kubernetes/1_v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f-r0/git/src/github.com/kubernetes/kubernetes/_output/local/go/src/k8s.io/kubernetes We leave these for now, as attempts to remove them have broken the build, and kubernetes uses 'go install' versus 'go build' to construct the binaries .. making our normal solutions non functional. Signed-off-by: Bruce Ashfield --- ...g.sh-convert-remaining-go-calls-to-use.patch | 6 +++--- ...001-cross-don-t-build-tests-by-default.patch | 6 +++--- ...-lib-golang.sh-use-CC-from-environment.patch | 6 +++--- recipes-containers/kubernetes/kubernetes_git.bb | 17 +++++++---------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/recipes-containers/kubernetes/kubernetes/0001-build-golang.sh-convert-remaining-go-calls-to-use.patch b/recipes-containers/kubernetes/kubernetes/0001-build-golang.sh-convert-remaining-go-calls-to-use.patch index 90a7b79f..8c6644a3 100644 --- a/recipes-containers/kubernetes/kubernetes/0001-build-golang.sh-convert-remaining-go-calls-to-use.patch +++ b/recipes-containers/kubernetes/kubernetes/0001-build-golang.sh-convert-remaining-go-calls-to-use.patch @@ -8,10 +8,10 @@ Signed-off-by: Bruce Ashfield hack/lib/golang.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -Index: kubernetes-v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f/src/import/hack/lib/golang.sh +Index: kubernetes-v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f/hack/lib/golang.sh =================================================================== ---- kubernetes-v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f.orig/src/import/hack/lib/golang.sh -+++ kubernetes-v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f/src/import/hack/lib/golang.sh +--- kubernetes-v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f.orig/hack/lib/golang.sh ++++ kubernetes-v1.24.0+git8b1b4db3834ddf7cf1b97137180f413cb9e2186f/hack/lib/golang.sh @@ -652,7 +652,7 @@ kube::golang::create_coverage_dummy_test "${package}" kube::util::trap_add "kube::golang::delete_coverage_dummy_test \"${package}\"" EXIT diff --git a/recipes-containers/kubernetes/kubernetes/0001-cross-don-t-build-tests-by-default.patch b/recipes-containers/kubernetes/kubernetes/0001-cross-don-t-build-tests-by-default.patch index 659e3013..2758fb39 100644 --- a/recipes-containers/kubernetes/kubernetes/0001-cross-don-t-build-tests-by-default.patch +++ b/recipes-containers/kubernetes/kubernetes/0001-cross-don-t-build-tests-by-default.patch @@ -15,10 +15,10 @@ Signed-off-by: Bruce Ashfield hack/make-rules/cross.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/src/import/hack/make-rules/cross.sh b/hack/make-rules/cross.sh +diff --git a/hack/make-rules/cross.sh b/hack/make-rules/cross.sh index 8e1e938..0898c5c 100755 ---- a/src/import/hack/make-rules/cross.sh -+++ b/src/import/hack/make-rules/cross.sh +--- a/hack/make-rules/cross.sh ++++ b/hack/make-rules/cross.sh @@ -33,6 +33,6 @@ make all WHAT="${KUBE_NODE_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_NODE_PLATFO make all WHAT="${KUBE_CLIENT_TARGETS[*]}" KUBE_BUILD_PLATFORMS="${KUBE_CLIENT_PLATFORMS[*]}" diff --git a/recipes-containers/kubernetes/kubernetes/0001-hack-lib-golang.sh-use-CC-from-environment.patch b/recipes-containers/kubernetes/kubernetes/0001-hack-lib-golang.sh-use-CC-from-environment.patch index 3a22a2ef..1c4555a3 100644 --- a/recipes-containers/kubernetes/kubernetes/0001-hack-lib-golang.sh-use-CC-from-environment.patch +++ b/recipes-containers/kubernetes/kubernetes/0001-hack-lib-golang.sh-use-CC-from-environment.patch @@ -11,10 +11,10 @@ Signed-off-by: Koen Kooi hack/lib/golang.sh | 4 ---- 1 file changed, 4 deletions(-) -Index: kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630/src/import/hack/lib/golang.sh +Index: kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630/hack/lib/golang.sh =================================================================== ---- kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630.orig/src/import/hack/lib/golang.sh -+++ kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630/src/import/hack/lib/golang.sh +--- kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630.orig/hack/lib/golang.sh ++++ kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630/hack/lib/golang.sh @@ -414,19 +414,15 @@ ;; "linux/arm") diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb index e9460d46..3289a641 100644 --- a/recipes-containers/kubernetes/kubernetes_git.bb +++ b/recipes-containers/kubernetes/kubernetes_git.bb @@ -11,7 +11,7 @@ SRCREV_kubernetes-release = "7c1aa83dac555de6f05500911467b70aca4949f0" PE = "1" BBCLASSEXTEND = "devupstream:target" -LIC_FILES_CHKSUM:class-devupstream = "file://src/import/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" +LIC_FILES_CHKSUM:class-devupstream = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" DEFAULT_PREFERENCE:class-devupstream = "-1" SRC_URI:classedevupstream = "git://github.com/kubernetes/kubernetes.git;branch=master;name=kubernetes;protocol=https \ git://github.com/kubernetes/release;branch=master;name=kubernetes-release;destsuffix=git/release;protocol=https \ @@ -22,7 +22,7 @@ PV:class-devupstream = "v1.23-alpha+git${SRCPV}" SRCREV_FORMAT ?= "kubernetes_release" -SRC_URI = "git://github.com/kubernetes/kubernetes.git;branch=release-1.24;name=kubernetes;protocol=https \ +SRC_URI = "git://github.com/kubernetes/kubernetes.git;branch=release-1.24;name=kubernetes;protocol=https;destsuffix=git/src/github.com/kubernetes/kubernetes \ git://github.com/kubernetes/release;branch=master;name=kubernetes-release;destsuffix=git/release;protocol=https" SRC_URI:append = " \ @@ -40,9 +40,10 @@ DEPENDS += "rsync-native \ " LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" GO_IMPORT = "import" +S = "${WORKDIR}/git/src/github.com/kubernetes/kubernetes" inherit systemd inherit go @@ -52,12 +53,8 @@ inherit cni_networking COMPATIBLE_HOST = '(x86_64.*|arm.*|aarch64.*)-linux' do_compile() { - # link fixups for compilation - rm -f ${S}/src/import/vendor/src - ln -sf ./ ${S}/src/import/vendor/src - - export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" - cd ${S}/src/import + export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go:${WORKDIR}/git/" + cd ${S} # Build the host tools first, using the host compiler export GOARCH="${BUILD_GOARCH}" @@ -97,7 +94,7 @@ do_install() { install -d ${D}${sysconfdir}/kubernetes/manifests/ - install -m 755 -D ${S}/src/import/_output/local/bin/${TARGET_GOOS}/${TARGET_GOARCH}/* ${D}/${bindir} + install -m 755 -D ${S}/_output/local/bin/${TARGET_GOOS}/${TARGET_GOARCH}/* ${D}/${bindir} install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service ${D}${systemd_unitdir}/system/ install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf ${D}${systemd_unitdir}/system/kubelet.service.d/