From: Harald Hoyer Date: Thu, 11 Aug 2011 09:33:37 +0000 (+0200) Subject: git2spec.pl: filter patches with no file changes X-Git-Tag: 012~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f295392724f71d410121783cc846cd4603b2f1c2;p=thirdparty%2Fdracut.git git2spec.pl: filter patches with no file changes --- diff --git a/git2spec.pl b/git2spec.pl index 8525ad26a..2ea74c835 100755 --- a/git2spec.pl +++ b/git2spec.pl @@ -24,6 +24,15 @@ sub create_patches { close GIT; # be done return @lines; }; + +sub filter_patch { + my $patch=shift; + open(P, $patch); + @lines=

; + 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++; }