Skip to contentSkip to conversation

P-O-M-ng: runme shouldn't pick up backup files

PATCH New Alan Ezust 1 participant 1 message Oct 12, 2006 netfilter

lore
Share & tools
lore

Alan Ezust

author
#0 lore raw

PATCH 1/1 P-O-M-ng: runme shouldn't pick up backup files

This patch is for the patchomatic runme script. It addresses two issues:

1. When a patch fails, it shows you exactly which file caused the failure.
2. When there are backup files (ending with ~ or beginning with #) they are ignored by POM.

Netfilter_POM.pm +7 -8
Index: Netfilter_POM.pm
===================================================================
@@ -361,7 +361,7 @@
 	opendir(DIR, $dir)
 		or croak "can't open directory $dir: $!";
 	# Don't miss .foo-test files!
-	my @dents = sort grep {!/^(\.\.?|CVS|\.svn)$/} readdir(DIR);
+	my @dents = sort grep {!/^(\.\.?|CVS|\.svn|.*~)$/} readdir(DIR);
 	closedir(DIR);
 	foreach my $dent (@dents) {
 		my $fullpath = "$dir/$dent";
@@ -486,7 +486,7 @@
 	# get list of source files that we'd need to copy
 	opendir(PDIR, $patchdir)
 		or croak "unable to open patchdir $patchdir: $!";
-	my @dents = sort readdir(PDIR);
+        my @dents = sort grep {!/^(\.\.?|CVS|\.svn|.*~)$/} readdir(PDIR);
 	closedir(PDIR);
 
 	foreach my $pf (@dents) {
@@ -494,7 +494,6 @@
 		my $ver;
 		my $oldpwd;
 
-		next if $pf =~ /^(\.|CVS$)/;
 
 		if ($pf =~ /\.patch/) {
 			# Patch file of a project:
@@ -820,22 +819,22 @@
 				print "patch output was:\n$patch_output\n";
 			}
 			if ($missing_files != 0) {
-				$self->{ERRMSG} .= "cannot apply ($missing_files missing files)\n";
+				$self->{ERRMSG} .= "cannot apply $patchfile: ($missing_files missing files)\n";
 				return 0;
 			# } elsif ($rejects*2 > $hunks) {
 			} elsif ($rejects != 0) {
-				$self->{ERRMSG} .= "cannot apply ($rejects rejects out of $hunks hunks)\n";
+				$self->{ERRMSG} .= "cannot apply $patchfile: ($rejects rejects out of $hunks hunks)\n";
 				return 0;
 			} else {
 				# could be applied!
-				#printf(" ALREADY APPLIED (%d rejects out of %d hunks)\n", $rejects, $hunks;
+				#printf(" ALREADY APPLIED $patchfile: (%d rejects out of %d hunks)\n", $rejects, $hunks;
 			}
 		} else {
 			if ($missing_files != 0) {
-				$self->{ERRMSG} .= "ERROR ($missing_files missing files)\n";
+				$self->{ERRMSG} .= "$patchfile: ERROR ($missing_files missing files)\n";
 				return 0;
 			} elsif ($rejects != 0) {
-				$self->{ERRMSG} .= "ERROR ($rejects rejects out of $hunks hunks)\n";
+				$self->{ERRMSG} .= "$patchfile: ERROR ($rejects rejects out of $hunks hunks)\n";
 				return 0;
 			}
 		}
runme +2 -1
Index: runme
===================================================================
@@ -109,7 +109,8 @@
 	open(SOURCES, "<sources.list") || die "could not open sources.list";
 	while (my $source = <SOURCES>) {
 		chomp($source);
-		if ($source =~ m/^\s*#/ || $source =~ m/^\s+$/) {
+		if ($source =~ m/^\s*#/ || $source =~ m/^\s+$/
+                    || $source =~ m/~$/ ) {
 			next;
 		}
 		if (!open(INDEX, "curl -s $source/index |")) {