All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] -verbose for 'runme'
@ 2005-06-23  8:09 Sven Anders
  2005-06-27  9:03 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Anders @ 2005-06-23  8:09 UTC (permalink / raw)
  To: netfilter-devel; +Cc: laforge

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

I added a verbose option to the 'runme' script.
It simply shows the output of the called 'patch' command, so you could
see *why* a try to patch failed.

Maybe any of the maintainers will find it useful too, and will add it...

Regards
~ Sven
- --
~ Sven Anders <anders@anduras.de>                 () Ascii Ribbon Campaign
~                                                 /\ Support plain text e-mail
~ ANDURAS service solutions AG
~ Innstraße 71 - 94036 Passau - Germany
~ Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55

Rechtsform: Aktiengesellschaft - Sitz: Passau - Amtsgericht Passau HRB 6032
Mitglieder des Vorstands: Sven Anders, Marcus Junker, Michael Schön
Vorsitzender des Aufsichtsrats: Dipl. Kfm. Thomas Träger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFCum5K5lKZ7Feg4EcRApWwAJ9+gqg9Pj9kQGI5lPQgzFDNODGslQCeN3og
Tzw29jF2hE68CROaPiOMtS0=
=XEoI
-----END PGP SIGNATURE-----

[-- Attachment #2: Nefilter_POM.pm.patch --]
[-- Type: text/x-diff, Size: 1922 bytes --]

--- Netfilter_POM.pm.orig	2005-02-16 14:25:55.000000000 +0100
+++ Netfilter_POM.pm	2005-02-16 22:20:28.000000000 +0100
@@ -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}}

[-- Attachment #3: runme.patch --]
[-- Type: text/x-diff, Size: 990 bytes --]

--- runme.orig	2005-02-16 22:16:07.000000000 +0100
+++ runme	2005-02-16 22:21:09.000000000 +0100
@@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] -verbose for 'runme'
  2005-06-23  8:09 [PATCH] -verbose for 'runme' Sven Anders
@ 2005-06-27  9:03 ` Harald Welte
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2005-06-27  9:03 UTC (permalink / raw)
  To: Sven Anders; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

On Thu, Jun 23, 2005 at 10:09:47AM +0200, Sven Anders wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello!
> 
> I added a verbose option to the 'runme' script.
> It simply shows the output of the called 'patch' command, so you could
> see *why* a try to patch failed.

thanks, applied.
-- 
- Harald Welte <laforge@netfilter.org>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-06-27  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-23  8:09 [PATCH] -verbose for 'runme' Sven Anders
2005-06-27  9:03 ` Harald Welte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.