diff options
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/lintpkgsrc.1 | 11 | ||||
-rwxr-xr-x | pkgtools/pkglint/files/lintpkgsrc.pl | 57 |
3 files changed, 53 insertions, 19 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index 59a5851bbe2..d8a50ff26a2 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.10 1999/06/05 00:32:39 abs Exp $ +# $NetBSD: Makefile,v 1.11 1999/06/24 23:40:13 abs Exp $ # -DISTNAME= pkglint-1.71 +DISTNAME= pkglint-1.72 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkglint/files/lintpkgsrc.1 b/pkgtools/pkglint/files/lintpkgsrc.1 index 0ce427fbb50..a93064b2954 100644 --- a/pkgtools/pkglint/files/lintpkgsrc.1 +++ b/pkgtools/pkglint/files/lintpkgsrc.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: lintpkgsrc.1,v 1.2 1999/04/19 17:59:05 abs Exp $ +.\" $NetBSD: lintpkgsrc.1,v 1.3 1999/06/24 23:40:13 abs Exp $ .\" .\" Copyright (c) 1999 by David Brownlee (abs@netbsd.org) .\" Absolutely no warranty. @@ -38,10 +38,13 @@ package's md5 file. Also report if any package's md5 file references the same distfile with a different md5 checksum. .It Fl o Report any old distfile (not referenced by any package's md5 file). +.It Fl p +Report any old binary packages (in any subdirs of PKGSRCDIR/packages) .It Fl r -Remove distfiles which are not referenced from any package's md5 file, or -have an incorrect checksum (usually due to an interrupted download). To remove -one or the other type, additionally specify the -o or -m flag respectively. +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. .El .Sh AUTHOR David Brownlee <abs@netbsd.org> diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl index 1ee450d73cd..9a78c2e9418 100755 --- a/pkgtools/pkglint/files/lintpkgsrc.pl +++ b/pkgtools/pkglint/files/lintpkgsrc.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# $NetBSD: lintpkgsrc.pl,v 1.3 1999/06/05 00:32:40 abs Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.4 1999/06/24 23:40:13 abs Exp $ # (Somewhat quickly) Written by David Brownlee <abs@anim.dreamworks.com>. # Caveats: @@ -11,25 +11,29 @@ # fastcap (which does strange things anyway). require 'getopts.pl'; -if (! &Getopts('dhilmor') || $opt_h || ! (defined($opt_o) || defined($opt_d) || - defined($opt_l) || defined($opt_i) || - defined($opt_m) || defined($opt_r) )) +$^W=1; +use strict; +use File::Find; +use vars qw($opt_d $opt_h $opt_i $opt_l $opt_m $opt_o $opt_p $opt_r); +my(%pkg2dir,@oldprebuiltpackages); + +if (! &Getopts('dhilmopr') || $opt_h || + ! ( defined($opt_d) || defined($opt_i) || defined($opt_l) || + defined($opt_m) || defined($opt_o) || defined($opt_p) || + defined($opt_r) )) { &usage_and_exit; } $|=1; -$^W=1; -use strict; -use vars ('$opt_o','$opt_d','$opt_h','$opt_i','$opt_l','$opt_m','$opt_r'); # main { - my($pkgsrcdir,%pkg2dir,$pkglint_flags); + my($pkgsrcdir,$pkglint_flags); $pkglint_flags='-a -b -c -v'; $pkgsrcdir=&set_pkgsrcdir; # Parse /etc/mk.conf (if present) for PKGSRCDIR - if ($opt_r && !$opt_o && !$opt_m) - { $opt_o=$opt_m=1; } + if ($opt_r && !$opt_o && !$opt_m && !$opt_p) + { $opt_o=$opt_m=$opt_p=1; } if ($opt_o || $opt_m) { my(@baddist); @@ -43,6 +47,20 @@ use vars ('$opt_o','$opt_d','$opt_h','$opt_i','$opt_l','$opt_m','$opt_r'); { unlink($_); } } } + + if ($opt_p) + { + if (!%pkg2dir) + { %pkg2dir=&scan_pkgsrc_makefiles($pkgsrcdir); } + find(\&check_prebuilt_packages,"$pkgsrcdir/packages"); + if ($opt_r) + { + &verbose("Unlinking 'old' prebuiltpackages\n"); + foreach (@oldprebuiltpackages) + { unlink($_); } + } + } + if ($opt_d) { %pkg2dir=&scan_pkgsrc_makefiles($pkgsrcdir,1); } if ($opt_i) @@ -53,13 +71,25 @@ use vars ('$opt_o','$opt_d','$opt_h','$opt_i','$opt_l','$opt_m','$opt_r'); if (!%pkg2dir) { %pkg2dir=&scan_pkgsrc_makefiles($pkgsrcdir); } foreach $pkg ( @pkgs ) - { &list_possible_versions($pkg,%pkg2dir); } + { &list_possible_versions($pkg); } } if ($opt_l) { &pkglint_all_pkgsrc($pkgsrcdir,$pkglint_flags); } } exit; +sub check_prebuilt_packages + { + if (/(.*)\.tgz$/) + { + if (!defined($pkg2dir{$1})) + { + print "$File::Find::dir/$_\n"; + push(@oldprebuiltpackages,"$File::Find::dir/$_"); + } + } + } + sub fail { print STDERR @_,"\n"; exit(3); } @@ -67,7 +97,7 @@ sub fail # sub list_possible_versions { - my($pkg,%pkg2dir)=@_; + my($pkg)=@_; my($pkgname,@maybe,$fail); if (!defined($pkg2dir{$pkg})) @@ -409,7 +439,8 @@ opts: -d : Check each Makefile's 'DEPENDS' matches current pkgsrc versions. -l : Run pkglint on every package in pkgsrc. -m : Report md5 mismatches for files in 'distfiles'. -o : Report old/obsolete 'distfiles' (not referenced by any md5). - -r : Remove any 'bad' distfiles (Without -m or -o, implies both). + -p : Report old/obsolete prebuilt packages (in PKGSRCDIR/packages/...) + -r : Remove any 'bad' distfiles (Without -m, -o, or -p, implies all). If pkgsrc is not in /usr/pkgsrc, set PKGSRCDIR in /etc/mk.conf "; |