[netfilter-cvslog] r4022 - trunk/patch-o-matic-ng

laforge at netfilter.org laforge at netfilter.org
Mon Jun 27 11:16:59 CEST 2005


Author: laforge at netfilter.org
Date: 2005-06-27 11:16:59 +0200 (Mon, 27 Jun 2005)
New Revision: 4022

Modified:
   trunk/patch-o-matic-ng/Netfilter_POM.pm
   trunk/patch-o-matic-ng/runme
Log:
Add --verbose (Sven Anders <anders at anduras.de>)


Modified: trunk/patch-o-matic-ng/Netfilter_POM.pm
===================================================================
--- trunk/patch-o-matic-ng/Netfilter_POM.pm	2005-06-27 09:10:54 UTC (rev 4021)
+++ trunk/patch-o-matic-ng/Netfilter_POM.pm	2005-06-27 09:16:59 UTC (rev 4022)
@@ -767,7 +767,7 @@
 
 sub apply_patches {
 	my $self = shift;
-	my($patchlet, $proj, $revert, $test, $copy) = @_;
+	my($patchlet, $proj, $revert, $test, $copy, $verbose) = @_;
 
 	return 1 unless safe_exists($patchlet, ('patch', $proj, 'best'));
 
@@ -798,9 +798,11 @@
 		my $rejects;
 		my $notempty;
 		my $hunks = count_hunks($patchfile);
+		my $patch_output = "";
 		open(PATCH, "$cmd|") || die("can't start patch '$cmd': $!\n");
 		while (my $line = <PATCH>) {
 			# FIXME: parse patch output
+			$patch_output .= ">> $line";
 			chomp($line);
 			if ($line =~ /No file to patch/) {
 				$missing_files++;
@@ -813,6 +815,10 @@
 		close(PATCH);
 
 		if ($test) {
+			if ($verbose && (($missing_files != 0) || ($rejects != 0)))
+			{
+				print "patch output was:\n$patch_output\n";
+			}
 			if ($missing_files != 0) {
 				$self->{ERRMSG} .= "cannot apply ($missing_files missing files)\n";
 				return 0;
@@ -843,10 +849,11 @@
 # 	normal (non-test) mode: 1 on success, 0 on failure
 # 	test mode: 1 if test was successful (patch could be applied/reverted)
 #	copy: directory with the shadow tree, if any
+#	verbose mode: output verbose messages
 #
 sub apply_patchlet {
 	my $self = shift;
-	my($patchlet, $revert, $test, $copy) = @_;
+	my($patchlet, $revert, $test, $copy, $verbose) = @_;
 	my(@projects);
 
 	# print Dumper($patchlet);
@@ -869,7 +876,7 @@
 
 		if (!(($self->apply_newfiles($patchlet, $proj, $revert, $test, $copy)
 				 && $self->apply_lineadds($patchlet, $proj, $revert, $test, $copy)
-				 && $self->apply_patches($patchlet, $proj, $revert, $test, $copy))
+				 && $self->apply_patches($patchlet, $proj, $revert, $test, $copy, $verbose))
 			     || ($test
 				 && defined $patchlet->{info}->{successor}
 				 && defined $self->{patchlets}->{$patchlet->{info}->{successor}}

Modified: trunk/patch-o-matic-ng/runme
===================================================================
--- trunk/patch-o-matic-ng/runme	2005-06-27 09:10:54 UTC (rev 4021)
+++ trunk/patch-o-matic-ng/runme	2005-06-27 09:16:59 UTC (rev 4022)
@@ -78,6 +78,7 @@
 my $clrscr = "\n\n\n\n\n\n\n\n\n\n";
 
 my $opt_batch; 
+my $opt_verbose; 
 my $opt_test;
 my $opt_check;
 my $opt_reverse;
@@ -89,6 +90,7 @@
 my $opt_iptpath;
 
 my $result = GetOptions("batch" => \$opt_batch,
+			"verbose" => \$opt_verbose,
 			"test" => \$opt_test,
 			"check" => \$opt_check,
 			"reverse" => \$opt_reverse,
@@ -234,7 +236,7 @@
 		if (grep($_ eq $plname, @{$session->{applied}})) {
 			print("applied\n");
 			next PATCHLET;
-		} elsif ($session->apply_patchlet($patchlet, !$opt_reverse, 1, "/tmp/pom-$$")) {
+		} elsif ($session->apply_patchlet($patchlet, !$opt_reverse, 1, "/tmp/pom-$$", $opt_verbose)) {
 			print("applied\n");
 			push(@{$session->{applied}}, $plname);
 			next PATCHLET;
@@ -368,6 +370,10 @@
 
 specify the iptables source path
 
+=item B<--verbose>
+
+verbose output (shows output of patch command)
+
 =back
 
 =head1 DESCRIPTION




More information about the netfilter-cvslog mailing list