From cc7b19279ad4ce28a0b94a920e07d9bde5d356ef Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Tue, 27 Feb 2024 16:38:48 +0530 Subject: [PATCH 1/3] [CI:BUILD] rpm: Make BuildRequires independent of the environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The spec file had %if %{defined rhel} && 0%{?rhel} < 10 %define gobuild(o:) ... %endif ... %if !%{defined gobuild} BuildRequires: go-rpm-macros %endif The intent apparently was to use BR:go-rpm-macros where available, and define %gobuild as a fallback where they are not available. This was unreliable, because the package may have been installed already, and then %gobuild would be defined when the srpm was being built, and then the srpm would NOT have the BR. Instead, use the same condition to wrap the definition of %gobuild and the BR lines to that the BR is always emitted when appropriate. From: Zbigniew Jędrzejewski-Szmek This is a copy-paste of commit be971d6fb in podman fedora dist-git. [NO NEW TESTS NEEDED] Signed-off-by: Lokesh Mandvekar --- rpm/podman.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/podman.spec b/rpm/podman.spec index 62ca4dce9f67..2f0cc734c338 100644 --- a/rpm/podman.spec +++ b/rpm/podman.spec @@ -81,7 +81,7 @@ BuildRequires: glibc-devel BuildRequires: glibc-static BuildRequires: golang BuildRequires: git-core -%if !%{defined gobuild} +%if %{undefined rhel} || 0%{?rhel} >= 10 BuildRequires: go-rpm-macros %endif BuildRequires: gpgme-devel From 5e387cd8af339700362c30b46ebf64c242b58ccd Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Tue, 27 Feb 2024 16:43:58 +0530 Subject: [PATCH 2/3] [CI:BUILD] rpm: Use $SOURCE_DATE_EPOCH instead of the current date MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use $SOURCE_DATE_EPOCH instead of the current date Using the current timestamp makes every build slightly different, breaking build reproducibility. From: Zbigniew Jędrzejewski-Szmek This is a copy-paste of commit a87dd6f50 in podman fedora dist-git. [NO NEW TESTS NEEDED] Signed-off-by: Lokesh Mandvekar --- rpm/podman.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/podman.spec b/rpm/podman.spec index 2f0cc734c338..0d8e78142999 100644 --- a/rpm/podman.spec +++ b/rpm/podman.spec @@ -219,7 +219,7 @@ export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" export GOPROXY=direct -LDFLAGS="-X %{ld_libpod}/define.buildInfo=$(date +%s) \ +LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:?} \ -X %{ld_libpod}/config._installPrefix=%{_prefix} \ -X %{ld_libpod}/config._etcDir=%{_sysconfdir} \ -X %{ld_project}/pkg/systemd/quadlet._binDir=%{_bindir}" From 50a0c517638269685af42fae79c60c047d4c03ed Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Tue, 27 Feb 2024 20:27:12 +0530 Subject: [PATCH 3/3] [CI:BUILD] rpm: Add fallback for $SOURCE_DATE_EPOCH not being set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least in all recent Fedora releases, SOURCE_DATE_EPOCH would be set. But the build should work even if it not set, e.g. in copr builds on c8s. Add 'date +%s' as a fallback. From: Zbigniew Jędrzejewski-Szmek This is a copy-paste of commit eaa62a52 in podman fedora dist-git. [NO NEW TESTS NEEDED] Signed-off-by: Lokesh Mandvekar --- rpm/podman.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/podman.spec b/rpm/podman.spec index 0d8e78142999..294fb5b48c7e 100644 --- a/rpm/podman.spec +++ b/rpm/podman.spec @@ -219,7 +219,7 @@ export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" export GOPROXY=direct -LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:?} \ +LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \ -X %{ld_libpod}/config._installPrefix=%{_prefix} \ -X %{ld_libpod}/config._etcDir=%{_sysconfdir} \ -X %{ld_project}/pkg/systemd/quadlet._binDir=%{_bindir}"