OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 14-Jul-2003 17:13:04 Branch: HEAD Handle: 2003071416130400 Modified files: openpkg-re rclint.pl Log: add comment header and _enable check Summary: Revision Changes Path 1.10 +19 -2 openpkg-re/rclint.pl ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-re/rclint.pl ============================================================================ $ cvs diff -u -r1.9 -r1.10 rclint.pl --- openpkg-re/rclint.pl 10 Jul 2003 08:33:59 -0000 1.9 +++ openpkg-re/rclint.pl 14 Jul 2003 15:13:04 -0000 1.10 @@ -255,6 +255,12 @@ sub check_comment { my ($file, $spec) = @_; + my ($pkg); + + # determine package name + $pkg = $file; + $pkg =~ s|^.+/||; + $pkg =~ s|^rc\.||; # check "shebang" header my $re = ""; @@ -263,6 +269,12 @@ &lint_warning($file, "", "", "invalid shebang header (expected $re)"); } + # check comment header + $re .= "##\\n## rc.$pkg -- Run-Commands\\n##\\n\\n"; + if ($spec !~ m|^$re|os) { + &lint_warning($file, "", "", "invalid comment header (expected $re)"); + } + # check for comment indentation my $done .= $`; my $this = $&; my $todo = $'; while ($todo =~ m/^([ \t]*)(#+)([ \t]*)(.*?)$/m) { @@ -365,7 +377,7 @@ $pkgu =~ s|-|_|; # remove comment contents - $outer_this =~ s|^[ \t]*#[^\n]*||mg; + $outer_this =~ s|^[ \t]*#[^\n]*\n||mg; # check config if ($section =~ m/^%(config)$/) { @@ -374,7 +386,7 @@ $done = $outer_done; $this = ''; $todo = $outer_this; while ($todo =~ m/ [^=]+=[^\n]+/s) { $done .= $`; $this = $&; $todo = $'; - if ($this !~ m/ ([A-Z]+|$pkgu)[a-z_]+=/) { + if ($this !~ m/ ([A-Z]+|$pkgu)_[a-z_]+=/) { &lint_warning($file, $done, $this, "section $section: badly prefixed variable"); } $done .= $this; @@ -386,6 +398,11 @@ &lint_warning($file, $done, $this, "section $section: wrong default for ${pkgu}_enable"); } + # _enable, if used, must be the first variable + $done = $outer_done; $this = ''; $todo = $outer_this; + if ( $todo =~ m/ [^=]+_enable=[^\n]+/s and $todo !~ m/%config\n( [A-Z]+_[a-z_]+=[^\n]*\n)* [^=]+_enable=[^\n]+/s) { + &lint_warning($file, $done, $this, "section $section: ${pkgu}_enable must be the first lowercase variable"); + } return; } @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]