diff options
author | marcus <marcus@FreeBSD.org> | 2003-11-21 10:55:08 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2003-11-21 10:55:08 +0800 |
commit | ed90b96f7758b6d1af9be7d91d886335d16e0cfa (patch) | |
tree | b0b69ee864b4ee74b43eca2ff85966d797443179 /ports-mgmt/portlint | |
parent | 17ff3843bcf9caf1d65b350ffed5d5276df58e45 (diff) | |
download | freebsd-ports-gnome-ed90b96f7758b6d1af9be7d91d886335d16e0cfa.tar.gz freebsd-ports-gnome-ed90b96f7758b6d1af9be7d91d886335d16e0cfa.tar.zst freebsd-ports-gnome-ed90b96f7758b6d1af9be7d91d886335d16e0cfa.zip |
* Check to make sure new ports do not contain PORTREVISION [1]
* Check to make sure new ports do not contain PORTEPOCH
* Throw a FATAL error if an additional file exists in the port directory but
not in CVS [2]
* Throw a FATAL error if a file is in CVS but not in the port's directory [2]
* Throw a FATAL error if a file was deleted from CVS but still in the port's
directory [2]
* Warn if a new file contains a non-empty RCS Id [2]
* Add a missing ``if ($verbose)'' [2]
Submitted by: arved [1]
eik [2]
Diffstat (limited to 'ports-mgmt/portlint')
-rw-r--r-- | ports-mgmt/portlint/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/portlint/src/portlint.pl | 152 |
2 files changed, 150 insertions, 4 deletions
diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile index 5b788582c495..17015f6c40dc 100644 --- a/ports-mgmt/portlint/Makefile +++ b/ports-mgmt/portlint/Makefile @@ -8,7 +8,7 @@ # PORTNAME= portlint -PORTVERSION= 2.5.0 +PORTVERSION= 2.5.1 CATEGORIES= devel MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/portlint/src/portlint.pl b/ports-mgmt/portlint/src/portlint.pl index 671b150cf7b7..ab7169037998 100644 --- a/ports-mgmt/portlint/src/portlint.pl +++ b/ports-mgmt/portlint/src/portlint.pl @@ -17,7 +17,7 @@ # OpenBSD and NetBSD will be accepted. # # $FreeBSD$ -# $Id: portlint.pl,v 1.27 2003/11/17 20:00:17 marcus Exp $ +# $Id: portlint.pl,v 1.28 2003/11/21 02:52:52 marcus Exp $ # use vars qw/ $opt_a $opt_A $opt_b $opt_c $opt_h $opt_t $opt_v $opt_M $opt_N $opt_B $opt_V /; @@ -40,7 +40,7 @@ $portdir = '.'; # version variables my $major = 2; my $minor = 5; -my $micro = 0; +my $micro = 1; sub l { '[{(]'; } sub r { '[)}]'; } @@ -281,7 +281,7 @@ foreach my $i (<$makevar{PATCHDIR}/patch-*>) { $checker{$i} = 'checkpatch'; } foreach my $i (@checker) { - print "OK: checking $i.\n"; + print "OK: checking $i.\n" if ($verbose); if (! -f "$i") { &perror("FATAL: no $i in \"$portdir\".") unless $i eq $makevar{MD5_FILE} && $makevar{DISTFILES} eq ""; } else { @@ -343,6 +343,138 @@ if ($committer) { find(\&find_proc, '.'); + sub checksubdir { + my $dir = shift; + + print "OK: checking CVS status of \"$dir\".\n" if ($verbose); + opendir DIR, $dir; + my @filenames = readdir DIR; + closedir DIR; + + my %entries; + if (-f "$dir/CVS/Entries") { + open ENTRIES, "<$dir/CVS/Entries"; + while (<ENTRIES>) { + chomp; + my @entry = split /\//; + if ($entry[0] eq 'D') { + $entries{ $entry[1] } = $entry[0] + if $entry[1]; + } + elsif ($entry[0] eq '') { + if ($entry[2] =~ /^-/) { + $entries{ $entry[1] } = 'x'; + } + elsif ($entry[2] eq '0') { + $entries{ $entry[1] } = 'n'; + } + else { + $entries{ $entry[1] } = 'f'; + } + } + else { + &perror("WARN: can not parse CVS line $_"); + } + } + close ENTRIES; + } else { + &perror("WARN: no CVS directories. Use -n to check a new port."); + return; + } + + if (-f "$dir/CVS/Entries.Log") { + open ENTRIES, "<$dir/CVS/Entries.Log"; + while (<ENTRIES>) { + chomp; + my $cmd; + my @entry = split /\//; + if (/^(.) (.*)$/) { + $cmd = $1; + @entry = split /\//, $2; + } + else { + $cmd = 'A'; + @entry = split /\//; + } + if ($cmd eq 'A') { + if ($entry[0] eq 'D') { + $entries{ $entry[1] } = $entry[0] + if $entry[1]; + } + elsif ($entry[0] eq '') { + if ($entry[2] =~ /^-/) { + $entries{ $entry[1] } = 'x'; + } + elsif ($entry[2] eq '0') { + $entries{ $entry[1] } = 'n'; + } + else { + $entries{ $entry[1] } = 'f'; + } + } + else { + &perror("WARN: can not parse CVS line $_"); + } + } + elsif ($cmd eq 'R') { + delete $entries{ $entry[1] } + if $entry[1]; + } + # ignore unknown commands + } + close ENTRIES; + } + + foreach (@filenames) { + next + if /^(?:\.\.?|CVS)$/; + my $filename = $dir eq '.' ? $_ : "$dir/$_"; + if (-d $filename) { + if (!$entries{$_} || $entries{$_} ne 'D') { + &perror("FATAL: directory $filename not in CVS."); + } + else { + delete $entries{$_}; + checksubdir($filename); + } + } + else { + if (!$entries{$_}) { + &perror("FATAL: file $filename not in CVS."); + } + elsif ($entries{$_} eq 'D') { + &perror("FATAL: file $filename is a directory in CVS."); + } + elsif ($entries{$_} eq 'x') { + &perror("FATAL: file $filename is deleted in CVS."); + } + elsif ($entries{$_} eq 'n') { + if (!system("egrep", "-q", "\\\$$rcsidstr\[^\$\]+\\\$", $filename)) { + &perror("WARN: RCS tag \"\$$rcsidstr\$\" ". + "should be empty in new file $filename."); + } + delete $entries{$_}; + } + else { + delete $entries{$_}; + } + } + } + + while (my ($file, $type) = each %entries) { + next if $type eq 'x'; + if ($type eq 'D') { + &perror("FATAL: CVS directory $dir/$file missing"); + } + else { + &perror("FATAL: CVS file $dir/$file missing"); + } + } + } + + checksubdir('.') + unless $newport; + # Check for ports that may break INDEX my $indexerr = `env LOCALBASE=/nonexistentlocal X11BASE=/nonexistentx make $makeenv describe 2>&1 >/dev/null`; chomp $indexerr; @@ -1235,6 +1367,20 @@ DISTFILES DIST_SUBDIR EXTRACT_ONLY &perror("WARN: unless this is a master port, PORTVERSION has to be set by \"=\", ". "not by \"$1=\".") unless ($masterport); } + if ($newport) { + print "OK: checking for existence of PORTREVISION in new port.\n" + if ($verbose); + if ($tmp =~ /^PORTREVISION(.)?=/m) { + &perror("WARN: new ports should not set PORTREVISION."); + } + } + if ($newport) { + print "OK: checking for existence of PORTEPOCH in new port.\n" + if ($verbose); + if ($tmp =~ /^PORTEPOCH(.)?=/m) { + &perror("WARN: new ports should not set PORTEPOCH."); + } + } print "OK: checking CATEGORIES.\n" if ($verbose); if ($tmp !~ /\nCATEGORIES(.)?=/) { &perror("FATAL: CATEGORIES has to be there.") unless ($slaveport && $makevar{CATEGORIES} ne ''); |