diff options
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/lintpkgsrc.1 | 6 | ||||
-rwxr-xr-x | pkgtools/pkglint/files/lintpkgsrc.pl | 61 |
3 files changed, 41 insertions, 30 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index 1a3ceb99c2a..6c9c0b6c86c 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.38 2000/01/10 15:06:48 abs Exp $ +# $NetBSD: Makefile,v 1.39 2000/01/14 01:02:01 abs Exp $ # -DISTNAME= pkglint-1.97 +DISTNAME= pkglint-1.98 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkglint/files/lintpkgsrc.1 b/pkgtools/pkglint/files/lintpkgsrc.1 index 2945343faa1..c05d36f1066 100644 --- a/pkgtools/pkglint/files/lintpkgsrc.1 +++ b/pkgtools/pkglint/files/lintpkgsrc.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: lintpkgsrc.1,v 1.7 1999/12/22 21:37:58 abs Exp $ +.\" $NetBSD: lintpkgsrc.1,v 1.8 2000/01/14 01:02:01 abs Exp $ .\" .\" Copyright (c) 1999 by David Brownlee (abs@netbsd.org) .\" Absolutely no warranty. @@ -10,7 +10,7 @@ .Nd a verifier for the pkgsrc tree .Sh SYNOPSIS .Nm -.Op Fl Rdhilmor +.Op Fl LRdhilmor .Op Fl D Ar paths .Op Fl K Ar binpkgdir .Op Fl P Ar pkgsrcdir @@ -28,6 +28,8 @@ Note that it does NOT implement complete Makefile parser. Parse Makefiles and output contents (Useful for debugging). .It Fl K Ar binpkgdir Set basedir for binary packages, otherwise PKGSRCDIR/packages is used. +.It Fl L +List the filenames of Makefiles as they are parsed (for debugging). .It Fl P Ar pkgsrcdir Set pkgsrcdir - otherwise .Pa /etc/mk.conf is parsed for diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl index 52ee2dcce39..6c579f42d8f 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.17 2000/01/10 15:06:49 abs Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.18 2000/01/14 01:02:01 abs Exp $ # Written by David Brownlee <abs@netbsd.org>. # @@ -29,7 +29,7 @@ my( $pkgsrcdir, # Base of pkgsrc tree $ENV{PATH} .= ':/usr/sbin'; -if (! &getopts('DK:P:Rdhilmopru', \%opt) || $opt{'h'} || +if (! &getopts('DK:LP: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'}) || @@ -172,8 +172,8 @@ sub dewey_cmp my($match, $test, $val) = @_; my($cmp, @matchlist, @vallist); - @matchlist = split(/\./, $match); - @vallist = split(/\./, $val); + @matchlist = split(/\D+/, $match); + @vallist = split(/\D+/, $val); $cmp = 0; while( ! $cmp && (@matchlist || @vallist)) { @@ -184,7 +184,6 @@ sub dewey_cmp else { $cmp = (shift @matchlist <=> shift @vallist) } } - print "$cmp $test 0\n"; eval "$cmp $test 0"; } @@ -304,7 +303,7 @@ sub package_globmatch { return($ver); } @chars = split(//, $matchver); $regexver = '^'; - while ($_ = shift @chars) + while (defined($_ = shift @chars)) { if ($_ eq '*') { $regexver .= '.*'; } @@ -328,15 +327,17 @@ sub package_globmatch { $matchver = undef; } } } - elsif ( $pkgmatch =~ /^([^*?[]+)(<|>|<=|>=)([\d.]+)/ ) + elsif ( $pkgmatch =~ /^([^*?[]+)(<|>|<=|>=)(\d.+)/ ) { # (package)(cmp)(dewey) my($test); - ($pkg, $test, $matchver) = ($1, $2); + ($pkg, $test, $matchver) = ($1, $2, $3); - if (defined($ver = $pkg2ver{$pkg})) + if ($matchver =~ /[^\d.]/ ) + { $matchver = "invalid-dewey($test$matchver)"; } + elsif (defined($ver = $pkg2ver{$pkg})) { - if ( dewey_cmp($matchver, $test, $ver) ) + if ( dewey_cmp($ver, $test, $matchver) ) { $matchver = undef; } else { $matchver = "$test$matchver"; } @@ -365,7 +366,8 @@ sub parse_makefile %vars = %default_makefile_vars; if ($file =~ m#(.*)/#) { $vars{'.CURDIR'} = $1; } - debug("read: $file\n"); + if ($opt{'L'}) + { print "$file\n"; } while( defined($_ = shift(@data)) ) { @@ -451,7 +453,7 @@ sub parse_makefile next; } - if (/^ *(\w+)([+?]?)=\s*(\S.*)/) + if (/^ *(\w+)([+?]?)\s*=\s*(\S.*)/) { $key = $1; $plus = $2; @@ -473,12 +475,10 @@ sub parse_makefile $loop = 0; foreach $key ( keys %vars ) { - while ( $vars{$key} =~ /\$\{([\w.]+)\}/ ) + $_ = parse_expand_vars($vars{$key}, \%vars); + if ( $_ ne $vars{$key} ) { - if (defined($vars{$1})) - { $vars{$key} = $`.$vars{$1}.$'; } - else - { $vars{$key} = $`.'UNDEFINED'.$'; } + $vars{$key} = $_; $loop = 1; } } @@ -587,7 +587,7 @@ sub pkglint_all_pkgsrc &safe_chdir("$pkgsrcdir/$cat"); if (! opendir(CAT, '.')) { die("Unable to opendir($pkgsrcdir/$cat): $!"); } - foreach $pkg ( grep(substr($_, 0, 1) ne '.', readdir(CAT) ) ) + foreach $pkg ( sort grep(substr($_, 0, 1) ne '.', readdir(CAT) ) ) { if (-f "$pkg/Makefile") { @@ -630,13 +630,17 @@ sub scan_pkgsrc_makefiles my(%depends); @categories = &list_pkgsrc_categories($pkgsrcdir); - &verbose("Scanning pkgsrc Makefiles: ".'_'x@categories."\b"x@categories); + &verbose("Scanning pkgsrc Makefiles: "); + if (!$opt{'L'}) + { &verbose('_'x@categories."\b"x@categories); } + else + { &verbose("\n"); } foreach $cat ( sort @categories ) { if (! opendir(CAT, "$pkgsrcdir/$cat")) { die("Unable to opendir($pkgsrcdir/$cat): $!"); } - foreach $pkgdir ( grep(substr($_, 0, 1) ne '.', readdir(CAT) ) ) + foreach $pkgdir ( sort grep(substr($_, 0, 1) ne '.', readdir(CAT) ) ) { my(%vars); ($pkgname, %vars) = @@ -653,13 +657,17 @@ sub scan_pkgsrc_makefiles } } close(CAT); - &verbose('.'); + if (!$opt{'L'}) + { &verbose('.'); } } - my ($len); - $_ = scalar(keys %pkgver2dir).' packages'; - $len = @categories - length($_); - &verbose("\b"x@categories, $_, ' 'x$len, "\b"x$len, "\n"); + if (!$opt{'L'}) + { + my ($len); + $_ = scalar(keys %pkgver2dir).' packages'; + $len = @categories - length($_); + &verbose("\b"x@categories, $_, ' 'x$len, "\b"x$len, "\n"); + } if ($check_depends) { @@ -699,7 +707,7 @@ sub scan_pkgsrc_distfiles_vs_md5 { if (! opendir(CAT, "$pkgsrcdir/$cat")) { die("Unable to opendir($pkgsrcdir/$cat): $!"); } - foreach $pkg ( grep(substr($_, 0, 1) ne '.', readdir(CAT) ) ) + foreach $pkg ( sort grep(substr($_, 0, 1) ne '.', readdir(CAT) ) ) { if (open(MD5, "$pkgsrcdir/$cat/$pkg/files/md5")) { @@ -798,6 +806,7 @@ opts: -p : List old/obsolete prebuilt packages. -r : Remove any 'bad' distfiles (Without -m, -o, or -p, implies all). + -L : List each Makefile when scanned -P path : Set PKGSRCDIR -K path : Set basedir for prebuild packages (default PKGSRCDIR/packages) -D [paths] : Parse Makefiles and output contents (For debugging) |