From eb3b16a529617f2a47fa51d33845f1bbcbe3eaab400be87256e15b502d4b5404 Mon Sep 17 00:00:00 2001 From: Priyanka Saggu Date: Mon, 8 Jan 2024 06:57:44 +0000 Subject: [PATCH] Accepting request 1136467 from home:bmwiedemann:branches:devel:kubic Add kubernetes-trimpath.patch for reproducible builds (boo#1062303) OBS-URL: https://build.opensuse.org/request/show/1136467 OBS-URL: https://build.opensuse.org/package/show/devel:kubic/kubernetes1.24?expand=0&rev=28 --- kubernetes-trimpath.patch | 88 +++++++++++++++++++++++++++++++++++++++ kubernetes1.24.changes | 5 +++ kubernetes1.24.spec | 3 ++ 3 files changed, 96 insertions(+) create mode 100644 kubernetes-trimpath.patch diff --git a/kubernetes-trimpath.patch b/kubernetes-trimpath.patch new file mode 100644 index 0000000..232b2c2 --- /dev/null +++ b/kubernetes-trimpath.patch @@ -0,0 +1,88 @@ +From 37b7ae6b9332e0275bcc8eeb01bbc69e2f3239e6 Mon Sep 17 00:00:00 2001 +From: Tim Hockin +Date: Tue, 14 Nov 2023 18:57:34 -0800 +Subject: [PATCH 1/2] build: use -trimpath in non-DBG mode + +fix reproducible builds +https://github.com/kubernetes/kubernetes/issues/110928 + +--- + hack/lib/golang.sh | 28 +++++++++------------------- + 1 file changed, 9 insertions(+), 19 deletions(-) + +Index: kubernetes-1.24.17/hack/lib/golang.sh +=================================================================== +--- kubernetes-1.24.17.orig/hack/lib/golang.sh ++++ kubernetes-1.24.17/hack/lib/golang.sh +@@ -719,7 +719,6 @@ kube::golang::build_binaries_for_platfor + -installsuffix=static + ${goflags:+"${goflags[@]}"} + -gcflags="${gogcflags}" +- -asmflags="${goasmflags}" + -ldflags="${goldflags}" + -tags="${gotags:-}" + ) +@@ -730,7 +729,6 @@ kube::golang::build_binaries_for_platfor + build_args=( + ${goflags:+"${goflags[@]}"} + -gcflags="${gogcflags}" +- -asmflags="${goasmflags}" + -ldflags="${goldflags}" + -tags="${gotags:-}" + ) +@@ -746,7 +744,6 @@ kube::golang::build_binaries_for_platfor + go test -c \ + ${goflags:+"${goflags[@]}"} \ + -gcflags="${gogcflags}" \ +- -asmflags="${goasmflags}" \ + -ldflags="${goldflags}" \ + -tags="${gotags:-}" \ + -o "${outfile}" \ +@@ -805,23 +802,17 @@ kube::golang::build_binaries() { + # build_binaries_for_platform. + local goflags goldflags goasmflags gogcflags gotags + +- # This is $(pwd) because we use run-in-gopath to build. Once that is +- # excised, this can become ${KUBE_ROOT}. +- local trimroot # two lines to appease shellcheck SC2155 +- trimroot=$(pwd) +- +- goasmflags="all=-trimpath=${trimroot}" +- +- gogcflags="all=-trimpath=${trimroot} ${GOGCFLAGS:-}" ++ goasmflags="" ++ goflags=() ++ gogcflags="${GOGCFLAGS:-}" ++ goldflags="all=$(kube::version::ldflags) ${GOLDFLAGS:-}" + if [[ "${DBG:-}" == 1 ]]; then + # Debugging - disable optimizations and inlining. + gogcflags="${gogcflags} -N -l" +- fi +- +- goldflags="all=$(kube::version::ldflags) ${GOLDFLAGS:-}" +- if [[ "${DBG:-}" != 1 ]]; then ++ else + # Not debugging - disable symbols and DWARF. + goldflags="${goldflags} -s -w" ++ goflags+=("-trimpath") + fi + + # Extract tags if any specified in GOFLAGS +Index: kubernetes-1.24.17/test/conformance/gen-specsummaries.sh +=================================================================== +--- kubernetes-1.24.17.orig/test/conformance/gen-specsummaries.sh ++++ kubernetes-1.24.17/test/conformance/gen-specsummaries.sh +@@ -26,7 +26,12 @@ cd "${KUBE_ROOT}" + # NOTE: we do *not* use `make WHAT=...` because we do *not* want to be running + # make generated_files when diffing things (see: hack/verify-conformance-yaml.sh) + # other update/verify already handle the generated files +-hack/make-rules/build.sh vendor/github.com/onsi/ginkgo/ginkgo test/e2e/e2e.test ++# ++# Set DBG=1 to build with embedded filenames as filenames rather than ++# module-relative names (e.g. /src/kube/foo/bar.go vs. ++# k8s.io/kubernetes/foo/bar.go). These names are used by gingko in ++# `--spec-dump` which is consumed later in conformance verification. ++DBG=1 hack/make-rules/build.sh vendor/github.com/onsi/ginkgo/ginkgo test/e2e/e2e.test + + # dump spec + ./_output/bin/ginkgo --dryRun=true --focus='[Conformance]' ./_output/bin/e2e.test -- --spec-dump "${KUBE_ROOT}/_output/specsummaries.json" > /dev/null diff --git a/kubernetes1.24.changes b/kubernetes1.24.changes index f91bc20..6a73568 100644 --- a/kubernetes1.24.changes +++ b/kubernetes1.24.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jan 3 10:00:14 UTC 2024 - Bernhard Wiedemann + +- Add kubernetes-trimpath.patch for reproducible builds (boo#1062303) + ------------------------------------------------------------------- Wed Sep 20 18:12:25 UTC 2023 - Priyanka Saggu diff --git a/kubernetes1.24.spec b/kubernetes1.24.spec index d70d09f..d7c896a 100644 --- a/kubernetes1.24.spec +++ b/kubernetes1.24.spec @@ -49,6 +49,8 @@ Patch3: opensuse-version-checks.patch Patch4: kubeadm-opensuse-flexvolume.patch # Patch to revert renaming of coredns image location to match how it's done on download.opensuse.org Patch5: revert-coredns-image-renaming.patch +# Patch to fix reproducible builds https://github.com/kubernetes/kubernetes/issues/110928 +Patch6: kubernetes-trimpath.patch BuildRequires: fdupes BuildRequires: git BuildRequires: go >= 1.20.7 @@ -223,6 +225,7 @@ Fish command line completion support for %{name}-client. %patch3 -p1 %patch4 -p0 %patch5 -p1 +%patch6 -p1 %build # This is fixing bug bsc#1065972