From 2e9b5b73636b8a51987ac5c8413f20f5c7ea097d Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Tue, 12 Dec 2000 14:24:12 +0000 Subject: Update to version 2.3. - Conform to the new port layout, finally. - Use COMMENT, DESCR, PLIST, PKGINSTALL, PKGDEINSTALL, PKGREQ, PKGMESSAGE, SCRIPTDIR and PATCHDIR instead of hardcoded file/directory names. (suggested by will) - Fix maxchars checker that has been broken. - Fix "use ldconfig with ||/usr/bin/true" checker. (patch submitted by sobomax) - Fix "include the country code in the module alias name" warning. Besides, "country code" is corrected to "language code". - Add french and hebrew to the list of lang-specific categories. - Properly omit the checks against PORTNAME section etc. when the testee is a slave port. - Add "INSTALLS_SHLIB may be missing" checker which searches pkg-plist for `*.so' and `*.so.'. - Make it dynamically read bsd.sites.mk so that we no longer need to keep it always in sync with bsd.sites.mk. It now should recognize `/%SUBDIR%/' part too. - Change `split(/\s+/, "blah blah blah")' to `qw(blah blah blah)'. - Add some dummy comments that prevent Emacs' CPerl mode from confusing. - Add a condition "unless this is a master port" to the warnings that are specific to master ports, because currently we can't know if a port is a master port. Reviewed by: mharo (MAINTAINER) --- devel/portlint/Makefile | 2 +- devel/portlint/src/portlint.1 | 2 +- devel/portlint/src/portlint.pl | 405 +++++++++++++++++------------------------ 3 files changed, 164 insertions(+), 245 deletions(-) (limited to 'devel/portlint') diff --git a/devel/portlint/Makefile b/devel/portlint/Makefile index 48d9db6d675e..909a2aa30f28 100644 --- a/devel/portlint/Makefile +++ b/devel/portlint/Makefile @@ -8,7 +8,7 @@ # PORTNAME= portlint -PORTVERSION= 2.2.3.1 +PORTVERSION= 2.3 CATEGORIES= devel MASTER_SITES= # none DISTFILES= # none diff --git a/devel/portlint/src/portlint.1 b/devel/portlint/src/portlint.1 index d5c3f4e1615c..d6cd3ee12c18 100644 --- a/devel/portlint/src/portlint.1 +++ b/devel/portlint/src/portlint.1 @@ -38,7 +38,7 @@ especially when checking complex Perform additional checks for extra files, such as .Pa scripts/* and -.Pa pkg/* . +.Pa pkg-* . .It Fl b Warn the use of .Pa $(VARIABLE) . diff --git a/devel/portlint/src/portlint.pl b/devel/portlint/src/portlint.pl index ae8e4f662d4a..ac7ca31a3cf5 100644 --- a/devel/portlint/src/portlint.pl +++ b/devel/portlint/src/portlint.pl @@ -22,6 +22,7 @@ use vars qw/ $opt_a $opt_b $opt_c $opt_h $opt_t $opt_v $opt_M $opt_N $opt_B $opt_V /; use Getopt::Std; +use IPC::Open2; #use strict; my ($err, $warn); @@ -60,19 +61,25 @@ my $automan = 1; my $manchapters = '123456789ln'; my $localbase = '/usr/local'; -my @lang_cat = split(/\s+/, <); +close(MK); + +my $cmd = join(' -V MASTER_SITE_', "make $makeenv -f - all", @site_groups); + +my $i = 0; + +open2(IN, OUT, $cmd); + +print OUT <) { + my $g = $site_groups[$i]; + for my $s (split()) { + $predefined{$s} = $g; + } + $i++; } +close(IN); + # # check for files. # my @checker = ($makevar{COMMENT}, $makevar{DESCR}, 'Makefile', $makevar{MD5_FILE}); -my %checker = ($makevar{COMMENT}, 'checkdescr', $makevar{DESCR}, 'checkdescr', - 'Makefile', 'checkmakefile', $makevar{MD5_FILE}, 'TRUE'); +my %checker = ( + $makevar{COMMENT} => 'checkdescr', + $makevar{DESCR} => 'checkdescr', + 'Makefile' => 'checkmakefile', + $makevar{MD5_FILE} => 'TRUE' + ); if ($extrafile) { - foreach my $i ((, )) { + my @files = ( + <$makevar{SCRIPTDIR}/*>, + @makevar{COMMENT,DESCR,PLIST,PKGINSTALL,PKGDEINSTALL,PKGREQ,PKGMESSAGE} + ); + + foreach my $i (@files) { next if (! -T $i); next if (defined $checker{$i}); - if ($i =~ /pkg\/PLIST$/ - || ($multiplist && $i =~ /pkg\/PLIST/)) { + if ($i =~ /\bpkg-plist$/ + || ($multiplist && $i =~ /\bpkg-plist/)) { unshift(@checker, $i); $checker{$i} = 'checkplist'; } else { @@ -360,7 +261,7 @@ if ($extrafile) { } } } -foreach my $i () { +foreach my $i (<$makevar{PATCHDIR}/patch-*>) { next if (! -T $i); next if (defined $checker{$i}); push(@checker, $i); @@ -373,7 +274,7 @@ foreach my $i (@checker) { } else { my $proc = $checker{$i}; &$proc($i) || &perror("Cannot open the file $i\n"); - if ($i !~ /^patches\//) { + if ($i !~ /^files\/patch-/) { &checklastline($i) || &perror("Cannot open the file $i\n"); } @@ -402,7 +303,7 @@ if ($err || $warn) { exit $err; # -# pkg/COMMENT, pkg/DESCR +# pkg-comment, pkg-descr # sub checkdescr { my($file) = @_; @@ -415,9 +316,10 @@ sub checkdescr { open(IN, "< $file") || return 0; while () { - $linecnt++; - $longlines++ if ($maxchars{$file} < length(chomp($_))); $tmp .= $_; + chomp || &perror("WARN: $file should terminate in '\n'."); + $linecnt++; + $longlines++ if ($maxchars{$file} < length); } if ($linecnt > $maxlines{$file}) { &perror("WARN: $file $errmsg{$file}". @@ -434,7 +336,7 @@ sub checkdescr { "other local characters. $file should be ". "plain ascii file."); } - if ($file =~ m/DESCR/ && $tmp =~ m,http://,) { + if ($file =~ /\bpkg-descr/ && $tmp =~ m,http://,) { my $has_url = 0; my $has_www = 0; foreach my $line (grep($_ =~ "http://", split(/\n+/, $tmp))) { @@ -448,16 +350,16 @@ sub checkdescr { &perror("FATAL: $file: contains a URL but no WWW:"); } } - if ($file =~ m/COMMENT/) { - if (($tmp !~ /^["0-9A-Z]/) || ($tmp =~ m/\.$/)) { - &perror("WARN: pkg/COMMENT should begin with a capital, and end without a period"); + if ($file =~ /\bpkg-comment/) { + if (($tmp !~ /^["0-9A-Z]/) || ($tmp =~ m/\.$/)) { #" + &perror("WARN: pkg-comment should begin with a capital, and end without a period"); } } close(IN); } # -# pkg/PLIST +# pkg-plist # sub checkplist { my($file) = @_; @@ -501,22 +403,27 @@ sub checkplist { $inforemoveseen = $.; push(@unexec_info, $1); } elsif ($_ =~ /^\@(exec|unexec)/) { - if ($ldconfigwithtrue - && /ldconfig/ - && !/\/usr\/bin\/true/) { - &perror("FATAL: $file $.: ldconfig ". - "must be used with ". - "\"||/usr/bin/true\"."); + if (/ldconfig/) { + if ($ldconfigwithtrue + && !/\/usr\/bin\/true/) { + &perror("FATAL: $file $.: ldconfig ". + "must be used with ". + "\"||/usr/bin/true\"."); + } + &perror("WARN: $file $.: possible ". + "direct use of ldconfig ". + "in PLIST found. use ". + "INSTALLS_SHLIB instead."); } } elsif ($_ =~ /^\@(comment)/) { $rcsidseen++ if (/\$$rcsidstr[:\$]/); } elsif ($_ =~ /^\@(owner|group)\s/) { - &perror("WARN: \@$1 should not be needed in PLIST"); + &perror("WARN: \@$1 should not be needed in pkg-plist"); } elsif ($_ =~ /^\@(dirrm|option)/) { ; # no check made } else { &perror("WARN: $file $.: ". - "unknown PLIST directive \"$_\""); + "unknown pkg-plist directive \"$_\""); } next; } @@ -531,6 +438,11 @@ sub checkplist { "please use USE_LIBTOOL in Makefile if possible"); } + if ($_ =~ /\.so(\.\d+)?$/ && $makevar{INSTALLS_SHLIB} eq '') { + &perror("WARN: $file $.: installing shared libraries, ". + "please define INSTALLS_SHLIB as appropriate"); + } + if ($_ =~ /^info\/.*info(-[0-9]+)?$/) { $infoseen = $.; $infoafterinstall++ if ($infoinstallseen); @@ -591,10 +503,10 @@ sub checkplist { foreach my $if (@infofile) { next if ($if =~ m/info-/); if ($exec_install !~ m/\%D\/\Q$if\E/) { - &perror("FATAL: you need an '\@exec install-info \%D/$if \%D/info/dir' line in your PLIST"); + &perror("FATAL: you need an '\@exec install-info \%D/$if \%D/info/dir' line in your pkg-plist"); } if ($unexec_install !~ m/\%D\/$if/) { - &perror("FATAL: you need an '\@unexec install-info --delete \%D/$if \%D/info/dir' line in your PLIST"); + &perror("FATAL: you need an '\@unexec install-info --delete \%D/$if \%D/info/dir' line in your pkg-plist"); } } @@ -700,6 +612,7 @@ sub checkmakefile { my($i, $j, $k, $l); my @cat = (); my $has_lang_cat = 0; + my $lang_pref = ''; my $tmp; my $bogusdistfiles = 0; my @varnames = (); @@ -832,10 +745,10 @@ sub checkmakefile { # my %cmdnames = (); print "OK: checking direct use of command names.\n" if ($verbose); - foreach my $i (split(/\s+/, <