File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ PACKAGE=podman
12
12
SPEC_FILE=rpm/$PACKAGE .spec
13
13
14
14
# Get short sha
15
- SHORT_SHA =$( git rev-parse --short HEAD)
15
+ GIT_COMMIT =$( git rev-parse HEAD)
16
16
17
17
# Get Version from HEAD
18
18
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
41
41
# Update setup macro to use the correct build dir
42
42
sed -i " s/^%autosetup.*/%autosetup -Sgit -n %{name}-$VERSION /" $SPEC_FILE
43
43
44
- # Update relevant sed entries in spec file with the actual VERSION and SHORT_SHA
45
- # This allows podman --version to also show the SHORT_SHA along with the
46
- # VERSION
47
- sed -i " s/##VERSION##/$VERSION /" $SPEC_FILE
48
- sed -i " s/##SHORT_SHA##/$SHORT_SHA /" $SPEC_FILE
44
+ # Update LDFLAGS to show commit id for Copr builds
45
+ sed -i " s/##GIT_COMMIT##/$GIT_COMMIT /" $SPEC_FILE
Original file line number Diff line number Diff line change @@ -216,14 +216,6 @@ sed -i 's;@@PODMAN@@\;$(BINDIR);@@PODMAN@@\;%{_bindir};' Makefile
216
216
sed -i '/DELETE ON RHEL9/,/DELETE ON RHEL9/d' libpod/runtime.go
217
217
%endif
218
218
219
- # These changes are only meant for copr builds
220
- %if %{defined copr_build }
221
- # podman --version should show short sha
222
- sed -i "s/^const RawVersion = .*/const RawVersion = \"##VERSION##-##SHORT_SHA##\"/" version/rawversion/version.go
223
- # use ParseTolerant to allow short sha in version
224
- sed -i "s/^var Version.*/var Version, err = semver.ParseTolerant(rawversion.RawVersion)/" version/version.go
225
- %endif
226
-
227
219
%build
228
220
%set_build_flags
229
221
export CGO_CFLAGS=$CFLAGS
@@ -245,6 +237,13 @@ LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \
245
237
-X %{ld_libpod }/config._etcDir= %{_sysconfdir } \
246
238
-X %{ld_project }/pkg/systemd/quadlet._binDir= %{_bindir }"
247
239
240
+ %if %{defined copr_build }
241
+ # ##GIT_COMMIT## is set by `.packit.sh` in Packit's Copr RPM build jobs.
242
+ # Has no effect on Koji builds.
243
+ GIT_COMMIT = "##GIT_COMMIT##"
244
+ LDFLAGS= "$LDFLAGS -X %{ld_libpod }/define.gitCommit= $GIT_COMMIT "
245
+ %endif
246
+
248
247
# build rootlessport first
249
248
%gobuild -o bin/rootlessport ./cmd/rootlessport
250
249
You can’t perform that action at this time.
0 commit comments