diff options
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/pkglint/files/lintpkgsrc.pl | 37 |
2 files changed, 27 insertions, 14 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index d01cbd23bd8..31f32757b20 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.42 2000/02/03 12:05:20 abs Exp $ +# $NetBSD: Makefile,v 1.43 2000/02/07 11:38:53 abs Exp $ # -DISTNAME= pkglint-2.01 +DISTNAME= pkglint-2.02 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl index da627905d9a..e1885812963 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.21 2000/02/03 12:05:21 abs Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.22 2000/02/07 11:38:54 abs Exp $ # Written by David Brownlee <abs@netbsd.org>. # @@ -13,6 +13,9 @@ # The 'invalid distfiles' code picks up a couple of false positives in # fastcap (which does strange things anyway). +printf("%d\n", deweycmp(@ARGV)); +exit; + $^W = 1; use strict; use Getopt::Std; @@ -168,26 +171,39 @@ sub check_prebuilt_packages # Dewey decimal verson number matching - or thereabouts # Also handles 'nb<N>' suffix (checked iff values otherwise identical) # -sub dewey_cmp +sub deweycmp { my($match, $test, $val) = @_; - my($cmp, @matchlist, @vallist, $match_nb, $val_nb); + my($cmp, $match_nb, $val_nb); $match_nb = $val_nb = 0; - if ($match =~ /(.*)nb(\d+)/) # Handle nb<N> suffix + if ($match =~ /(.*)nb(.*)/) # Handle nb<N> suffix { $match = $1; $match_nb = $2; } - @matchlist = split(/\D+/, $match); - if ($val =~ /(.*)nb(\d+)/) # Handle nb<N> suffix + if ($val =~ /(.*)nb(.*)/) # Handle nb<N> suffix { $val = $1; $val_nb = $2; } - @vallist = split(/\D+/, $val); + $cmp = deweycmp_extract($match, $val); + + if (!$cmp) # Iff otherwise identical, check nb suffix + { $cmp = deweycmp_extract($match_nb, $val_nb); } + + eval "$cmp $test 0"; + } + +sub deweycmp_extract + { + my($match, $val) = @_; + my($cmp, @matchlist, @vallist); + + @matchlist = split(/\D+/, $match); + @vallist = split(/\D+/, $val); $cmp = 0; while( ! $cmp && (@matchlist || @vallist)) { @@ -198,12 +214,9 @@ sub dewey_cmp else { $cmp = (shift @matchlist <=> shift @vallist) } } - if (!$cmp) # Iff otherwise identical, check nb suffix - { $cmp = $match_nb <=> $val_nb; } - eval "$cmp $test 0"; + $cmp; } - sub fail { print STDERR @_, "\n"; exit(3); } @@ -353,7 +366,7 @@ sub package_globmatch { $matchver = "invalid-dewey($test$matchver)"; } elsif (defined($ver = $pkg2ver{$pkg})) { - if ( dewey_cmp($ver, $test, $matchver) ) + if ( deweycmp($ver, $test, $matchver) ) { $matchver = undef; } else { $matchver = "$test$matchver"; } |