[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-10-27 Thread Ralf S. Engelschall
  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:   27-Oct-2003 19:56:25
  Branch: HEAD Handle: 2003102718562500

  Modified files:
openpkg-re  rclint.pl

  Log:
allow rc.powerdns to pass, too

  Summary:
RevisionChanges Path
1.20+1  -1  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.19 -r1.20 rclint.pl
  --- openpkg-re/rclint.pl  30 Aug 2003 07:53:28 -  1.19
  +++ openpkg-re/rclint.pl  27 Oct 2003 18:56:25 -  1.20
  @@ -390,7 +390,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_][a-z0-9_]*=/) {
   &lint_warning($file, $done, $this, "section $section: badly 
prefixed variable");
   }
   $done .= $this;
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2004-01-20 Thread Ralf S. Engelschall
  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:   20-Jan-2004 17:53:02
  Branch: HEAD Handle: 2004012016530200

  Modified files:
openpkg-re  rclint.pl

  Log:
move info backwards

  Summary:
RevisionChanges Path
1.21+1  -1  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.20 -r1.21 rclint.pl
  --- openpkg-re/rclint.pl  27 Oct 2003 18:56:25 -  1.20
  +++ openpkg-re/rclint.pl  20 Jan 2004 16:53:02 -  1.21
  @@ -313,9 +313,9 @@
   
   my $require = qq{
   (%config,)?
  -(%info,)?
   (%common,)?
   (%status,)?
  +(%info,)?
   (%start,)?
   (%stop,)?
   (%restart,)?
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2004-03-11 Thread Michael Schloh
  OpenPKG CVS Repository
  http://cvs.openpkg.org/
  

  Server: cvs.openpkg.org  Name:   Michael Schloh
  Root:   /e/openpkg/cvs   Email:  [EMAIL PROTECTED]
  Module: openpkg-re   Date:   11-Mar-2004 16:55:36
  Branch: HEAD Handle: 2004031115553500

  Modified files:
openpkg-re  rclint.pl

  Log:
Respective sections should always contain a call to rcService for short
circuiting purposes, and the argument to rcService may contain dashes. In
fact, it should probably always be the package name itself.

  Summary:
RevisionChanges Path
1.22+3  -3  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.21 -r1.22 rclint.pl
  --- openpkg-re/rclint.pl  20 Jan 2004 16:53:02 -  1.21
  +++ openpkg-re/rclint.pl  11 Mar 2004 15:55:35 -  1.22
  @@ -33,7 +33,7 @@
   
   #   program information
   my $progname = "rclint";
  -my $progvers = "0.0.1";
  +my $progvers = "0.0.2";
   
   #   parameters (defaults)
   my $version  = 0;
  @@ -440,13 +440,13 @@
   #   check rcService short circuit
   if ($section !~ m/^%(config|common|info)$/) {
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nrcService \w+ enable yes \|\| exit 0\n/s ) {
  +if ( $todo !~ m/^[^\n]+\nrcService $pkg enable yes \|\| exit 0\n/s ) {
   &lint_warning($file, $done, $this, "section $section: \"rcService ... 
enable yes\" short circuit missing");
   }
   else {
   #   check rcService package reference
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/\brcService\s+$pkgu\s+/s ) {
  +if ( $todo !~ m/\brcService\s+$pkg\s+/s ) {
   &lint_warning($file, $done, $this, "section $section: rcService 
referencing wrong package");
   }
   }
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-07 Thread Thomas Lotterer
  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:   08-Jul-2003 00:11:25
  Branch: HEAD Handle: 2003070723112400

  Added files:
openpkg-re  rclint.pl

  Log:
first cut for a rc. file lint; code taken from speclint/rpmlint

  Summary:
RevisionChanges Path
1.1 +287 -0 openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r0 -r1.1 rclint.pl
  --- /dev/null 2003-07-08 00:11:25.0 +0200
  +++ rclint.pl 2003-07-08 00:11:25.0 +0200
  @@ -0,0 +1,287 @@
  +#!/bin/sh -- # -*- perl -*-
  +eval 'exec perl -S $0 ${1+"$@"}'
  +if $running_under_some_shell;
  +##
  +##  rclint -- OpenPKG rc. File Checker
  +##  Copyright (c) 2003 The OpenPKG Project 
  +##  Copyright (c) 2003 Ralf S. Engelschall <[EMAIL PROTECTED]>
  +##  Copyright (c) 2003 Cable & Wireless 
  +##
  +##  Permission to use, copy, modify, and distribute this software for
  +##  any purpose with or without fee is hereby granted, provided that
  +##  the above copyright notice and this permission notice appear in all
  +##  copies.
  +##
  +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +##  SUCH DAMAGE.
  +##
  +
  +require 5;
  +use Getopt::Long;
  +use IO;
  +use strict;
  +
  +#   program information
  +my $progname = "rclint";
  +my $progvers = "0.0.1";
  +
  +#   parameters (defaults)
  +my $version  = 0;
  +my $verbose  = 0;
  +my $help = 0;
  +my $check= 'all';
  +my $tmpdir   = ($ENV{TMPDIR} || $ENV{TEMPDIR} || "/tmp") . "/$progname";
  +my $rpm  = 'rpm';
  +my $rpm2cpio = 'rpm2cpio';
  +
  +#   exception handling support 
  +$SIG{__DIE__} = sub {
  +my ($err) = @_;
  +$err =~ s|\s+at\s+.*||s if (not $verbose);
  +print STDERR "$progname:ERROR: $err ". ($! ? "($!)" : "") . "\n";
  +exit(1);
  +};
  +
  +#   command line parsing
  +Getopt::Long::Configure("bundling");
  +my $result = GetOptions(
  +'V|version' => \$version,
  +'v|verbose' => \$verbose,
  +'h|help'=> \$help,
  +'c|check=s' => \$check,
  +'t|tmpdir=s'=> \$tmpdir,
  +'r|rpm=s'   => \$rpm,
  +) || die "option parsing failed";
  +if ($help) {
  +print "Usage: $progname [options] [RPMFILE ...]\n" .
  +  "Available options:\n" .
  +  " -v,--verbose   enable verbose run-time mode\n" .
  +  " -h,--help  print out this usage page\n" .
  +  " -c,--check=CHECKS  select checks to perform (default='all')\n" .
  +  " -r,--rpm=FILE  filesystem path to RPM program\n" .
  +  " -t,--tmpdir=PATH   filesystem path to temporary directory\n" .
  +  " -V,--version   print program version\n" .
  +exit(0);
  +}
  +if ($version) {
  +print "OpenPKG $progname $progvers\n";
  +exit(0);
  +}
  +
  +#   verbose message printing
  +sub msg_verbose {
  +my ($msg) = @_;
  +print STDERR "$msg\n" if ($verbose);
  +}
  +
  +#   warning message printing
  +sub msg_warning {
  +my ($msg) = @_;
  +print STDERR "$progname:WARNING: $msg\n";
  +}
  +
  +#   error message printing
  +sub msg_error {
  +my ($msg) = @_;
  +print STDERR "$progname:ERROR: $msg\n";
  +}
  +
  +#   determine check list
  +my @check_list = (qw(
  +blank
  +comment
  +));
  +my @checks = ();
  +if ($check eq 'all') {
  +@checks = @check_list;
  +}
  +else {
  +foreach my $c (split(/,/, $check)) {
  +if (not grep(/^$c$/, @check_list)) {
  +die "invalid check \"$c\"";
  +}
  +push(@checks, $c);
  +}
  +}
  +
  +#   global return code
  +$main::GRC = 0;
  +
  +#   environment preparation
  +system("rm -rf $tmpdir");
  +system("mkdir -p $tmpdir");
  +
  +#   iterate over all rc. 

[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-08 Thread Thomas Lotterer
  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:   08-Jul-2003 21:44:31
  Branch: HEAD Handle: 2003070820443000

  Modified files:
openpkg-re  rclint.pl

  Log:
add command section order check

  Summary:
RevisionChanges Path
1.2 +43 -0  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.1 -r1.2 rclint.pl
  --- openpkg-re/rclint.pl  7 Jul 2003 22:11:24 -   1.1
  +++ openpkg-re/rclint.pl  8 Jul 2003 19:44:30 -   1.2
  @@ -100,6 +100,7 @@
   my @check_list = (qw(
   blank
   comment
  +section
   ));
   my @checks = ();
   if ($check eq 'all') {
  @@ -282,6 +283,48 @@
   &lint_warning($file, $done, $this, "empty comment text (expected a 
reasonable text)");
   }
   $done .= $this;
  +}
  +}
  +
  +##  _
  +##
  +##  CHECK "section": run command sections
  +##  _
  +##
  +
  +sub check_section {
  +my ($file, $spec) = @_;
  +
  +my $require = qq{
  +(%config,)?
  +(%info,)?
  +(%common,)?
  +(%status,)?
  +(%start,)?
  +(%stop,)?
  +(%restart,)?
  +(%reload,)?
  +(%quarterly,)?
  +(%hourly,)?
  +(%daily,)?
  +(%weekly,)?
  +(%env,)?
  +};
  +
  +#   check for order of headers
  +my $sections = "";
  +my $done = ''; my $this = ''; my $todo = $spec;
  +while ($todo =~ m/^(\S+:|%\S+).*$/m) {
  +$done .= $`; $this = $&; $todo = $';
  +my $section = $1;
  +$sections .= "$section,";
  +$done .= $this;
  +}
  +my $regex = $require;
  +$regex =~ s|\s+||sg;
  +if ($sections !~ m/^$regex$/s) {
  +$regex =~ s|,| |sg;
  +&lint_error($file, undef, undef, "invalid run command section order 
(expected \"$regex\")"); 
   }
   }
   
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-08 Thread Thomas Lotterer
  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:   08-Jul-2003 22:06:13
  Branch: HEAD Handle: 2003070821061200

  Modified files:
openpkg-re  rclint.pl

  Log:
add command section script with whitespace after shell redirection
check

  Summary:
RevisionChanges Path
1.3 +41 -0  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.2 -r1.3 rclint.pl
  --- openpkg-re/rclint.pl  8 Jul 2003 19:44:30 -   1.2
  +++ openpkg-re/rclint.pl  8 Jul 2003 20:06:12 -   1.3
  @@ -101,6 +101,7 @@
   blank
   comment
   section
  +script
   ));
   my @checks = ();
   if ($check eq 'all') {
  @@ -325,6 +326,46 @@
   if ($sections !~ m/^$regex$/s) {
   $regex =~ s|,| |sg;
   &lint_error($file, undef, undef, "invalid run command section order 
(expected \"$regex\")"); 
  +}
  +}
  +
  +##  _
  +##
  +##  CHECK "script": shell scripts
  +##  _
  +##
  +
  +sub check_script {
  +my ($file, $spec) = @_;
  +
  +my $done = ''; my $this = ''; my $todo = $spec;
  +while ($todo =~ 
m/(\%(?:config|info|common|status|start|stop|restart|reload|quarterly|hourly|daily|weekly|env))([^\n]*)\n(.*?\n)(?=\%(?:config|info|common|status|start|stop|restart|reload|quarterly|hourly|daily|weekly|env)|$)/s)
 {
  +$done .= $`; $this = $&; $todo = $';
  +my ($section, $args, $script) = ($1, $2, $3);
  +
  +#   perform checks for a single script section
  +&check_script_section($file, $done, $this, $section, $args, $script);
  +
  +$done .= $this;
  +}
  +}
  +
  +sub check_script_section {
  +my ($file, $outer_done, $outer_this, $section, $args, $script) = @_;
  +
  +#   skip
  +return if ($section =~ m/^%(config|info|common|env)$/);
  +
  +#   remove comment contents
  +$outer_this =~ s|^[ \t]*#[^\n]*||mg;
  +
  +#   check shell redirections
  +my $done = $outer_done; my $this = ''; my $todo = $outer_this;
  +while (   $todo =~ m/[ \t]+(\d+)?[><][ \t]+\S+/s
  +   or $todo =~ m/[ \t]+[><](\&\d+)?[ \t]+\S+/s) {
  +$done .= $`; $this = $&; $todo = $';
  +&lint_warning($file, $done, $this, "section $section: whitespace after 
shell redirection (expected none)");
  +$done .= $this;
   }
   }
   
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-09 Thread Thomas Lotterer
  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:   09-Jul-2003 16:06:01
  Branch: HEAD Handle: 200307091506

  Modified files:
openpkg-re  rclint.pl

  Log:
rclint new checks: badly prefixed variable, opServiceEnabled, exit not
allowed here

  Summary:
RevisionChanges Path
1.4 +82 -3  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.3 -r1.4 rclint.pl
  --- openpkg-re/rclint.pl  8 Jul 2003 20:06:12 -   1.3
  +++ openpkg-re/rclint.pl  9 Jul 2003 14:06:00 -   1.4
  @@ -352,15 +352,94 @@
   
   sub check_script_section {
   my ($file, $outer_done, $outer_this, $section, $args, $script) = @_;
  +my ($done, $this, $todo);
  +my ($pkg, $pkgu);
   
  -#   skip
  -return if ($section =~ m/^%(config|info|common|env)$/);
  +#   determine package name
  +$pkg = $file;
  +$pkg =~ s|^.+/||;
  +$pkg =~ s|^rc\.||;
  +
  +#   determine package name, dash becomes underscore
  +$pkgu = $pkg;
  +$pkgu =~ s|-|_|;
   
   #   remove comment contents
   $outer_this =~ s|^[ \t]*#[^\n]*||mg;
   
  +#   check config
  +if ($section =~ m/^%(config)$/) {
  +
  +#   check for badly prefixed variables
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +while ($todo =~ m/[^=]+=[^\n]+/s) {
  +$done .= $`; $this = $&; $todo = $';
  +if ($this !~ m/($pkgu|mta|pop|jre|jdk|java)[a-z_]+=/) { #FIXME 
replace mta|pop|j... with upper case in rc/spec !?
  +&lint_warning($file, $done, $this, "section $section: badly 
prefixed variable");
  +}
  +$done .= $this;
  +}
  +
  +return;
  +}
  +
  +#   check env
  +if ($section =~ m/^%(env)$/) {
  +
  +if ($pkg !~ m/^openpkg$/) { #FIXME really special !?
  +
  +#   check opServiceEnabled short circuit
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo =~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: 
opServiceEnabled short circuit not allowed here");
  +}
  +
  +#   check required if ... opServiceEnabled construct
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/^[^\n]+\nif opServiceEnabled \w+; then\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: required if 
... opServiceEnabled construct missing");
  +}
  +else {
  +#   check required if ... opServiceEnabled package reference
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/^[^\n]+\nif opServiceEnabled $pkgu; then\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: if ... 
opServiceEnabled referencing wrong package");
  +}
  +}
  +}
  +
  +#   exit not allowed here; lousy test ...
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo =~ m/exit/s ) {
  +&lint_warning($file, $done, $this, "section $section: exit not allowed 
here");
  +}
  +return;
  +}
  +
  +#   skip
  +return if ($section =~ m/^%(info|common)$/);
  +
  +#   check obsolete if ... opServiceEnabled construct
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo =~ m/^[^\n]+\n\s+if\s+opServiceEnabled\s+.+then/s ) {
  +&lint_warning($file, $done, $this, "section $section: obsolete if ... 
opServiceEnabled construct found");
  +}
  +
  +#   check opServiceEnabled short circuit
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: opServiceEnabled 
short circuit missing");
  +}
  +else {
  +#   check opServiceEnabled package reference
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/\sopServiceEnabled\s$pkgu\s+/s ) {
  +&lint_warning($file, $done, $this, "section $section: opServiceEnabled 
referencing wrong package");
  +}
  +}
  +
   #   check shell redirections
  -my $done = $outer_done; my $this = ''; my $todo = $outer_this;
  +$done = $outer_

