summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorabs <abs>2001-05-18 10:38:47 +0000
committerabs <abs>2001-05-18 10:38:47 +0000
commitf7d0f3f248db51ed1623e4a6a08a8f20b2f08c11 (patch)
treee75cfff4ffe128868d334a0ff78b503c6d47c976 /pkgtools
parent640e89f2bfca2217fc316a4f2b29b3122b6eb8a6 (diff)
downloadpkgsrc-f7d0f3f248db51ed1623e4a6a08a8f20b2f08c11.tar.gz
Update pkglint to 2.53
Extend 'lintpkgsrc -u' to list REQUIRED entries for mismatched packages, handle PACKAGES?=xxx in mk.conf
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/Makefile4
-rw-r--r--pkgtools/pkglint/files/lintpkgsrc.19
-rwxr-xr-xpkgtools/pkglint/files/lintpkgsrc.pl64
3 files changed, 58 insertions, 19 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index e25335a837a..5c8190bda05 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.94 2001/05/16 11:36:47 abs Exp $
+# $NetBSD: Makefile,v 1.95 2001/05/18 10:38:47 abs Exp $
#
-DISTNAME= pkglint-2.52
+DISTNAME= pkglint-2.53
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkglint/files/lintpkgsrc.1 b/pkgtools/pkglint/files/lintpkgsrc.1
index 8a432654737..bc3d4990220 100644
--- a/pkgtools/pkglint/files/lintpkgsrc.1
+++ b/pkgtools/pkglint/files/lintpkgsrc.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: lintpkgsrc.1,v 1.15 2001/05/14 15:01:24 agc Exp $
+.\" $NetBSD: lintpkgsrc.1,v 1.16 2001/05/18 10:38:47 abs Exp $
.\"
.\" Copyright (c) 1999 by David Brownlee (abs@netbsd.org)
.\" Absolutely no warranty.
@@ -106,8 +106,11 @@ 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.
+As
+.Fl i
+plus for mismatched packages, display REQUIRED details and 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
diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl
index fba79ad5b50..45e0b029597 100755
--- a/pkgtools/pkglint/files/lintpkgsrc.pl
+++ b/pkgtools/pkglint/files/lintpkgsrc.pl
@@ -1,6 +1,6 @@
#!@PREFIX@/bin/perl
-# $NetBSD: lintpkgsrc.pl,v 1.48 2001/05/16 11:36:47 abs Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.49 2001/05/18 10:38:47 abs Exp $
# Written by David Brownlee <abs@netbsd.org>.
#
@@ -49,6 +49,7 @@ if ($opt{'D'} && @ARGV)
{ &fail("No such file: $file"); }
my($pkgname, $vars);
($pkgname, $vars) = &parse_makefile_pkgsrc($file);
+ $pkgname ||= 'UNDEFINED';
print "$file -> $pkgname\n";
foreach ( sort keys %{$vars} )
{ print "\t$_ = $vars->{$_}\n"; }
@@ -179,31 +180,62 @@ if ($opt{'D'} && @ARGV)
}
if ($opt{'i'} || $opt{'u'})
{
- my(@pkgs, @bad, $pkg);
+ my(@pkgs, %update, $pkg);
@pkgs = &list_installed_packages;
&scan_pkgsrc_makefiles($pkgsrcdir);
- foreach $pkg ( sort @pkgs )
+ foreach $pkg (sort @pkgs)
{
if ( $_ = &invalid_version($pkg) )
{
- push(@bad, $pkg);
print $_;
+ if ( $pkg =~ /^([^*?[]+)-([\d*?[].*)/ )
+ {
+ my($ver);
+ foreach (reverse sort keys %{$pkg{$1}})
+ {
+ $pkg{$1}{$_}->{'dir'} =~ /-current/ && next;
+ $update{$1} = $_;
+ last;
+ }
+ }
}
}
if ($opt{'u'})
{
- foreach $pkg (@bad)
+ my($pkgname);
+ print "\nREQUIRED details for packages that could be updated:\n";
+ foreach $pkgname (sort keys %update)
+ {
+ print "$pkgname:";
+ if (open(PKGINFO, "pkg_info -R $pkgname|"))
+ {
+ my($list);
+ while (<PKGINFO>)
+ {
+ if (/Required by:/)
+ { $list = 1; }
+ elsif ($list)
+ {
+ chomp;
+ s/-\d.*//;
+ print " $_";
+ }
+ }
+ close(PKGINFO);
+ }
+ print "\n";
+ }
+ print "\nRunning 'make fetch-list | sh' for each package:\n";
+ foreach $pkgname (sort keys %update)
{
my($pkgdir);
- if ( $pkg =~ /^([^*?[]+)-([\d*?[].*)/ )
- { $pkgdir = $pkg{$1}{$2}->{'dir'}; }
-
+ $pkgdir = $pkg{$pkgname}{$update{$pkgname}}->{'dir'};
if (!defined($pkgdir))
- { &fail("Unable to determine directory for '$pkg'"); }
+ { &fail("Unable to determine directory for '$pkgname'"); }
print "$pkgsrcdir/$pkgdir\n";
safe_chdir("$pkgsrcdir/$pkgdir");
system('make fetch-list | sh');
@@ -372,7 +404,10 @@ sub invalid_version
if (defined($badver))
{
if (defined $pkg{$pkg})
- { $fail = "Version mismatch: '$pkg' $badver vs ".join(',', sort keys %{$pkg{$pkg}})."\n"; }
+ {
+ $fail = "Version mismatch: '$pkg' $badver vs ".
+ join(',', sort keys %{$pkg{$pkg}})."\n";
+ }
else
{ $fail = "Unknown package: '$pkg' version $badver\n"; }
}
@@ -645,7 +680,8 @@ sub parse_makefile_vars
close(FILE);
# Some Makefiles depend on these being set
- %vars = %{$default_vars};
+ if ($file ne '/etc/mk.conf')
+ { %vars = %{$default_vars}; }
if ($file =~ m#(.*)/#)
{ $vars{'.CURDIR'} = $1; }
if ($opt{'L'})
@@ -740,9 +776,9 @@ sub parse_makefile_vars
$key = $1;
$plus = $2;
$value = $3;
- if ($plus eq '+' && defined($vars{$key}) )
+ if ($plus eq '+' && defined $vars{$key} )
{ $vars{$key} .= " $value"; }
- elsif ($plus ne '?' || !defined($vars{$key}) )
+ elsif ($plus ne '?' || !defined $vars{$key} )
{ $vars{$key} = $value; }
}
}
@@ -1067,7 +1103,7 @@ opts:
Installed package options: Distfile options:
-i : Check version against pkgsrc -m : List distinfo mismatches
- -u : Fetch distfiles (may change) -o : List obsolete (no distinfo)
+ -u : As -i + fetch dist (may change) -o : List obsolete (no distinfo)
Prebuilt package options: Makefile options:
-p : List old/obsolete -B : List packages marked as 'BROKEN'