Skip to content

Commit

Permalink
chore(makefile): always generate the vendor tar file and rename COMMI…
Browse files Browse the repository at this point in the history
…T var

Generate the vendor tar file for all the distributions and
rename the Makefile `COMMIT` variable to `VERSION`

Signed-off-by: Miguel Martín <[email protected]>
  • Loading branch information
mmartinv committed Nov 27, 2024
1 parent f01bd61 commit e5c14bb
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include /etc/os-release

SRCDIR ?= .
COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))
VERSION = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))

#
# Generic Targets
Expand Down Expand Up @@ -38,14 +38,14 @@ help:
# ./rpmbuild, using rpmbuild's usual directory structure.
#

RPM_SPECFILE=rpmbuild/SPECS/fido-device-onboard-rs-$(COMMIT).spec
RPM_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(COMMIT).tar.gz
VENDOR_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(COMMIT)-vendor-patched.tar.xz
RPM_SPECFILE=rpmbuild/SPECS/fido-device-onboard-rs-$(VERSION).spec
RPM_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(VERSION).tar.gz
VENDOR_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(VERSION)-vendor-patched.tar.xz
PATCH_FILE=rpmbuild/SOURCES/0001-Revert-chore-use-git-fork-for-aws-nitro-enclaves-cos.patch

$(RPM_SPECFILE):
mkdir -p $(CURDIR)/rpmbuild/SPECS
sed -e "s/^Version:.*/Version: $(COMMIT)/;" fido-device-onboard.spec > $(RPM_SPECFILE)
sed -e "s/^Version:.*/Version: $(VERSION)/;" fido-device-onboard.spec > $(RPM_SPECFILE)
if [ "$(ID)" = "fedora" ] && [ $(VARIANT_ID) != "eln" ]; then \
sed -i "/Source1/d ; /^# See make-vendored-tarfile.sh in upstream repo/d ;" $(RPM_SPECFILE); \
fi
Expand All @@ -57,13 +57,12 @@ $(PATCH_FILE):

$(RPM_TARBALL):
mkdir -p $(CURDIR)/rpmbuild/SOURCES
git archive --prefix=fido-device-onboard-rs-$(COMMIT)/ --format=tar.gz HEAD > $(RPM_TARBALL)
git archive --prefix=fido-device-onboard-rs-$(VERSION)/ --format=tar.gz HEAD > $(RPM_TARBALL)

$(VENDOR_TARBALL):
[ "$(ID)" = "fedora" ] && [ $(VARIANT_ID) != "eln" ] || ( \
mkdir -p $(CURDIR)/rpmbuild/SOURCES ; \
./make-vendored-tarfile.sh $(COMMIT) ; \
mv fido-device-onboard-rs-$(COMMIT)-vendor-patched.tar.xz rpmbuild/SOURCES ;)
./make-vendored-tarfile.sh $(VERSION) ; \
mv fido-device-onboard-rs-$(VERSION)-vendor-patched.tar.xz $(VENDOR_TARBALL)

.PHONY: srpm
srpm: $(RPM_SPECFILE) $(PATCH_FILE) $(RPM_TARBALL) $(VENDOR_TARBALL)
Expand Down

0 comments on commit e5c14bb

Please sign in to comment.