From 347d1743c4dd3e5d4873cfeacbed86b0146d5157 Mon Sep 17 00:00:00 2001 From: abs Date: Fri, 20 Oct 2000 11:00:13 +0000 Subject: Update to 2.29 lintpkgsrc - Add '-S' to optionally generate pkgsrcmap file mapping pkgname to pkgdir and version --- pkgtools/pkglint/Makefile | 4 ++-- pkgtools/pkglint/files/lintpkgsrc.pl | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index fb083ddcab6..f85deb867ef 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.66 2000/10/12 15:07:41 abs Exp $ +# $NetBSD: Makefile,v 1.67 2000/10/20 11:00:13 abs Exp $ # -DISTNAME= pkglint-2.28 +DISTNAME= pkglint-2.29 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl index a64449e8f50..d92f3a724a1 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.37 2000/10/12 15:07:44 abs Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.38 2000/10/20 11:00:13 abs Exp $ # Written by David Brownlee . # @@ -28,11 +28,11 @@ my( $pkgdistdir, # Distfiles directory $ENV{PATH} .= ':/usr/sbin'; -if (! &getopts('VDK:LM:P:Rdhilmopru', \%opt) || $opt{'h'} || +if (! &getopts('SVDK: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{'D'}) || - defined($opt{'V'}) || defined($opt{'R'}) )) + defined($opt{'S'}) || defined($opt{'V'}) || defined($opt{'R'}) )) { &usage_and_exit; } $| = 1; @@ -118,6 +118,26 @@ if ($opt{'D'} && @ARGV) } } + if ($opt{'S'}) + { + my($pkgname, $ver, $tmpfile); + + $tmpfile = "$pkgsrcdir/pkgsrcmap.tmp.$$"; + + if (!%pkg) + { &scan_pkgsrc_makefiles($pkgsrcdir); } + if (!open(TABLE, ">$tmpfile")) + { &fail("Unable to write '$tmpfile': $!"); } + foreach $pkgname (sort keys %pkg) + { # Print highest number first + foreach $ver (reverse sort keys %{$pkg{$pkgname}}) + { print TABLE "$pkgname\t$pkg{$pkgname}{$ver}{'dir'}\t$ver\n"; } + } + if (!close(TABLE)) + { &fail("Error while writing '$tmpfile': $!"); } + if (!rename($tmpfile, "$pkgsrcdir/pkgsrcmap")) + { &fail("Error in rename('$tmpfile','$pkgsrcdir/pkgsrcmap'): $!"); } + } if ($opt{'d'}) { if (!%pkg) @@ -131,7 +151,8 @@ if ($opt{'D'} && @ARGV) @pkgs = &list_installed_packages; if (!%pkg) { &scan_pkgsrc_makefiles($pkgsrcdir); } - foreach $pkg ( @pkgs ) + + foreach $pkg ( sort @pkgs ) { if ( $_ = &invalid_version($pkg) ) { @@ -139,6 +160,7 @@ if ($opt{'D'} && @ARGV) print $_; } } + if ($opt{'u'}) { foreach $pkg (@bad) @@ -161,6 +183,7 @@ if ($opt{'D'} && @ARGV) } exit; + # Could speed up by building a cache of package names to paths, then processing # each package name once against the tests. sub check_prebuilt_packages @@ -196,7 +219,8 @@ sub check_prebuilt_packages print "$File::Find::dir/$_\n"; push(@matched_prebuiltpackages, "$File::Find::dir/$_"); } - ($chkver) = (sort keys %{$pkg{$pkgname}}); # Pick any version + # Pick probably the last version + ($chkver) = (reverse sort keys %{$pkg{$pkgname}}); } if ($opt{'R'} && defined $pkg{$pkgname}{$chkver}->{'restricted'}) { @@ -974,6 +998,7 @@ opts: -p : List old/obsolete prebuilt packages (#). -r : Remove 'bad' distfiles or packages (*). -u : For each installed package ensure distfiles are fetched. + -S : Rebuild PKGSRCDIR/pkgsrcmap -L : List each Makefile when scanned -P path : Set PKGSRCDIR -- cgit v1.2.3