Merge pull request #20091 from lsm5/copr-rpm-version-sha

[CI:BUILD] Packit: Copr rpm version sha
This commit is contained in:
OpenShift Merge Robot 2023-09-25 08:26:10 -04:00 committed by GitHub
commit ca1cd0204c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 7 deletions

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
# This script handles any custom processing of the spec file using the `fix-spec-file`
# action in .packit.yaml.
# action in .packit.yaml. These steps only work on copr builds, not on official
# Fedora builds.
set -eox pipefail
@ -40,8 +41,8 @@ sed -i "s/^Source0:.*.tar.gz/Source0: $PACKAGE-$VERSION.tar.gz/" $SPEC_FILE
# Update setup macro to use the correct build dir
sed -i "s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION/" $SPEC_FILE
# podman --version should show short sha
sed -i "s/^const RawVersion = \"$VERSION\"/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
# Update relevant sed entries in spec file with the actual VERSION and SHORT_SHA
# This allows podman --version to also show the SHORT_SHA along with the
# VERSION
sed -i "s/##VERSION##/$VERSION/" $SPEC_FILE
sed -i "s/##SHORT_SHA##/$SHORT_SHA/" $SPEC_FILE

View File

@ -31,6 +31,10 @@
%define build_with_btrfs 1
%endif
%if %{defined copr_username}
%define copr_build 1
%endif
%global container_base_path github.com/containers
%global container_base_url https://%{container_base_path}
@ -48,7 +52,7 @@
%global import_path_plugins %{container_base_path}/%{repo_plugins}
Name: podman
%if %{defined copr_username}
%if %{defined copr_build}
Epoch: 102
%else
Epoch: 5
@ -203,6 +207,14 @@ when `%{_bindir}/%{name}sh` is set as a login shell or set as os.Args[0].
%autosetup -Sgit -n %{name}-%{version}
sed -i 's;@@PODMAN@@\;$(BINDIR);@@PODMAN@@\;%{_bindir};' Makefile
# 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
# untar dnsname
tar zxf %{SOURCE1}