Makefile: define commit on make (s)rpm

Prepending the definition to the spec file feels brittle. Stop doing
that – pass --define to rpmbuild instead.

Keep copying the spec file from git though, so that it's always using
the one from the last commit, and not the current checkout.
This commit is contained in:
Lars Karlitski 2020-11-16 13:35:36 +01:00 committed by Tom Gundersen
parent 8a5b4bbfc0
commit b7367e2519

View file

@ -206,7 +206,7 @@ RPM_TARBALL=rpmbuild/SOURCES/osbuild-composer-$(COMMIT).tar.gz
$(RPM_SPECFILE):
mkdir -p $(CURDIR)/rpmbuild/SPECS
(echo "%global commit $(COMMIT)"; git show HEAD:osbuild-composer.spec) > $(RPM_SPECFILE)
git show HEAD:osbuild-composer.spec > $(RPM_SPECFILE)
$(RPM_TARBALL):
mkdir -p $(CURDIR)/rpmbuild/SOURCES
@ -216,6 +216,7 @@ $(RPM_TARBALL):
srpm: $(RPM_SPECFILE) $(RPM_TARBALL)
rpmbuild -bs \
--define "_topdir $(CURDIR)/rpmbuild" \
--define "commit $(COMMIT)" \
--with tests \
$(RPM_SPECFILE)
@ -223,6 +224,7 @@ srpm: $(RPM_SPECFILE) $(RPM_TARBALL)
rpm: $(RPM_SPECFILE) $(RPM_TARBALL)
rpmbuild -bb \
--define "_topdir $(CURDIR)/rpmbuild" \
--define "commit $(COMMIT)" \
--with tests \
$(RPM_SPECFILE)