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:   09-Oct-2003 13:25:05
  Branch: HEAD                             Handle: 2003100912250500

  Modified files:
    openpkg-re              speclint.pl

  Log:
    teach speclint about canonical '%patch ... -P ... <n>' style commands

  Summary:
    Revision    Changes     Path
    1.53        +12 -0      openpkg-re/speclint.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-re/speclint.pl
  ============================================================================
  $ cvs diff -u -r1.52 -r1.53 speclint.pl
  --- openpkg-re/speclint.pl    2 Oct 2003 18:29:23 -0000       1.52
  +++ openpkg-re/speclint.pl    9 Oct 2003 11:25:05 -0000       1.53
  @@ -1055,6 +1055,18 @@
   
       #   parse %setup and %patch commands
       $done = ''; $this = ''; $todo = $spec;
  +    $todo =~ s/^(\s*\%patch)((?:\s+-\S+)*)((?:\s+\d+)+)\s*$/&expand_patch($1, $2, 
$3)/mge;
  +    sub expand_patch {
  +        my ($cmd, $opts, $nums) = @_;
  +        my $cmds = '';
  +        $cmds .= "${cmd}0${opts}\n" if ($opts !~ m|\s+-P|s);
  +        $opts =~ s|\s+-P||s;
  +        while ($nums =~ s|^\s+(\d+)||) {
  +            my $num = $1;
  +            $cmds .= "${cmd}${num}${opts}\n";
  +        }
  +        return $cmds;
  +    }
       while ($todo =~ m/^\s*\%(setup|patch)(\d+)?(\s+.*)?$/m) {
           $done .= $`; $this = $&; $todo = $';
           my ($type, $num, $opts) = ($1, $2, $3);
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to