Update to pkglint-2.31

lintpkgsrc changes:
Add '-S' - List packages not in category 'SUBDIRS', rename experimental '-S'
to '-c'. Rework -h output to group by type. Fix poblem with handling certain
glob expressions for depends, clean up manpage.
This commit is contained in:
abs 2000-11-17 12:45:30 +00:00
parent 9ad61bf074
commit 8a657f9272
3 changed files with 121 additions and 62 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.68 2000/11/14 17:11:42 abs Exp $
# $NetBSD: Makefile,v 1.69 2000/11/17 12:45:30 abs Exp $
#
DISTNAME= pkglint-2.30
DISTNAME= pkglint-2.31
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty

View file

@ -1,4 +1,4 @@
.\" $NetBSD: lintpkgsrc.1,v 1.13 2000/11/14 17:11:43 abs Exp $
.\" $NetBSD: lintpkgsrc.1,v 1.14 2000/11/17 12:45:31 abs Exp $
.\"
.\" Copyright (c) 1999 by David Brownlee (abs@netbsd.org)
.\" Absolutely no warranty.
@ -10,12 +10,12 @@
.Nd a verifier for the pkgsrc tree
.Sh SYNOPSIS
.Nm
.Op Fl BLRdhilmor
.Op Fl D Ar paths
.Op Fl BDLRSVdhilmopru
.Op Fl K Ar PACKAGES
.Op Fl M Ar distdir
.Op Fl M Ar DISTDIR
.Op Fl P Ar PKGSRCDIR
.Op Fl S Ar pkgsrcmap
.Op Fl g Ar pkgsrcmap
.Op Pa makefile ...
.Sh DESCRIPTION
.Nm
tries to verify the entire contents of the pkgsrc tree.
@ -34,10 +34,27 @@ Parse Makefiles and output contents (Useful for debugging).
Override binary packages base directory, normally set from
.Pa /etc/mk.conf
or defaulted to PKGSRCDIR/packages.
.Pp
Note: lintpkgsrc treats
.Em PACKAGES
slightly differently to the pkgsrc build system. -p, -R and -V check for
binary packages in any depth of PACKAGES subdirs - this allows packages for all
architectures/OS versions to be checked simultaneously with an
.Pa /etc/mk.conf
construct of the form:
.Bd -literal
\&.ifdef LINTPKGSRC
PACKAGES=${PKGSRCDIR}/packages
\&.else
PACKAGES=${PKGSRCDIR}/packages/${OS_VERSION}/${MACHINE_ARCH}
\&.endif
.Pp
Which would be an alternative to -K.
.Ed
.It Fl L
List the filenames of Makefiles as they are parsed (for debugging).
.It Fl M Ar distdir
Set directory for distfiles, otherwise PKGSRCDIR/distfiles is used.
.It Fl M Ar DISTDIR
Set directory for distfiles, defaults to PKGSRCDIR/distfiles.
.It Fl P Ar PKGSRCDIR
Set base of pkgsrc tree, normally set from
.Pa /etc/mk.conf
@ -51,8 +68,10 @@ for whom the source Makefile lists
or
.Em RESTRICTED .
This is intended to help those making binary packages available for ftp.
.It Fl S Ar pkgsrcmap
Output map of 'pkgname pkgdir pkgver'
.It Fl S
List packages missing from category
.Em SUBDIR
lists.
.It Fl V
List any prebuilt packages in any subdirs of
.Em PACKAGES
@ -62,6 +81,9 @@ PKGSRCDIR/distfiles/vulnerabilities .
Extract the 'DEPENDS' listing from each pkgsrc package Makefile, then
verify the version specified in each DEPEND correctly matches a current
pkgsrc package.
.It Fl g Ar pkgsrcmap
Generate pkgsrcmap file containing an entry for each package of
'pkgname pkgdir pkgver'.
.It Fl h
Basic help and usage.
.It Fl i
@ -83,6 +105,11 @@ Remove distfiles which are not referenced from any package's md5 file,
or have an incorrect checksum (usually due to an interrupted download),
and any old binary packages. To remove any given type, additionally
specify the -o, -m, or -p flags respectively.
.It Fl u
For each package current installed, run 'make fetch-list | sh' to ensure
all the distfiles needed for the latest version are present.
.Pp
Warning: The behaviour of this command may change in a later version.
.El
.Sh AUTHOR
David Brownlee <abs@netbsd.org>
@ -106,7 +133,7 @@ or set conditionally in
based on the value of
.Em LINTPKGSRC .
.Sh BUGS
The 'Makefile parsing' algorithym used to obtain package versions
The 'Makefile parsing' algorithm used to obtain package versions
and DEPENDS information is geared towards speed rather than
perfection, though it has got somewhat better over time, it only
parses the simplest Makefile conditionals. (a == b, no && etc).

