Blame SOURCES/0554-added-make-rpm-srpm-options.patch

49e6a8
From d76ccd07bc7d2d30ab2df38e9ae444766662c639 Mon Sep 17 00:00:00 2001
49e6a8
From: Ondrej Dubaj <odubaj@redhat.com>
49e6a8
Date: Tue, 5 Feb 2019 15:18:08 +0100
49e6a8
Subject: [PATCH] added make rpm/srpm options
49e6a8
49e6a8
---
49e6a8
 Makefile | 14 ++++++++++++--
49e6a8
 1 file changed, 12 insertions(+), 2 deletions(-)
49e6a8
49e6a8
diff --git a/Makefile b/Makefile
49e6a8
index 2977d187..43390405 100644
49e6a8
--- a/Makefile
49e6a8
+++ b/Makefile
49e6a8
@@ -1,6 +1,6 @@
49e6a8
 -include dracut-version.sh
49e6a8
 
49e6a8
-VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
49e6a8
+VERSION = $(shell [ -d .git ] && git describe --abbrev=0 2>/dev/null || echo $(DRACUT_VERSION))
49e6a8
 GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
49e6a8
 
49e6a8
 -include Makefile.inc
49e6a8
@@ -39,7 +39,7 @@ man8pages = dracut.8 \
49e6a8
 
49e6a8
 manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
49e6a8
 
49e6a8
-.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
49e6a8
+.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh
49e6a8
 
49e6a8
 all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
49e6a8
 
49e6a8
@@ -202,6 +202,16 @@ rpm: dracut-$(VERSION).tar.bz2 syncheck
49e6a8
 		--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
49e6a8
 	( mv "$$rpmbuild"/$$(arch)/*.rpm $(DESTDIR).; mv "$$rpmbuild"/*.src.rpm $(DESTDIR).;rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
49e6a8
 
49e6a8
+srpm: dracut-$(VERSION).tar.bz2 syncheck
49e6a8
+	rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
49e6a8
+	cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
49e6a8
+	LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
49e6a8
+	(cd "$$rpmbuild"; \
49e6a8
+	rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
49e6a8
+	        --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
49e6a8
+		--define "_rpmdir $$PWD" -bs dracut.spec; ) && \
49e6a8
+	( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
49e6a8
+
49e6a8
 syncheck:
49e6a8
 	@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
49e6a8
                 [ "$${i##*/}" = "module-setup.sh" ] && continue; \