OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 24-Mar-2003 16:04:02 Branch: HEAD Handle: 2003032415040100 Modified files: openpkg-re speclint.pl Log: bugfixes and distinguish result in return code Summary: Revision Changes Path 1.4 +12 -5 openpkg-re/speclint.pl ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-re/speclint.pl ============================================================================ $ cvs diff -u -r1.3 -r1.4 speclint.pl --- openpkg-re/speclint.pl 24 Mar 2003 14:56:05 -0000 1.3 +++ openpkg-re/speclint.pl 24 Mar 2003 15:04:01 -0000 1.4 @@ -115,17 +115,22 @@ } } +# global return code +$main::GRC = 0; + # iterate over all .spec files foreach my $filename (@ARGV) { my $io = new IO::File "<$filename" - || "unable to open file \"$filename\" for reading"; + or die "unable to open file \"$filename\" for reading"; my $spec; { local $/ = undef; $spec = <$io>; } $io->close; foreach my $check (@checks) { eval "\&check_$check(\$filename, \$spec);"; } } -exit(0); + +# die gracefully +exit($main::GRC); ## _________________________________________________________________ ## @@ -157,11 +162,13 @@ sub lint_warning { my ($file, $done, $this, $msg) = @_; &lint_message("WARNING", $file, $done, $this, $msg); + $main::GRC = 1 if ($main::GRC < 1); } sub lint_error { my ($file, $done, $this, $msg) = @_; &lint_message("ERROR", $file, $done, $this, $msg); + $main::GRC = 2 if ($main::GRC < 2); } ## _________________________________________________________________ @@ -323,8 +330,8 @@ $re_match =~ s|^\(|(?:|sg; $re_match =~ s|([^\\])\(|\1(?:|sg; if ($value !~ m|${re_match}|s) { - &lint_error($file, $done, $this, "RPM header \"$header\": " . - "invalid value \"$value\" (expected to match \"$re\""); + &lint_warning($file, $done, $this, "RPM header \"$header\": " . + "invalid value \"$value\" (expected to match \"$re\""); } } push(@seen, $header); @@ -340,7 +347,7 @@ next; } if (not grep(/^$name$/, @seen)) { - &lint_error($file, undef, undef, "mandatory RPM header \"$name\" not found"); + &lint_warning($file, undef, undef, "mandatory RPM header \"$name\" not found"); } } } @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]