[skip-ci] Packit/RPM: Display upstream commit SHA in all rpm builds

Packit's `pre-sync` action allows modification of spec file prior to
dist-git PR creation. This is already being done on containers-common
rpm to update c/storage and c/image verions tags in spec.

This commit will allow `podman version` to show `Git Commit: $SHA` for
copr as well as koji builds.

Ref: https://raw.githubusercontent.com/containers/common/refs/heads/main/.packit.yaml

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar
2025-03-04 17:50:44 +05:30
parent ebec104391
commit 84c56243a2
4 changed files with 24 additions and 18 deletions

View File

@ -238,12 +238,10 @@ LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \
-X %{ld_libpod}/config._etcDir=%{_sysconfdir} \
-X %{ld_project}/pkg/systemd/quadlet._binDir=%{_bindir}"
%if %{defined copr_build}
# ##GIT_COMMIT## is set by `.packit.sh` in Packit's Copr RPM build jobs.
# Has no effect on Koji builds.
GIT_COMMIT="##GIT_COMMIT##"
# This variable will be set by Packit actions. See .packit.yaml in the root dir
# of the repo (upstream as well as Fedora dist-git).
GIT_COMMIT=""
LDFLAGS="$LDFLAGS -X %{ld_libpod}/define.gitCommit=$GIT_COMMIT"
%endif
# build rootlessport first
%gobuild -o bin/rootlessport ./cmd/rootlessport