Harald Hoyer 19aece
From 0eef73ea43427cdb82fa031e09978d3cea6e188a Mon Sep 17 00:00:00 2001
Harald Hoyer 19aece
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 19aece
Date: Wed, 24 Oct 2018 15:14:03 +0200
Harald Hoyer 19aece
Subject: [PATCH] Makefile: add srpm target
Harald Hoyer 19aece
Harald Hoyer 19aece
---
Harald Hoyer 19aece
 Makefile | 13 ++++++++++++-
Harald Hoyer 19aece
 1 file changed, 12 insertions(+), 1 deletion(-)
Harald Hoyer 19aece
Harald Hoyer 19aece
diff --git a/Makefile b/Makefile
Harald Hoyer 19aece
index 80623437..503d069f 100644
Harald Hoyer 19aece
--- a/Makefile
Harald Hoyer 19aece
+++ b/Makefile
Harald Hoyer 19aece
@@ -40,7 +40,7 @@ man8pages = dracut.8 \
Harald Hoyer 19aece
 
Harald Hoyer 19aece
 manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
Harald Hoyer 19aece
 
Harald Hoyer 19aece
-.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
Harald Hoyer 19aece
+.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh
Harald Hoyer 19aece
 
Harald Hoyer 19aece
 all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
Harald Hoyer 19aece
 
Harald Hoyer 19aece
@@ -216,6 +216,17 @@ rpm: dracut-$(VERSION).tar.xz syncheck
Harald Hoyer 19aece
 		--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
Harald Hoyer 19aece
 	( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
Harald Hoyer 19aece
 
Harald Hoyer 19aece
+srpm: dracut-$(VERSION).tar.xz syncheck
Harald Hoyer 19aece
+	rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
Harald Hoyer 19aece
+	cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
Harald Hoyer 19aece
+	LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
Harald Hoyer 19aece
+	(cd "$$rpmbuild"; \
Harald Hoyer 19aece
+	[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
Harald Hoyer 19aece
+	rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
Harald Hoyer 19aece
+	        --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
Harald Hoyer 19aece
+		--define "_rpmdir $$PWD" -bs dracut.spec; ) && \
Harald Hoyer 19aece
+	( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
Harald Hoyer 19aece
+
Harald Hoyer 19aece
 syncheck:
Harald Hoyer 19aece
 	@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
Harald Hoyer 19aece
                 [ "$${i##*/}" = "module-setup.sh" ] && continue; \