mirror of
https://github.com/containers/podman.git
synced 2025-10-16 10:43:52 +08:00
[skip-ci] Packit/Copr: Fix podman version
in rpm
Additional rpm patching to show upstream short sha in `podman --version` caused podman-machine-os tests to fail. This commit gets rid of that patching and instead sets define.gitCommit LDFLAG for Copr rpms. Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
@ -12,7 +12,7 @@ PACKAGE=podman
|
|||||||
SPEC_FILE=rpm/$PACKAGE.spec
|
SPEC_FILE=rpm/$PACKAGE.spec
|
||||||
|
|
||||||
# Get short sha
|
# Get short sha
|
||||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
GIT_COMMIT=$(git rev-parse HEAD)
|
||||||
|
|
||||||
# Get Version from HEAD
|
# Get Version from HEAD
|
||||||
VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2)
|
VERSION=$(grep '^const RawVersion' version/rawversion/version.go | cut -d\" -f2)
|
||||||
@ -41,8 +41,5 @@ sed -i "s/^Source0:.*.tar.gz/Source0: $PACKAGE-$VERSION.tar.gz/" $SPEC_FILE
|
|||||||
# Update setup macro to use the correct build dir
|
# Update setup macro to use the correct build dir
|
||||||
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE
|
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE
|
||||||
|
|
||||||
# Update relevant sed entries in spec file with the actual VERSION and SHORT_SHA
|
# Update LDFLAGS to show commit id for Copr builds
|
||||||
# This allows podman --version to also show the SHORT_SHA along with the
|
sed -i "s/##GIT_COMMIT##/$GIT_COMMIT/" $SPEC_FILE
|
||||||
# VERSION
|
|
||||||
sed -i "s/##VERSION##/$VERSION/" $SPEC_FILE
|
|
||||||
sed -i "s/##SHORT_SHA##/$SHORT_SHA/" $SPEC_FILE
|
|
||||||
|
@ -216,14 +216,6 @@ sed -i 's;@@PODMAN@@\;$(BINDIR);@@PODMAN@@\;%{_bindir};' Makefile
|
|||||||
sed -i '/DELETE ON RHEL9/,/DELETE ON RHEL9/d' libpod/runtime.go
|
sed -i '/DELETE ON RHEL9/,/DELETE ON RHEL9/d' libpod/runtime.go
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# These changes are only meant for copr builds
|
|
||||||
%if %{defined copr_build}
|
|
||||||
# podman --version should show short sha
|
|
||||||
sed -i "s/^const RawVersion = .*/const RawVersion = \"##VERSION##-##SHORT_SHA##\"/" version/rawversion/version.go
|
|
||||||
# use ParseTolerant to allow short sha in version
|
|
||||||
sed -i "s/^var Version.*/var Version, err = semver.ParseTolerant(rawversion.RawVersion)/" version/version.go
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%set_build_flags
|
%set_build_flags
|
||||||
export CGO_CFLAGS=$CFLAGS
|
export CGO_CFLAGS=$CFLAGS
|
||||||
@ -245,6 +237,13 @@ LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \
|
|||||||
-X %{ld_libpod}/config._etcDir=%{_sysconfdir} \
|
-X %{ld_libpod}/config._etcDir=%{_sysconfdir} \
|
||||||
-X %{ld_project}/pkg/systemd/quadlet._binDir=%{_bindir}"
|
-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##"
|
||||||
|
LDFLAGS="$LDFLAGS -X %{ld_libpod}/define.gitCommit=$GIT_COMMIT"
|
||||||
|
%endif
|
||||||
|
|
||||||
# build rootlessport first
|
# build rootlessport first
|
||||||
%gobuild -o bin/rootlessport ./cmd/rootlessport
|
%gobuild -o bin/rootlessport ./cmd/rootlessport
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user