Re: Mail about spectool accidentally deleted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nils,

There is a small bug in your script: when the script processes the
command line options it can generate a "get" command but when
the command is going to be executed the match against "getfiles" fails.

Patch attached.

Changelog:
* bug corection (see above)
* wget tries to preserve timestamp (option -N)
* variable $VERSION
* <pedantic>small changes to the code</pedantic>

Regards,
jpo
--
José Pedro Oliveira
* mailto: jpo@xxxxxxxxxxxx * http://gsd.di.uminho.pt/~jpo *
* gpg fingerprint = F9B6 8D87 859D 1C94 48F0 84C0 9749 9EB5 91BD 851B *
diff -ru spectool-1.0-orig/spectool spectool-1.0-modified/spectool
--- spectool-1.0-orig/spectool	Tue Mar  2 15:48:59 2004
+++ spectool-1.0-modified/spectool	Fri Mar  5 20:20:37 2004
@@ -24,6 +24,8 @@
 use FileHandle;
 use Getopt::Long;
 
+my $VERSION = '1.01';
+
 Getopt::Long::Configure ('no_ignore_case');
 
 my $dir = File::Temp::tempdir ( CLEANUP => 1 );
@@ -67,9 +69,7 @@
 		}
 	}
 
-	print $fh "\%description
-\%prep
-";
+	print $fh "\%description\n\%prep\n";
 
 	print $fh "cat << EOF_$filename\n";
 
@@ -139,8 +139,8 @@
 	my $url = $_[0];
 	if (retrievable ($url)) {
 		print "Getting $url\n" if ($verbose);
-		print "--> wget $url\n" if ($verbose > 1);
-		system ("wget $url") unless ($dummy);
+		print "--> wget -N $url\n" if ($verbose > 1);
+		system ("wget -N $url") unless ($dummy);
 	} else {
 		print STDERR "Couldn't fetch $url: missing URL\n" if ($verbose);
 	}
@@ -173,11 +173,11 @@
 GetOptions ('h|help' => sub { $command = 'help'; },
 			'd|define=s' => \@defines,
             'l|lf|list-files' => sub { $command = 'listfiles'; },
-			'g|gf|get-files' => sub { $command = 'get'; },
+			'g|gf|get-files' => sub { $command = 'getfiles'; },
 			'v|verbose' => sub { $verbose++; },
 			'D|dummy' => sub { $dummy = 1; });
 
-if ($#ARGV < 0) {
+unless (@ARGV) {
 	usage ();
 	exit ();
 }
@@ -187,9 +187,7 @@
 $specfile_fh->open ("< $specfile") or die ();
 
 my @what = @ARGV[1..$#ARGV];
-if ($#what < 0) {
-	@what = ('all');
-}
+@what = ('all') unless @what;
 
 eval_sources_patches ();
 foreach ($command) {

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux