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:   05-Apr-2003 22:02:29
  Branch: HEAD                             Handle: 2003040521022900

  Modified files:
    openpkg-re              speclint.pl

  Log:
    bugfix line tracking and add one more check

  Summary:
    Revision    Changes     Path
    1.8         +24 -3      openpkg-re/speclint.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-re/speclint.pl
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 speclint.pl
  --- openpkg-re/speclint.pl    5 Apr 2003 19:24:49 -0000       1.7
  +++ openpkg-re/speclint.pl    5 Apr 2003 20:02:29 -0000       1.8
  @@ -188,6 +188,7 @@
       while ($todo =~ m/\r\n/s) {
           $done .= $`; $this = $&; $todo = $';
           &lint_warning($file, $done, $this, "carriage-return (CR, 0x0d) line-feed 
(NL, 0x0a) combination (expected just line-feed)");
  +        $done .= $this;
       }
   
       #   check for multiple blank lines
  @@ -195,6 +196,7 @@
       while ($todo =~ m/(\r?\n[ \t]*){3,}/s) {
           $done .= $`; $this = $&; $todo = $';
           &lint_warning($file, $done, $this, "multiple subsequent blank lines 
(expected single blank line)");
  +        $done .= $this;
       }
   
       #   check for trailing whitespaces
  @@ -207,6 +209,7 @@
           else {
               &lint_warning($file, $done, $this, "trailing whitespace (expected 
none)"); 
           }
  +        $done .= $this;
       }
   
       #   check for bogus line continuations
  @@ -214,6 +217,7 @@
       while ($todo =~ m/\\[ \t]*\r?\n(?=[ \t]*\r?\n)/s) {
           $done .= $`; $this = $&; $todo = $';
           &lint_warning($file, $done, $this, "bogus line continuation for following 
empty line");
  +        $done .= $this;
       }
   
       #   check for leading whitespaces befor line continuations
  @@ -221,6 +225,7 @@
       while ($todo =~ m/[ \t]{2,}\\[ \t]*\r?\n/s) {
           $done .= $`; $this = $&; $todo = $';
           &lint_warning($file, $done, $this, "multiple leading whitespace before line 
continuation");
  +        $done .= $this;
       }
   }
   
  @@ -253,6 +258,7 @@
           if (length($pad) > 0 && length($text) == 0) {
               &lint_warning($file, $done, $this, "empty comment text (expected a 
reasonable text)");
           }
  +        $done .= $this;
       }
   }
   
  @@ -357,6 +363,7 @@
               }
           }
           push(@seen, $header);
  +        $done .= $this;
       }
   
       #   check for existence of mandatory headers
  @@ -431,6 +438,7 @@
           my $section = $1;
           next if ($section =~ m/^%(if|else|endif)/);
           $sections .= "$section,";
  +        $done .= $this;
       }
       my $regex = $require;
       $regex =~ s|\s+||sg;
  @@ -494,6 +502,7 @@
                               "directive \"$cmd\" (expected exactly 2 arguments)");
               }
           }
  +        $done .= $this;
       }
   
       #   check correct if/endif nesting
  @@ -512,6 +521,7 @@
               }
               pop(@stack);
           }
  +        $done .= $this;
       }
       my $line;
       while (defined($line = pop(@stack))) {
  @@ -529,11 +539,11 @@
       my ($file, $spec) = @_;
   
       my $done = ''; my $this = ''; my $todo = $spec;
  -    while ($todo =~ 
m/\n(%(?:description|prep|build|install|files|clean|pre|post|preun|postun))([^\n]*)\n(.*?\n)(?=%(?:description|prep|build|install|files|clean|pre|post|preun|postun)|$)/s)
 {
  +    while ($todo =~ 
m/(?<=\n)(%(?:description|prep|build|install|files|clean|pre|post|preun|postun))([^\n]*)\n(.*?\n)(?=%(?:description|prep|build|install|files|clean|pre|post|preun|postun)|$)/s)
 {
           $done .= $`; $this = $&; $todo = $';
           my ($section, $args, $script) = ($1, $2, $3);
   
  -        &check_script_common($file, $section, $args, $script);
  +        &check_script_common($file, $done, $this, $section, $args, $script);
   
           if ($section eq 'description') {
           }
  @@ -553,10 +563,21 @@
           }
           elsif ($section eq 'postun') {
           }
  +        $done .= $this;
       }
   }
   
   sub check_script_common {
  -    my ($file, $section, $args, $script) = @_;
  +    my ($file, $outer_done, $outer_this, $section, $args, $script) = @_;
  +
  +    #   shell style: redirections
  +    if ($section !~ m/^(description|files)$/) {
  +        my $done = $outer_done; my $this = ''; my $todo = $outer_this;
  +        while ($todo =~ m/[ \t]+[><][ \t]+\S+/s) {
  +            $done .= $`; $this = $&; $todo = $';
  +            &lint_warning($file, $done, $this, "whitespace after shell redirection 
(expected none)");
  +            $done .= $this;
  +        }
  +    }
   }
   
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to