Skip to contentSkip to conversation

POM-NG: runme message clarification and filename regex fixes (v3)

PATCH In review Alan Ezust 3 participants 3 messages Jan 11, 2007 – Jan 12, 2007 netfilter

lore
Share & tools
lore

Alan Ezust

author
#0 lore raw

PATCH 1/1 POM-NG: runme message clarification and filename regex fixes (v3)

This patch (3rd attempt to submit), includes fixes to the messages, to clarify where things went wrong (when they do go wrong), and also avoids picking up backup files in the patchlets directory.

Cheers --alan

Signature · 3 lines
Alan Ezust            www.presinet.com
Presinet, inc         [email protected]
           Victoria, BC, Canada
Netfilter_POM.pm +9 -9
Index: Netfilter_POM.pm
===================================================================
@@ -361,12 +361,13 @@
 	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";
 		if (-f $fullpath) {
-			push(@{$patchlet->{$dent =~ /\.ladd/ ? 'ladds' : 'files'}->{$proj}->{$ver}}, "$pdir/$fullpath");
+                        my $key = ($dent =~ /\.ladd/ ? 'ladds' : 'files');
+			push(@{$patchlet->{$key}->{$proj}->{$ver}}, "$pdir/$fullpath");
 		} elsif (-d _) {
 			$self->recurse($pdir, $fullpath, $patchlet, $proj, $ver);
 		}
@@ -486,7 +487,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 +495,6 @@
 		my $ver;
 		my $oldpwd;
 
-		next if $pf =~ /^(\.|CVS$)/;
 
 		if ($pf =~ /\.patch/) {
 			# Patch file of a project:
@@ -820,22 +820,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 +7 -6
Index: runme
===================================================================
@@ -3,7 +3,7 @@
 # runme.pl, part of the patch-o-matig 'next generation' package.
 # (C) 2003-2004 by Harald Welte <[email protected]>
 #     2004	by Jozsef Kadlecsik <[email protected]>
-#
+#     2006      small fixes by Alan Ezust <[email protected]>
 # This script is subject to the GNU GPLv2
 #
 # $Id$
@@ -75,7 +75,7 @@
 
 my @patchlets;
 my @repositories;
-my $clrscr = "\n\n\n\n\n\n\n\n\n\n";
+my $clrscr = "\n\n\n\n\n";
 
 my $opt_batch; 
 my $opt_verbose; 
@@ -346,15 +346,16 @@
 
 		print($clrscr);
 		print_header($session);
-		print("Already applied: ", join(" ", @{$session->{applied}}),"\n\n");
+		print("Already applied: ", join(" ", @{$session->{applied}}),"\n");
 
 		next PATCHLET unless $session->requirements_fulfilled($patchlet);
 		print("Testing ${plname}... ");
 		if (grep($_ eq $plname, @{$session->{applied}})) {
-			print("applied\n");
+			print("already applied.\n");
 			next PATCHLET;
-		} elsif ($session->apply_patchlet($patchlet, !$opt_reverse, 1, "/tmp/pom-$$", $opt_verbose)) {
-			print("applied\n");
+		} 
+		elsif ($session->apply_patchlet($patchlet, !$opt_reverse, 1, "/tmp/pom-$$", $opt_verbose)) {
+			print("Reverse Test passed - assuming already applied.\n");
 			push(@{$session->{applied}}, $plname);
 			next PATCHLET;
 		}
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Quoting Alan Ezust on 01/11/2007 06:21 PM UTC:

Quoted 3 lines

This patch (3rd attempt to submit), includes fixes to the messages, to clarify where things went wrong (when they do go wrong), and also avoids picking up backup files in the patchlets directory.

Nice! (haven't tested it yet though =)

- - xkr47

- --
"if I'd make up my own definitions, unrational would be the the end
result after someone unrationalized something i.e. actively worked to cut down on rationality, whereas irrational would be more a result of laziness or lack of skill"
- me, 23.11.2006
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFpsvZxyF48ZTvn+4RA05cAJ4+BO5mfDWjqnbbRCoZAKrmFg1rVgCdE6v+ hoAfmU9EZZ9GSj5JpOIl2m0=
=1pyI
-----END PGP SIGNATURE-----

#2 lore raw
In reply to Alan Ezust
Quoted 3 lines · Alan Ezust

This patch (3rd attempt to submit), includes fixes to the messages, to clarify where things went wrong (when they do go wrong), and also avoids picking up backup files in the patchlets directory.

I fixed the whitespace damage and applied it, thanks.

runme line 357

Quoted 4 lines
runme +2 -2
-		} elsif ($session->apply_patchlet($patchlet, !$opt_reverse, 1, "/tmp/pom-$$", $opt_verbose)) {
-			print("applied\n");
+		} 
+		elsif ($session->apply_patchlet($patchlet, !$opt_reverse, 1, "/tmp/pom-$$", $opt_verbose)) {

Please make sure you don't mix reformating like this with real changes.