[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-09 Thread Thomas Lotterer
  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:   09-Jul-2003 16:59:50
  Branch: HEAD Handle: 2003070915595000

  Modified files:
openpkg-re  rclint.pl

  Log:
enable variables for virtual (upper case) packages; remove mta special
case

  Summary:
RevisionChanges Path
1.5 +1  -1  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.4 -r1.5 rclint.pl
  --- openpkg-re/rclint.pl  9 Jul 2003 14:06:00 -   1.4
  +++ openpkg-re/rclint.pl  9 Jul 2003 14:59:50 -   1.5
  @@ -374,7 +374,7 @@
   $done = $outer_done; $this = ''; $todo = $outer_this;
   while ($todo =~ m/[^=]+=[^\n]+/s) {
   $done .= $`; $this = $&; $todo = $';
  -if ($this !~ m/($pkgu|mta|pop|jre|jdk|java)[a-z_]+=/) { #FIXME 
replace mta|pop|j... with upper case in rc/spec !?
  +if ($this !~ m/([A-Z]+|$pkgu|pop|jre|jdk|java)[a-z_]+=/) { #FIXME 
remove special cases from rc/spec
   &lint_warning($file, $done, $this, "section $section: badly 
prefixed variable");
   }
   $done .= $this;
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-09 Thread Thomas Lotterer
  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:   09-Jul-2003 17:10:09
  Branch: HEAD Handle: 2003070916100900

  Modified files:
openpkg-re  rclint.pl

  Log:
remove pop special case

  Summary:
RevisionChanges Path
1.6 +1  -1  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.5 -r1.6 rclint.pl
  --- openpkg-re/rclint.pl  9 Jul 2003 14:59:50 -   1.5
  +++ openpkg-re/rclint.pl  9 Jul 2003 15:10:09 -   1.6
  @@ -374,7 +374,7 @@
   $done = $outer_done; $this = ''; $todo = $outer_this;
   while ($todo =~ m/[^=]+=[^\n]+/s) {
   $done .= $`; $this = $&; $todo = $';
  -if ($this !~ m/([A-Z]+|$pkgu|pop|jre|jdk|java)[a-z_]+=/) { #FIXME 
remove special cases from rc/spec
  +if ($this !~ m/([A-Z]+|$pkgu|jre|jdk|java)[a-z_]+=/) { #FIXME 
remove special cases from rc/spec
   &lint_warning($file, $done, $this, "section $section: badly 
prefixed variable");
   }
   $done .= $this;
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-09 Thread Thomas Lotterer
  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:   09-Jul-2003 21:23:34
  Branch: HEAD Handle: 2003070920233400

  Modified files:
openpkg-re  rclint.pl

  Log:
remove jre|jdk|java special case

  Summary:
RevisionChanges Path
1.7 +1  -1  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.6 -r1.7 rclint.pl
  --- openpkg-re/rclint.pl  9 Jul 2003 15:10:09 -   1.6
  +++ openpkg-re/rclint.pl  9 Jul 2003 19:23:34 -   1.7
  @@ -374,7 +374,7 @@
   $done = $outer_done; $this = ''; $todo = $outer_this;
   while ($todo =~ m/[^=]+=[^\n]+/s) {
   $done .= $`; $this = $&; $todo = $';
  -if ($this !~ m/([A-Z]+|$pkgu|jre|jdk|java)[a-z_]+=/) { #FIXME 
remove special cases from rc/spec
  +if ($this !~ m/([A-Z]+|$pkgu)[a-z_]+=/) {
   &lint_warning($file, $done, $this, "section $section: badly 
prefixed variable");
   }
   $done .= $this;
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-10 Thread Thomas Lotterer
  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:   10-Jul-2003 10:03:07
  Branch: HEAD Handle: 2003071009030600

  Modified files:
openpkg-re  rclint.pl

  Log:
enforce _enable to default to openpkg_rc_def

  Summary:
RevisionChanges Path
1.8 +6  -0  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.7 -r1.8 rclint.pl
  --- openpkg-re/rclint.pl  9 Jul 2003 19:23:34 -   1.7
  +++ openpkg-re/rclint.pl  10 Jul 2003 08:03:06 -  1.8
  @@ -380,6 +380,12 @@
   $done .= $this;
   }
   
  +#   enforce _enable to default to openpkg_rc_def
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo =~ m/[^=]+_enable=[^\n]+/s and $todo !~ m/
[^=]+_enable="\$openpkg_rc_def"\n+/s) {
  +&lint_warning($file, $done, $this, "section $section: wrong default for 
${pkgu}_enable");
  +}
  +
   return;
   }
   
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-10 Thread Thomas Lotterer
  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:   10-Jul-2003 10:33:59
  Branch: HEAD Handle: 2003071009335900

  Modified files:
openpkg-re  rclint.pl

  Log:
%env is not special in bootstrap

  Summary:
RevisionChanges Path
1.9 +14 -17 openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.8 -r1.9 rclint.pl
  --- openpkg-re/rclint.pl  10 Jul 2003 08:03:06 -  1.8
  +++ openpkg-re/rclint.pl  10 Jul 2003 08:33:59 -  1.9
  @@ -392,25 +392,22 @@
   #   check env
   if ($section =~ m/^%(env)$/) {
   
  -if ($pkg !~ m/^openpkg$/) { #FIXME really special !?
  +#   check opServiceEnabled short circuit
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo =~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: opServiceEnabled 
short circuit not allowed here");
  +}
   
  -#   check opServiceEnabled short circuit
  +#   check required if ... opServiceEnabled construct
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/^[^\n]+\nif opServiceEnabled \w+; then\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: required if ... 
opServiceEnabled construct missing");
  +}
  +else {
  +#   check required if ... opServiceEnabled package reference
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo =~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: 
opServiceEnabled short circuit not allowed here");
  -}
  -
  -#   check required if ... opServiceEnabled construct
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nif opServiceEnabled \w+; then\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: required if 
... opServiceEnabled construct missing");
  -}
  -else {
  -#   check required if ... opServiceEnabled package reference
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nif opServiceEnabled $pkgu; then\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: if ... 
opServiceEnabled referencing wrong package");
  -}
  +if ( $todo !~ m/^[^\n]+\nif opServiceEnabled $pkgu; then\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: if ... 
opServiceEnabled referencing wrong package");
   }
   }
   
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-14 Thread Thomas Lotterer
  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:
RevisionChanges 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 -  1.9
  +++ openpkg-re/rclint.pl  14 Jul 2003 15:13:04 -  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 Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-15 Thread Thomas Lotterer
  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:   15-Jul-2003 10:42:23
  Branch: HEAD Handle: 2003071509422200

  Modified files:
openpkg-re  rclint.pl

  Log:
handle openpkg package _rc_def and _rc_all before _enable

  Summary:
RevisionChanges Path
1.11+13 -4  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.10 -r1.11 rclint.pl
  --- openpkg-re/rclint.pl  14 Jul 2003 15:13:04 -  1.10
  +++ openpkg-re/rclint.pl  15 Jul 2003 08:42:22 -  1.11
  @@ -398,10 +398,19 @@
   &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");
  +if ($pkg eq "openpkg") {
  +#   openpkg_rc before _enable, if used, must be the first variable
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/%config\n([A-Z]+_[a-z_]+=[^\n]*\n)*
openpkg_rc_def=[^\n]+?\nopenpkg_rc_all=[^\n]+?\n[^=]+_enable=[^\n]+/s) {
  +&lint_warning($file, $done, $this, "section $section: 
openpkg_rc_def, openpkg_rc_all and ${pkgu}_enable must be the first lowercase 
variable");
  +}
  +}
  +else {
  +#   _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 Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-17 Thread Thomas Lotterer
  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:   17-Jul-2003 11:48:43
  Branch: HEAD Handle: 2003071710484200

  Modified files:
openpkg-re  rclint.pl

  Log:
temporary disable opServiceEnabled check

  Summary:
RevisionChanges Path
1.12+4  -0  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.11 -r1.12 rclint.pl
  --- openpkg-re/rclint.pl  15 Jul 2003 08:42:22 -  1.11
  +++ openpkg-re/rclint.pl  17 Jul 2003 09:48:42 -  1.12
  @@ -418,6 +418,7 @@
   #   check env
   if ($section =~ m/^%(env)$/) {
   
  +if (0) { #FIXME temporary disabled while migrating from opServiceEnabled to 
opService enable
   #   check opServiceEnabled short circuit
   $done = $outer_done; $this = ''; $todo = $outer_this;
   if ( $todo =~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  @@ -436,6 +437,7 @@
   &lint_warning($file, $done, $this, "section $section: if ... 
opServiceEnabled referencing wrong package");
   }
   }
  +}
   
   #   exit not allowed here; lousy test ...
   $done = $outer_done; $this = ''; $todo = $outer_this;
  @@ -448,6 +450,7 @@
   #   skip
   return if ($section =~ m/^%(info|common)$/);
   
  +if (0) { #FIXME temporary disabled while migrating from opServiceEnabled to 
opService enable
   #   check obsolete if ... opServiceEnabled construct
   $done = $outer_done; $this = ''; $todo = $outer_this;
   if ( $todo =~ m/^[^\n]+\n\s+if\s+opServiceEnabled\s+.+then/s ) {
  @@ -465,6 +468,7 @@
   if ( $todo !~ m/\sopServiceEnabled\s$pkgu\s+/s ) {
   &lint_warning($file, $done, $this, "section $section: opServiceEnabled 
referencing wrong package");
   }
  +}
   }
   
   #   check shell redirections
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-17 Thread Thomas Lotterer
  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:   17-Jul-2003 23:38:43
  Branch: HEAD Handle: 2003071722384300

  Modified files:
openpkg-re  rclint.pl

  Log:
migrate opServiceEnabled to "opService ... enable yes"; deny use of
return/exit in %config, %info, %common and %status

  Summary:
RevisionChanges Path
1.13+34 -49 openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.12 -r1.13 rclint.pl
  --- openpkg-re/rclint.pl  17 Jul 2003 09:48:42 -  1.12
  +++ openpkg-re/rclint.pl  17 Jul 2003 21:38:43 -  1.13
  @@ -102,6 +102,7 @@
   comment
   section
   script
  +global
   ));
   my @checks = ();
   if ($check eq 'all') {
  @@ -130,6 +131,7 @@
   my $spec; { local $/ = undef; $spec = <$io>; }
   $io->close;
   foreach my $check (@checks) {
  +&msg_verbose("$check in $filename");
   eval "\&check_$check(\$filename, \$spec);";
   }
   }
  @@ -264,14 +266,15 @@
   
   #   check "shebang" header
   my $re = "";
  -$re .= '[EMAIL PROTECTED]@/lib/openpkg/bash @l_prefix@/etc/rc\\n';
  -if ($spec !~ m|^$re|os) {
  +$re .= "[EMAIL PROTECTED]@/lib/openpkg/bash [EMAIL PROTECTED]@/etc/rc\\n";
  +if ($spec !~ m|^$re|s) {
   &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) {
  +my $re = "";
  +$re .= ".*?\\n##\\n##  rc.$pkg -- Run-Commands\\n##\\n\\n";
  +if ($spec !~ m|^$re|s) {
   &lint_warning($file, "", "", "invalid comment header (expected $re)");
   }
   
  @@ -412,64 +415,29 @@
   &lint_warning($file, $done, $this, "section $section: 
${pkgu}_enable must be the first lowercase variable");
   }
   }
  -return;
   }
   
  -#   check env
  -if ($section =~ m/^%(env)$/) {
  -
  -if (0) { #FIXME temporary disabled while migrating from opServiceEnabled to 
opService enable
  -#   check opServiceEnabled short circuit
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo =~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: opServiceEnabled 
short circuit not allowed here");
  -}
  -
  -#   check required if ... opServiceEnabled construct
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nif opServiceEnabled \w+; then\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: required if ... 
opServiceEnabled construct missing");
  -}
  -else {
  -#   check required if ... opServiceEnabled package reference
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nif opServiceEnabled $pkgu; then\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: if ... 
opServiceEnabled referencing wrong package");
  -}
  -}
  -}
  -
  -#   exit not allowed here; lousy test ...
  +if ($section =~ m/^%(config|info|common|status)$/) {
  +#   check illegal use of return/exit
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo =~ m/exit/s ) {
  -&lint_warning($file, $done, $this, "section $section: exit not allowed 
here");
  +if ( $todo =~ m/[^a-zA-Z0-9_](return|exit)\s/s ) {
  +&lint_warning($file, $done, $this, "section $section: return or exit 
not allowed here");
   }
   return;
   }
   
  -#   skip
  -return if ($section =~ m/^%(info|common)$/);
  -
  -if (0) { #FIXME temporary disabled while migrating from opServiceEnabled to 
opService enable
  -#   check obsolete if ... opServiceEnabled construct
  +#   check opService short circuit
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo =~ m/^[^\n]+\n\s+if\s+opServiceEnabled\s+.+then/s ) {
  -&lint_warning($file, $done, $this, "section $section: obsolete if ... 
opServiceEnabled construct found");
  -}
  -
  -#   check opServiceEnabled short circuit
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nopServiceEnabled \w+ \|\| exit 0\n/s ) {
  -&lint_wa

[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-20 Thread Thomas Lotterer
  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:   20-Jul-2003 22:38:09
  Branch: HEAD Handle: 2003072021380800

  Modified files:
openpkg-re  rclint.pl

  Log:
correctly lint op replacment with rc (PR#207)

  Summary:
RevisionChanges Path
1.14+7  -7  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.13 -r1.14 rclint.pl
  --- openpkg-re/rclint.pl  17 Jul 2003 21:38:43 -  1.13
  +++ openpkg-re/rclint.pl  20 Jul 2003 20:38:08 -  1.14
  @@ -426,16 +426,16 @@
   return;
   }
   
  -#   check opService short circuit
  +#   check rcService short circuit
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nopService \w+ enable yes \|\| exit 0\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: \"opService ... 
enable yes\" short circuit missing");
  +if ( $todo !~ m/^[^\n]+\nrcService \w+ enable yes \|\| exit 0\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: \"rcService ... 
enable yes\" short circuit missing");
   }
   else {
  -#   check opService package reference
  +#   check rcService package reference
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/\bopService\s+$pkgu\s+/s ) {
  -&lint_warning($file, $done, $this, "section $section: opService 
referencing wrong package");
  +if ( $todo !~ m/\brcService\s+$pkgu\s+/s ) {
  +&lint_warning($file, $done, $this, "section $section: rcService 
referencing wrong package");
   }
   }
   
  @@ -462,7 +462,7 @@
   my $done = ''; my $this = ''; my $todo = $spec;
   while ($todo =~ m/\bopServiceEnabled\b/s) {
   $done .= $`; $this = $&; $todo = $';
  -&lint_warning($file, $done, $this, "deprecated usage of opServiceEnabled 
macro (expected opService ... enable yes)");
  +&lint_warning($file, $done, $this, "deprecated usage of opServiceEnabled 
macro (expected rcService ... enable yes)");
   $done .= $this;
   }
   }
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-08-07 Thread Thomas Lotterer
  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:   07-Aug-2003 13:21:34
  Branch: HEAD Handle: 2003080712213400

  Modified files:
openpkg-re  rclint.pl

  Log:
we have monthly, too

  Summary:
RevisionChanges Path
1.17+1  -0  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.16 -r1.17 rclint.pl
  --- openpkg-re/rclint.pl  7 Aug 2003 08:51:09 -   1.16
  +++ openpkg-re/rclint.pl  7 Aug 2003 11:21:34 -   1.17
  @@ -324,6 +324,7 @@
   (%hourly,)?
   (%daily,)?
   (%weekly,)?
  +(%monthly,)?
   (%env,)?
   };
   
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-08-14 Thread Thomas Lotterer
  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:   07-Aug-2003 10:51:10
  Branch: HEAD Handle: 2003080709510900

  Modified files:
openpkg-re  rclint.pl

  Log:
use rcService for checking enable, usable and active only; see PR#232

  Summary:
RevisionChanges Path
1.16+10 -0  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.15 -r1.16 rclint.pl
  --- openpkg-re/rclint.pl  21 Jul 2003 08:47:22 -  1.15
  +++ openpkg-re/rclint.pl  7 Aug 2003 08:51:09 -   1.16
  @@ -426,6 +426,16 @@
   return;
   }
   
  +#   check rcService only used for enable|usable|active PR#232
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +while ( $todo =~ m/rcService\s+\w+\s+(\w+)/s )  {
  +$done .= $`; $this = $&; $todo = $';
  +if ( $1 !~ m/^(enable|usable|active)$/ ) {
  +&lint_warning($file, $done, $this, "section $section: rcService must 
check for (enable|usable|active) only, found check for \"$1\"");
  +}
  +$done .= $this;
  +}
  +
   #   check rcService short circuit
   $done = $outer_done; $this = ''; $todo = $outer_this;
   if ( $todo !~ m/^[^\n]+\nrcService \w+ enable yes \|\| exit 0\n/s ) {
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-08-28 Thread Ralf S. Engelschall
  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:   28-Aug-2003 15:54:37
  Branch: HEAD Handle: 2003082814543700

  Modified files:
openpkg-re  rclint.pl

  Log:
in %common there can be arbitrary code including return and exit, of
cours

  Summary:
RevisionChanges Path
1.18+1  -1  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.17 -r1.18 rclint.pl
  --- openpkg-re/rclint.pl  7 Aug 2003 11:21:34 -   1.17
  +++ openpkg-re/rclint.pl  28 Aug 2003 13:54:37 -  1.18
  @@ -418,7 +418,7 @@
   }
   }
   
  -if ($section =~ m/^%(config|info|common|status)$/) {
  +if ($section =~ m/^%(config|info|status)$/) {
   #   check illegal use of return/exit
   $done = $outer_done; $this = ''; $todo = $outer_this;
   if ( $todo =~ m/[^a-zA-Z0-9_](return|exit)\s/s ) {
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl

2003-08-30 Thread Ralf S. Engelschall
  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:   30-Aug-2003 09:53:29
  Branch: HEAD Handle: 2003083008532800

  Modified files:
openpkg-re  rclint.pl

  Log:
I don't think %config, %common and %info should have rcService
short-circuiting checks for enabling

  Summary:
RevisionChanges Path
1.19+10 -8  openpkg-re/rclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.18 -r1.19 rclint.pl
  --- openpkg-re/rclint.pl  28 Aug 2003 13:54:37 -  1.18
  +++ openpkg-re/rclint.pl  30 Aug 2003 07:53:28 -  1.19
  @@ -438,15 +438,17 @@
   }
   
   #   check rcService short circuit
  -$done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/^[^\n]+\nrcService \w+ enable yes \|\| exit 0\n/s ) {
  -&lint_warning($file, $done, $this, "section $section: \"rcService ... 
enable yes\" short circuit missing");
  -}
  -else {
  -#   check rcService package reference
  +if ($section !~ m/^%(config|common|info)$/) {
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -if ( $todo !~ m/\brcService\s+$pkgu\s+/s ) {
  -&lint_warning($file, $done, $this, "section $section: rcService 
referencing wrong package");
  +if ( $todo !~ m/^[^\n]+\nrcService \w+ enable yes \|\| exit 0\n/s ) {
  +&lint_warning($file, $done, $this, "section $section: \"rcService ... 
enable yes\" short circuit missing");
  +}
  +else {
  +#   check rcService package reference
  +$done = $outer_done; $this = ''; $todo = $outer_this;
  +if ( $todo !~ m/\brcService\s+$pkgu\s+/s ) {
  +&lint_warning($file, $done, $this, "section $section: rcService 
referencing wrong package");
  +}
   }
   }
   
  @@ .
__
The OpenPKG Projectwww.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]


Re: [CVS] OpenPKG: openpkg-re/ rclint.pl

2003-07-07 Thread Ralf S. Engelschall
On Tue, Jul 08, 2003, Thomas Lotterer wrote:

> [...]
> first cut for a rc. file lint; code taken from speclint/rpmlint
> [...]

Cool... thanks!
   Ralf S. Engelschall
   [EMAIL PROTECTED]
   www.engelschall.com

__
The OpenPKG Projectwww.openpkg.org
Developer Communication List   [EMAIL PROTECTED]


[CVS] OpenPKG: openpkg-re/ rclint.pl speclint.pl

2003-07-21 Thread Thomas Lotterer
  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:   21-Jul-2003 10:47:22
  Branch: HEAD Handle: 2003072109472200

  Modified files:
openpkg-re  rclint.pl speclint.pl

  Log:
PR#210: shtool options space before argument linting

  Summary:
RevisionChanges Path
1.15+31 -0  openpkg-re/rclint.pl
1.37+25 -3  openpkg-re/speclint.pl
  

  patch -p0 <<'@@ .'
  Index: openpkg-re/rclint.pl
  
  $ cvs diff -u -r1.14 -r1.15 rclint.pl
  --- openpkg-re/rclint.pl  20 Jul 2003 20:38:08 -  1.14
  +++ openpkg-re/rclint.pl  21 Jul 2003 08:47:22 -  1.15
  @@ -458,11 +458,42 @@
   sub check_global {
   my ($file, $spec) = @_;
   
  +#   utility function: extract a single shell command
  +sub command_extract {
  +my ($script) = @_;
  +my $cmd = '';
  +while ($script ne '') {
  +$script =~ s/^([ \t]*'[^']*')/ $cmd .= $1, ''/se && next;
  +$script =~ s/^([ \t]*"[^"]*")/ $cmd .= $1, ''/se && next;
  +$script =~ s/^([ \t]*[^ \t;\)\\\r\n]+)/$cmd .= $1, ''/se && next;
  +$script =~ s/^([ \t]*\\[ \t]*\r?\n)/   $cmd .= $1, ''/se && next;
  +last;
  +}
  +return ($cmd, $script);
  +}
  +
   #   check for deprecated use of opServiceEnabled function
   my $done = ''; my $this = ''; my $todo = $spec;
   while ($todo =~ m/\bopServiceEnabled\b/s) {
   $done .= $`; $this = $&; $todo = $';
   &lint_warning($file, $done, $this, "deprecated usage of opServiceEnabled 
macro (expected rcService ... enable yes)");
  +$done .= $this;
  +}
  +
  +my $done = ''; my $this = ''; my $todo = $spec;
  +while ($todo =~ m/shtool\s+/s) {
  +$done .= $`; $this = $&; $todo = $';
  +($this, $todo) = &command_extract($this . $todo);
  +
  +#   check for shtool options with no space before argument
  +my $subthis = $this;
  +$subthis =~ s/%{[^}]*?}//sg;
  +$subthis =~ s/'[^']*'//sg;
  +$subthis =~ s/"[^"]*"//sg;
  +$subthis =~ s/[;|&].*$//s; # catch command termination by semicolon, pipe, 
or, and;
  +if ($subthis =~ m/\s-[a-zA-Z]\S/) {
  +&lint_warning($file, $done, $this, "found use of shtool option with 
space omitted before argument");
  +}
   $done .= $this;
   }
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-re/speclint.pl
  
  $ cvs diff -u -r1.36 -r1.37 speclint.pl
  --- openpkg-re/speclint.pl19 Jul 2003 09:58:34 -  1.36
  +++ openpkg-re/speclint.pl21 Jul 2003 08:47:22 -  1.37
  @@ -667,10 +667,32 @@
   
   #   check filesystem path style
   $done = $outer_done; $this = ''; $todo = $outer_this;
  -while ($todo =~ m/\%\{l_shtool\}\s+(mkdir|install)\s+/s) {
  +while ($todo =~ m/\%\{l_shtool\}\s+(\w+)\s+/s) {
   $done .= $`; $this = $&; $todo = $';
   ($this, $todo) = &command_extract($this . $todo);
   
  +#   check for shtool options with no space before argument
  +my $subthis = $this;
  +$subthis =~ s/%{[^}]*?}//sg;
  +#   remove content of quoted arguments as they might contain unrelated 
things to catch
  +$subthis =~ s/'[^']*'/ARG/sg;
  +$subthis =~ s/"[^"]*"/ARG/sg;
  +$subthis =~ s/`[^`]*`/ARG/sg;
  +#   remove us completely if line ends with a quote as this indicates we are 
a quoted argument to ourselfs
  +$subthis =~ s/[^']*'$//s;
  +$subthis =~ s/[^"]*"$//s;
  +$subthis =~ s/[^`]*`$//s;
  +$subthis =~ s/[^']*' \\\n//s;
  +$subthis =~ s/[^"]*" \\\n//s;
  +$subthis =~ s/[^`]*` \\\n//s;
  +#   catch command termination by semicolon, pipe, or, and;
  +$subthis =~ s/[;|&].*$//s;
  +if ($subthis =~ m/\s-[a-zA-Z]\S/) {
  +print "\nDEBUG:  subthis=%s", $subthis;
  +print "\nDEBUG:  subthis=%s", $subthis;
  +&lint_warning($file, $done, $this, "found use of shtool option with 
space omitted before argument");
  +}
  +
   #   openpkg-rc is special because does bootstrap things
   last if ($file =~ m|openpkg-rc\.spec$|);
   
  @@ -838,9 +860,9 @@
   
   #   check for deprecated use of "shtool install -e @l_...@ %{l_...}"
   my $done = ''; my $this = ''; my $todo = $spec;
  -while ($todo =~ m/%{l_shtool} [EMAIL P