]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
git2spec.pl: filter patches with no file changes
authorHarald Hoyer <harald@redhat.com>
Thu, 11 Aug 2011 09:33:37 +0000 (11:33 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 11 Aug 2011 12:27:25 +0000 (14:27 +0200)
git2spec.pl

index 8525ad26a719b749d39cbfdba17e37cb0b8fca5c..2ea74c835ddebb0ef9cbe1a3d2a8c2029d7f8a65 100755 (executable)
@@ -24,6 +24,15 @@ sub create_patches {
     close GIT;         # be done
     return @lines;
 };
+
+sub filter_patch {
+       my $patch=shift;
+       open(P, $patch);
+       @lines=<P>;
+       close(P);
+       grep (/^ 0 files changed/, @lines);
+}
+
 use POSIX qw(strftime);
 my $datestr = strftime "%Y%m%d", gmtime;
 
@@ -40,12 +49,13 @@ while(<>) {
        print "Version: $tag\n";
     }
     elsif (/^Release:/) {
-       print "Release: $release\n";
+       print "Release: $release%{?dist}\n";
     }
     elsif ((/^Source0:/) || (/^Source:/)) {
        print $_;
        $num=1;
        for(@patches) {
+           next if filter_patch $_;
            print "Patch$num: $_";
            $num++;
        }
@@ -55,6 +65,7 @@ while(<>) {
        print $_;
        $num=1;
        for(@patches) {
+           next if filter_patch $_;
            print "%patch$num -p1\n";
            $num++;
        }