diff options
author | Joe Marcus Clarke <marcus@FreeBSD.org> | 2003-11-21 02:55:08 +0000 |
---|---|---|
committer | Joe Marcus Clarke <marcus@FreeBSD.org> | 2003-11-21 02:55:08 +0000 |
commit | 22030dac05c553c07644f8f3f5fa0e07850bcbe6 (patch) | |
tree | 4bb9fdb2b1d6a5a105226f318e96788f77edbe44 /ports-mgmt | |
parent | 5e2f128ab9ae657ac21afef67c4da5ce41b363ed (diff) | |
download | ports-22030dac05c553c07644f8f3f5fa0e07850bcbe6.tar.gz ports-22030dac05c553c07644f8f3f5fa0e07850bcbe6.zip |
Notes
Diffstat (limited to 'ports-mgmt')
-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 ''); |