pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc Update to pkglint 3.79
details: https://anonhg.NetBSD.org/pkgsrc/rev/e521ab11ce83
branches: trunk
changeset: 477099:e521ab11ce83
user: hubertf <hubertf%pkgsrc.org@localhost>
date: Sat Jun 26 18:53:17 2004 +0000
description:
Update to pkglint 3.79
== functional changes ==
- prints the various "OK: ..." messages only when called with "-v".
- prints a summary after pkgsrc category checks
- fixed a bug for commented category entries (in line 1718)
- removed the option "-q". It has become unnecessary
== refactoring ==
- more consistent naming scheme for variables and functions
- replaced some "local" with "my" when possible
- clustered the variables that are processed by the ${SED} commands
- provided function prototypes for argument checking
- replaced the old perror by log_{error,warning,info}.
- Avoided the (implicit or explicit) use of $_ in many places
Patch contributed by Roland Illig via private mail.
diffstat:
doc/CHANGES | 3 +-
pkgtools/pkglint/Makefile | 4 +-
pkgtools/pkglint/files/pkglint.pl | 1014 +++++++++++++++++++-----------------
3 files changed, 531 insertions(+), 490 deletions(-)
diffs (truncated from 2087 to 300 lines):
diff -r 8634252fa5ea -r e521ab11ce83 doc/CHANGES
--- a/doc/CHANGES Sat Jun 26 18:49:53 2004 +0000
+++ b/doc/CHANGES Sat Jun 26 18:53:17 2004 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.6332 2004/06/26 18:49:53 grant Exp $
+$NetBSD: CHANGES,v 1.6333 2004/06/26 18:53:17 hubertf Exp $
Changes to the packages collection and infrastructure in 2004:
@@ -3084,3 +3084,4 @@
Updated mplayer to 1.0pre4nb1 [grant 2004-06-26]
Updated gmplayer to 1.0pre4nb1 [grant 2004-06-26]
Updated mencoder to 1.0pre4nb1 [grant 2004-06-26]
+ Updated pkglint to 3.79 [hubertf 2004-06-26]
diff -r 8634252fa5ea -r e521ab11ce83 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sat Jun 26 18:49:53 2004 +0000
+++ b/pkgtools/pkglint/Makefile Sat Jun 26 18:53:17 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.191 2004/06/25 19:03:26 hubertf Exp $
+# $NetBSD: Makefile,v 1.192 2004/06/26 18:53:17 hubertf Exp $
#
-DISTNAME= pkglint-3.78
+DISTNAME= pkglint-3.79
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty
diff -r 8634252fa5ea -r e521ab11ce83 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Sat Jun 26 18:49:53 2004 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Sat Jun 26 18:53:17 2004 +0000
@@ -11,12 +11,12 @@
# Freely redistributable. Absolutely no warranty.
#
# From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
-# $NetBSD: pkglint.pl,v 1.107 2004/06/25 19:03:26 hubertf Exp $
+# $NetBSD: pkglint.pl,v 1.108 2004/06/26 18:53:17 hubertf Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by Hubert Feyrer <hubertf%netbsd.org@localhost>,
-# Thorsten Frueauf <frueauf%netbsd.org@localhost>, Thomas Klausner <wiz%netbsd.org@localhost>
-# and others.
+# Thorsten Frueauf <frueauf%netbsd.org@localhost>, Thomas Klausner <wiz%netbsd.org@localhost>,
+# Roland Illig <roland.illig%gmx.de@localhost> and others.
#
use Getopt::Std;
@@ -24,73 +24,110 @@
use FileHandle;
use Cwd;
-$err = $warn = 0;
-$extrafile = $parenwarn = $committer = 1; # -abc
-$verbose = $newpkg = 0; # -vN
-$showmakefile = 0; # -I
-$contblank = 1;
-$portdir = '.';
-%definesfound = ();
+# Start of configuration area
+my $conf_rcsidstr = 'NetBSD';
+my $conf_portsdir = '@PORTSDIR@';
+my $conf_localbase = '@PREFIX@';
+my $conf_distver = '@DISTVER@';
+my $conf_make = '@MAKE@';
+# End of configuration area
+
+# Command line options
+my $opt_extrafile = 1; #
+my $opt_parenwarn = 1; #
+my $opt_committer = 1; #
+my $opt_verbose = 0; #
+my $opt_newpackage = 0; #
+my $opt_dumpmakefile = 0; #
+my $opt_contblank = 1; # number of allowed contigoous blank lines
+my $opt_packagedir = "."; #
+
+# Global variables that should be eliminated by the next refactoring.
+my %definesfound = ();
+my $errors = 0; # number of errors
+my $warnings = 0; # number of warnings
-# default settings for NetBSD
-$portsdir = '@PORTSDIR@';
-$rcsidstr = 'NetBSD';
-$localbase = '@PREFIX@';
+# == Output of messages to the user ==
+# The log_* routines take the parameters ($file, $lineno, $msg).
+# $file is the file where the message originated or NO_FILE.
+# $lineno is the line number if applicable or NO_LINE_NUMBER.
+# $msg is the text of the message.
+sub NO_FILE();
+sub NO_LINE_NUMBER();
+sub log_error($$$);
+sub log_warning($$$);
+sub log_info($$$);
+sub print_summary_and_exit();
-%opts = ();
-getopts('hINB:qvV', \%opts);
+sub checkfile_DESCR($);
+sub checkfile_distinfo($);
+sub checkfile_Makefile($);
+sub checkfile_MESSAGE($);
+sub checkfile_patches_patch($);
+sub checkfile_PLIST($);
-if ($opts{"h"}) {
- ($prog) = ($0 =~ /([^\/]+)$/);
+sub print_summary_and_exit();
+sub checkperms($);
+sub checkpathname($);
+sub checklastline($);
+sub readmakefile($);
+sub checkextra($$);
+sub checkorder($$@);
+sub checkearlier($@);
+sub abspathname($$);
+sub is_predefined($);
+sub category_check();
+
+sub parse_command_line() {
+ my %opts = ();
+ getopts('hINB:qvV', \%opts);
+ if ($opts{"h"}) {
+ my $prog = basename($0);
print STDERR <<EOF;
usage: $prog [-qvIN] [-B#] [package_directory]
- -q quiet
-v verbose mode
- -V version (@DISTVER@)
+ -V version ($conf_distver)
-I show Makefile (with all included files)
-N writing a new package
- -B# allow # contiguous blank lines (default: $contblank line)
+ -B# allow # contiguous blank lines (default: $opt_contblank line)
EOF
exit 0;
-};
-$quiet = 1 if $opts{"q"};
-$verbose = 1 if $opts{"v"};
-$newpkg = 1 if $opts{"N"};
-$showmakefile = 1 if $opts{"I"};
-$contblank = $opts{"B"} if $opts{"B"};
-
-$portdir = shift || ".";
+ }
+ if ($opts{"v"}) { $opt_verbose = 1; }
+ if ($opts{"N"}) { $opt_newpackage = 1; }
+ if ($opts{"I"}) { $opt_dumpmakefile = 1; }
+ if ($opts{"B"}) { $opt_contblank = $opts{"B"}; }
+ if (scalar(@ARGV)) { $opt_packagedir = shift(@ARGV); }
+ if ($opts{"V"}) {
+ print "$conf_distver\n";
+ exit;
+ }
+}
+parse_command_line();
-if ($opts{"V"}) {
- print "@DISTVER@\n";
- exit;
-}
-
-if ($verbose) {
- print "OK: config: portsdir: \"$portsdir\" ".
- "rcsidstr: \"$rcsidstr\" ".
- "localbase: $localbase\n";
-}
+log_info(NO_FILE, NO_LINE_NUMBER, "config: portsdir: \"$conf_portsdir\" ".
+ "rcsidstr: \"$conf_rcsidstr\" ".
+ "localbase: $conf_localbase");
#
# just for safety.
#
-if (! -d $portdir) {
- print STDERR "FATAL: invalid directory $portdir specified.\n";
+if (! -d $opt_packagedir) {
+ print STDERR "FATAL: invalid directory $opt_packagedir specified.\n";
exit 1;
}
-if (-e <$portdir/../Packages.txt>) {
- print "OK: checking category Makefile.\n" if ($verbose);
- &category_check;
- exit 0;
+if (-e <$opt_packagedir/../Packages.txt>) {
+ log_info(NO_FILE, NO_LINE_NUMBER, "checking category Makefile.");
+ category_check();
+ print_summary_and_exit();
}
-if (-e <$portdir/../../Packages.txt>) {
- if ($portdir eq ".") {
+if (-e <$opt_packagedir/../../Packages.txt>) {
+ if ($opt_packagedir eq ".") {
$category = basename(dirname(cwd()));
} else {
- $category = basename(dirname($portdir));
+ $category = basename(dirname($opt_packagedir));
}
}
@@ -136,11 +173,11 @@
}
# we need to handle the Makefile first to get some variables
-print "OK: checking Makefile.\n" unless $quiet;
-if (! -f "$portdir/Makefile") {
- &perror("FATAL: no Makefile in \"$portdir\".");
+log_info(NO_FILE, NO_LINE_NUMBER, "checking Makefile.");
+if (! -f "$opt_packagedir/Makefile") {
+ log_error(NO_FILE, NO_LINE_NUMBER, "no Makefile in \"$opt_packagedir\".");
} else {
- checkmakefile("Makefile") || &perror("Cannot open the file $i\n");
+ checkfile_Makefile("Makefile") || log_error(NO_FILE, NO_LINE_NUMBER, "Cannot open the file $i\n");
}
@@ -148,474 +185,457 @@
# check for files.
#
@checker = ("$pkgdir/DESCR");
-%checker = ("$pkgdir/DESCR", 'checkdescr');
+%checker = ("$pkgdir/DESCR", \&checkfile_DESCR);
-if ($extrafile) {
- foreach $i ((<$portdir/$filesdir/*>, <$portdir/$pkgdir/*>)) {
+if ($opt_extrafile) {
+ foreach $i ((<$opt_packagedir/$filesdir/*>, <$opt_packagedir/$pkgdir/*>)) {
next if (! -T $i);
next if ($i =~ /distinfo$/);
next if ($i =~ /Makefile$/);
- $i =~ s/^\Q$portdir\E\///;
+ $i =~ s/^\Q$opt_packagedir\E\///;
next if (defined $checker{$i});
if ($i =~ /MESSAGE/) {
unshift(@checker, $i);
- $checker{$i} = 'checkmessage';
+ $checker{$i} = \&checkfile_MESSAGE;
} elsif ($i =~ /PLIST/) {
unshift(@checker, $i);
- $checker{$i} = 'checkplist';
+ $checker{$i} = \&checkfile_PLIST;
} else {
push(@checker, $i);
- $checker{$i} = 'checkpathname';
+ $checker{$i} = \&checkpathname;
}
}
}
-foreach $i (<$portdir/$patchdir/patch-*>) {
+foreach $i (<$opt_packagedir/$patchdir/patch-*>) {
next if (! -T $i);
- $i =~ s/^\Q$portdir\E\///;
+ $i =~ s/^\Q$opt_packagedir\E\///;
next if (defined $checker{$i});
push(@checker, $i);
- $checker{$i} = 'checkpatch';
+ $checker{$i} = \&checkfile_patches_patch;
}
-if (-e <$portdir/$distinfo>) {
+if (-e <$opt_packagedir/$distinfo>) {
$i = "$distinfo";
next if (defined $checker{$i});
push(@checker, $i);
- $checker{$i} = 'checkdistinfo';
+ $checker{$i} = \&checkfile_distinfo;
}
{
# Make sure there's a distinfo if there are patches
$patches=0;
patch:
- foreach $i (<$portdir/$patchdir/patch-*>) {
+ foreach $i (<$opt_packagedir/$patchdir/patch-*>) {
if ( -T "$i" ) {
$patches=1;
last patch;
}
}
- if ($patches && ! -f "$portdir/$distinfo" ) {
- &perror("WARN: no $portdir/$distinfo file. Please run '@MAKE@ makepatchsum'.");
+ if ($patches && ! -f "$opt_packagedir/$distinfo" ) {
+ log_warning(NO_FILE, NO_LINE_NUMBER, "no $opt_packagedir/$distinfo file. Please run '$conf_make makepatchsum'.");
}
}
foreach $i (@checker) {
- print "OK: checking $i.\n" unless $quiet;
- if (! -f "$portdir/$i") {
- &perror("FATAL: no $i in \"$portdir\".");
+ log_info(NO_FILE, NO_LINE_NUMBER, "checking $i.");
+ if (! -f "$opt_packagedir/$i") {
+ log_error(NO_FILE, NO_LINE_NUMBER, "no $i in \"$opt_packagedir\".");
} else {
- $proc = $checker{$i};
- &$proc($i) || &perror("WARN: Cannot open the file $i\n");
+ $checker{$i}->($i) || log_warning(NO_FILE, NO_LINE_NUMBER, "Cannot open the file $i\n");
if ($i !~ /patches\/patch/) {
&checklastline($i) ||
- &perror("WARN: Cannot open the file $i\n");
+ log_warning(NO_FILE, NO_LINE_NUMBER, "Cannot open the file $i\n");
Home |
Main Index |
Thread Index |
Old Index