* genini: Default to not worrying if "message" and "ldesc" don't exist. Fix
authorChristopher Faylor <me@cgf.cx>
Fri, 12 Mar 2010 18:57:05 +0000 (18:57 +0000)
committerChristopher Faylor <me@cgf.cx>
Fri, 12 Mar 2010 18:57:05 +0000 (18:57 +0000)
$val test which could have done the wrong thing if $val was zero.
(get): For 'message', parse the passed in value rather than $_.  Return undef
on improperly formatted 'message' line.
(parse): Detect undef return from get and issue an error since it means that
the line wasn't parsed.

ChangeLog
genini

index 3d52853dd3c5475ff8f1a8ff2a08d95f2c485c4b..5c410f5055333996b9215cec73153ad8bcb5c1eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-12  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * genini: Default to not worrying if "message" and "ldesc" don't exist.
+       Fix $val test which could have done the wrong thing if $val was zero.
+       (get): For 'message', parse the passed in value rather than $_.  Return
+       undef on improperly formatted 'message' line.
+       (parse): Detect undef return from get and issue an error since it means
+       that the line wasn't parsed.
+
 2010-03-11  Charles Wilson  <cygwin@cwilson.fastmail.fm>
 
        * genini (parsedir): Support tarballs whose name ends in gz,
diff --git a/genini b/genini
index bf133c6c27d36bc5df52d24b2b6490a263645be0..c24f935c822b4907a8596082ec6647b2bbfc5090 100755 (executable)
--- a/genini
+++ b/genini
@@ -15,7 +15,7 @@ sub mywarn(@);
 sub myerror(@);
 sub usage();
 
-my @okmissing;
+my @okmissing = qw'message ldesc';
 my ($outfile, $help, $recursive);
 my @cmp_fmts = qw(gz bz2 lzma xz);
 
@@ -68,7 +68,7 @@ for my $p (sort keys %pkg) {
                      unless $main::categories{lc $c};
                }
            }
-           print "$key: ", $val, "\n" if $val;
+           print "$key: ", $val, "\n" if defined($val);
        }
     }
     for my $what ('', "[prev]\n", "[test]\n") {
@@ -87,7 +87,8 @@ sub get {
     my $val = shift;
 
     if ($keyhint eq 'message') {
-       my ($kw, $rest) = /^(\S+)\s+(.*)$/;
+       my ($kw, $rest) = $val =~ /^([^"'\s]+)\s+(.*)$/;
+       return undef unless defined($kw) && defined($rest);
        return $kw . ' ' . get($FH, 'ldesc', $rest);
     } elsif (substr($val, 0, 1) ne '"') {
        $val = '"'. $val . '"' if $keyhint eq 'ldesc' || $keyhint eq 'sdesc';
@@ -134,7 +135,8 @@ sub parse {
            my $key = $1;
            my $val = $2;
            if ($key !~ /^(?:prev|curr|test)/) {
-               $pkg{$pname}{$what}{$key} = get(\*F, $key, $val);
+               $val = get(\*F, $key, $val);
+               $pkg{$pname}{$what}{$key} = $val;
            } else {
                if ($key eq 'curr') {
                    $key = '';
@@ -143,7 +145,7 @@ sub parse {
                }
                $pkg{$pname}{$key}{'version'} = $val;
            }
-           next;
+           next if defined $val;
        };
        /^\[[^\]]+\]/ and do {
            $what = $_ . "\n";
This page took 0.069945 seconds and 5 git commands to generate.