]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Makefile, git2spec.pl: use temporary builddir
authorHarald Hoyer <harald@redhat.com>
Wed, 9 Nov 2011 08:51:15 +0000 (09:51 +0100)
committerHarald Hoyer <harald@redhat.com>
Tue, 15 Nov 2011 08:47:19 +0000 (09:47 +0100)
to build the dracut rpm, use a temporary builddir

Makefile
git2spec.pl

index 991058ff07450923d8addb942879870c25bd1f1b..80173a37ead1144e3d8d697c0262a964b5cdd817 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -66,13 +66,13 @@ dracut-$(VERSION).tar.gz:
        git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
 
 rpm: dracut-$(VERSION).tar.bz2
-       mkdir -p rpmbuild
-       cp dracut-$(VERSION).tar.bz2 rpmbuild
-       cd rpmbuild; ../git2spec.pl $(VERSION) < ../dracut.spec > dracut.spec; \
-       rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
+       rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
+       cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
+       $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
+       (cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
                --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
-               --define "_rpmdir $$PWD" -ba dracut.spec && \
-       ( cd ..; mv rpmbuild/noarch/*.rpm .; mv rpmbuild/*.src.rpm .;rm -fr rpmbuild; ls *.rpm )
+               --define "_rpmdir $$PWD" -ba dracut.spec; ) && \
+       ( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
 
 syncheck:
        @ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
index 9db42aa1907df5dcb5034dbf2f874ad00f1ffcfb..27e588947fd1a94cebbb25fa0477943021f3ca7a 100755 (executable)
@@ -18,8 +18,9 @@ sub last_tag {
 
 sub create_patches {
     my $tag=shift;
+    my $pdir=shift;
     my $num=0;
-    open( GIT, 'git format-patch -N --no-signature '.$tag.' |');
+    open( GIT, 'git format-patch -N --no-signature -o "'.$pdir.'" '.$tag.' |');
     @lines=<GIT>;
     close GIT;         # be done
     return @lines;
@@ -29,8 +30,9 @@ use POSIX qw(strftime);
 my $datestr = strftime "%Y%m%d", gmtime;
 
 my $tag=shift;
+my $pdir=shift;
 $tag=&last_tag if not defined $tag;
-my @patches=&create_patches($tag);
+my @patches=&create_patches($tag, $pdir);
 my $num=$#patches + 2;
 $tag=~s/[^0-9]+?([0-9]+)/$1/;
 my $release="$num.git$datestr";