View file

@ -1,6 +1,6 @@
#!/usr/bin/env perl
# $NetBSD: lintpkgsrc.pl,v 1.39 2000/11/14 17:11:43 abs Exp $
# $NetBSD: lintpkgsrc.pl,v 1.40 2000/11/17 12:45:31 abs Exp $
# Written by David Brownlee <abs@netbsd.org>.
#
@ -17,8 +17,7 @@ $^W = 1;
use strict;
use Getopt::Std;
use File::Find;
my( $pkgdistdir, # Distfiles directory
%pkg, # {$ver} ->{restricted} ->{dir} ->{BROKEN}
my( %pkg, # {$ver} ->{restricted} ->{dir} ->{BROKEN}
$default_vars, # Set for Makefiles, inc PACKAGES & PKGSRCDIR
%opt, # Command line options
%vuln, # vulnerability data
@ -28,12 +27,12 @@ my( $pkgdistdir, # Distfiles directory
$ENV{PATH} .= ':/usr/sbin';
if (! &getopts('BS:VDK:LM:P:Rdhilmopru', \%opt) || $opt{'h'} ||
! ( defined($opt{'d'}) || defined($opt{'i'}) || defined($opt{'l'}) ||
defined($opt{'m'}) || defined($opt{'o'}) || defined($opt{'p'}) ||
defined($opt{'r'}) || defined($opt{'u'}) || defined($opt{'B'}) ||
defined($opt{'D'}) || defined($opt{'S'}) || defined($opt{'V'}) ||
defined($opt{'R'}) ))
if (! &getopts('BDK:LM:P:RSVdg:hilmopru', \%opt) || $opt{'h'} ||
! ( defined($opt{'d'}) || defined($opt{'g'}) || defined($opt{'i'}) ||
defined($opt{'l'}) || defined($opt{'m'}) || defined($opt{'o'}) ||
defined($opt{'p'}) || defined($opt{'r'}) || defined($opt{'u'}) ||
defined($opt{'B'}) || defined($opt{'D'}) || defined($opt{'R'}) ||
defined($opt{'S'}) || defined($opt{'V'}) ))
{ &usage_and_exit; }
$| = 1;
@ -61,24 +60,19 @@ if ($opt{'D'} && @ARGV)
# main
{
my($pkglint_flags, $pkgsrcdir);
my($pkglint_flags, $pkgsrcdir, $pkgdistdir);
$pkgsrcdir = $default_vars->{'PKGSRCDIR'};
$pkgdistdir = $default_vars->{'DISTDIR'};
$pkglint_flags = '-v';
if ($opt{'M'})
{ $pkgdistdir = $opt{'M'}; } # override distfile dir
else
{ $pkgdistdir = "$pkgsrcdir/distfiles"; } # default
if ($opt{'r'} && !$opt{'o'} && !$opt{'m'} && !$opt{'p'})
{ $opt{'o'} = $opt{'m'} = $opt{'p'} = 1; }
if ($opt{'o'} || $opt{'m'})
{
my(@baddist);
@baddist = &scan_pkgsrc_distfiles_vs_md5($pkgsrcdir,
@baddist = &scan_pkgsrc_distfiles_vs_md5($pkgsrcdir, $pkgdistdir,
$opt{'o'}, $opt{'m'});
if ($opt{'r'})
{
@ -135,10 +129,34 @@ if ($opt{'D'} && @ARGV)
}
if ($opt{'S'})
{
my($cat, %in_subdir, $pkgname, $ver);
foreach $cat (&list_pkgsrc_categories($pkgsrcdir))
{
my($vars) = parse_makefile_vars("$pkgsrcdir/$cat/Makefile");
if (! $vars->{'SUBDIR'})
{ print "Warning - no SUBDIR for $cat\n"; next; }
foreach (split(/\s+/, $vars->{'SUBDIR'}))
{ $in_subdir{"$cat/$_"} = 1; }
}
&scan_pkgsrc_makefiles($pkgsrcdir);
foreach $pkgname (sort keys %pkg)
{ # Print highest number first
foreach $ver (reverse sort keys %{$pkg{$pkgname}})
{
if (!defined $in_subdir{$pkg{$pkgname}{$ver}{'dir'}})
{ print "$pkg{$pkgname}{$ver}{'dir'}: Not in SUBDIR\n"; }
}
}
}
if ($opt{'g'})
{
my($pkgname, $ver, $tmpfile);
$tmpfile = "$opt{'S'}.tmp.$$";
$tmpfile = "$opt{'g'}.tmp.$$";
&scan_pkgsrc_makefiles($pkgsrcdir);
if (!open(TABLE, ">$tmpfile"))
@ -150,9 +168,10 @@ if ($opt{'D'} && @ARGV)
}
if (!close(TABLE))
{ &fail("Error while writing '$tmpfile': $!"); }
if (!rename($tmpfile, $opt{'S'}))
{ &fail("Error in rename('$tmpfile','$opt{'S'}'): $!"); }
if (!rename($tmpfile, $opt{'g'}))
{ &fail("Error in rename('$tmpfile','$opt{'g'}'): $!"); }
}
if ($opt{'d'})
{
&scan_pkgsrc_makefiles($pkgsrcdir);
@ -323,6 +342,10 @@ sub get_default_makefile_vars
if ($opt{'P'})
{ $default_vars->{'PKGSRCDIR'} = $opt{'P'}; }
if ($opt{'M'})
{ $default_vars->{'DISTDIR'} = $opt{'M'}; }
$default_vars->{'DISTDIR'} ||= $default_vars->{'PKGSRCDIR'}.'/distfiles';
if ($opt{'K'})
{ $default_vars->{'PACKAGES'} = $opt{'K'}; }
$default_vars->{'PACKAGES'} ||= $default_vars->{'PKGSRCDIR'}.'/packages';
@ -437,13 +460,13 @@ sub glob2regex
elsif ($_ eq '.' || $_ eq '|' )
{ $regex .= quotemeta; }
elsif ($_ eq '{' )
{ $regex .= '('; $in_alt = 1; }
{ $regex .= '('; ++$in_alt; }
elsif ($_ eq '}' )
{
if (!$in_alt) # Error
{ return undef; }
$regex .= ')';
$in_alt = 0;
--$in_alt;
}
elsif ($_ eq ',' && $in_alt)
{ $regex .= '|'; }
@ -454,6 +477,8 @@ sub glob2regex
{ return undef; }
if ($regex eq $glob)
{ return(''); }
if ($opt{'D'})
{ print "glob2regex: $glob -> $regex\n"; }
'^'.$regex.'$';
}
@ -502,14 +527,17 @@ sub package_globmatch
foreach $pkgname (sort keys %pkg)
{ ($pkgname =~ /$regex/) && push(@pkgnames, $pkgname); }
}
# Try to convert $matchver into regex version
#
$regex = glob2regex($matchver);
foreach $pkgname (@pkgnames)
{
if (defined $pkg{$pkgname}{$matchver})
{ return($matchver); }
# Try to convert $globver into regex version
if ( $regex = glob2regex($matchver))
if ($regex)
{
foreach $ver (keys %{$pkg{$pkgname}})
{
@ -519,7 +547,9 @@ sub package_globmatch
}
$matchver || last;
}
# last ditch attempt to handle the whole DEPENDS as a glob
#
if ($matchver && ($regex = glob2regex($pkgmatch))) # (large-glob)
{
my($pkgname, $ver);
@ -697,7 +727,7 @@ sub parse_makefile_vars
next;
}
if (/^ *(\w+)([+?]?)\s*=\s*(\S.*)/)
if (/^ *(\w+)\s*([+?]?)=\s*(\S.*)/)
{
$key = $1;
$plus = $2;
@ -918,7 +948,7 @@ sub pkgsrc_check_depends
#
sub scan_pkgsrc_distfiles_vs_md5
{
my($pkgsrcdir, $check_unref, $check_md5) = @_;
my($pkgsrcdir, $pkgdistdir, $check_unref, $check_md5) = @_;
my($cat, @categories, $pkgdir);
my(%distfiles, %md5, @distwarn, $file, $numpkg);
my(@distfiles, @bad_distfiles);
@ -957,7 +987,7 @@ sub scan_pkgsrc_distfiles_vs_md5
}
&verbose(" ($numpkg packages)\n");
# Do not mark the vulnerabilitis file as unknown
# Do not mark the vulnerabilities file as unknown
$distfiles{'vulnerabilities'} = 'vulnerabilities';
$md5{'vulnerabilities'} = 'IGNORE';
@ -1002,37 +1032,39 @@ sub scan_pkgsrc_distfiles_vs_md5
#
sub usage_and_exit
{
print "Usage: lintpkgsrc [opts]
print "Usage: lintpkgsrc [opts] [makefiles]
opts:
-h : This help.
-d : Check 'DEPENDS' are up to date.
-i : Check installed package versions against pkgsrc.
-l : Pkglint every package in pkgsrc.
-R : List any NO_BIN_ON_FTP/RESTRICTED prebuilt packages (#).
-V : List any prebuilt packages with known vulnerabilities (#).
-m : List md5 mismatches for files in distfiles/.
-o : List old/obsolete distfiles (not referenced by any md5).
-p : List old/obsolete prebuilt packages (#).
-r : Remove 'bad' distfiles or packages (*).
-u : For each installed package ensure distfiles are fetched.
-B : List 'BROKEN' packages
-S file : Output map of 'pkgname pkgdir pkgver'
-h : This help. [see lintpkgsrc(1) for more information]
-L : List each Makefile when scanned
-P path : Set PKGSRCDIR
-K path : Set basedir for prebuild packages (default PKGSRCDIR/packages)
-M path : Set basedir for distfiles (default PKGSRCDIR/distfiles)
-D [paths] : Parse Makefiles and output contents (For debugging)
Installed package options: Distfile options:
-i : Check version against pkgsrc -m : List md5 mismatches
-u : Fetch distfiles (may change) -o : List obsolete (no md5)
(*) Without any of -m, -o, -p, or -V implies all. Can use with -R.
Prebuilt package options: Makefile options:
-p : List old/obsolete -B : List packages marked as 'BROKEN'
-R : List NO_BIN_ON_FTP/RESTRICTED -d : Check 'DEPENDS' up to date
-V : List known vulnerabilities -S : List packages not in 'SUBDIRS'
See lintpkgsrc(1) for more information.
Misc:
-g file : Generate 'pkgname pkgdir pkgver' map in file
-l : Pkglint all packages
-r : Remove bad files (Without -m -o -p or -V implies all, can use -R)
Modifiers:
-K path : Set PACKAGES basedir (default PKGSRCDIR/packages)
-M path : Set DISTDIR (default PKGSRCDIR/distfiles)
-P path : Set PKGSRCDIR (default /usr/pkgsrc)
-D : Debug makefile and glob parsing
-L : List each Makefile when scanned
";
exit;
}
sub verbose
{ print STDERR @_; }
{
if (-t STDERR)
{ print STDERR @_; }
}
sub debug
{