Skip to content

Commit f9ae5eb

Browse files
cfergeaupraveenkumar
authored andcommitted
spec: Substitute git revision when generating
When doing a build from the spec file, 'git rev-parse HEAD' is unlikely to correspond to a hash from github.com/code-ready/crc. It will most likely be a hash from dist-git, or from a git repository created at build time by `%autosetup -S git` This commit allows to use 'make COMMIT_SHA=xxxx' to override the one used at build time, to ensure the sha we use in release-info.json or in "crc version" is something useful.
1 parent 352872e commit f9ae5eb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ OKD_VERSION ?= 4.12.0-0.okd-2023-02-18-033438
88
MICROSHIFT_VERSION ?= 4.12.5
99
BUNDLE_EXTENSION = crcbundle
1010
CRC_VERSION = 2.15.0
11-
COMMIT_SHA=$(shell git rev-parse --short HEAD)
11+
COMMIT_SHA?=$(shell git rev-parse --short HEAD)
1212
MACOS_INSTALL_PATH = /usr/local/crc
1313
CONTAINER_RUNTIME ?= podman
1414

@@ -359,6 +359,7 @@ $(BUILD_DIR)/macos-universal/crc-macos-installer.tar: packagedir
359359
-e '/__BUNDLED_PROVIDES__/d' \
360360
-e 's/__VERSION__/'$(CRC_VERSION)'/g' \
361361
-e 's/__OPENSHIFT_VERSION__/'$(OPENSHIFT_VERSION)'/g' \
362+
-e 's/__COMMIT_SHA__/'$(COMMIT_SHA)'/g' \
362363
$< >$@
363364

364365
%: %.in

packaging/rpm/crc.spec.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export GOFLAGS="-mod=vendor"
6060
mkdir embed-files
6161
cp /usr/bin/crc-driver-libvirt embed-files
6262
cp /usr/bin/crc-admin-helper embed-files/crc-admin-helper-linux
63-
make GO_EXTRA_LDFLAGS="-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" GO_EXTRA_BUILDFLAGS="" CUSTOM_EMBED=true EMBED_DOWNLOAD_DIR=embed-files/ release
63+
make COMMIT_SHA=__COMMIT_SHA__ GO_EXTRA_LDFLAGS="-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" GO_EXTRA_BUILDFLAGS="" CUSTOM_EMBED=true EMBED_DOWNLOAD_DIR=embed-files/ release
6464

6565
%install
6666
# with fedora macros: gopkginstall

0 commit comments

Comments
 (0)