diff options
author | Joe Marcus Clarke <marcus@FreeBSD.org> | 2004-03-21 08:24:41 +0000 |
---|---|---|
committer | Joe Marcus Clarke <marcus@FreeBSD.org> | 2004-03-21 08:24:41 +0000 |
commit | 31441bb2d65db9bee2ea50490b9d4b666eb7806d (patch) | |
tree | 564b800bb4b701fdc8b2085074cdc9ab677d42aa /ports-mgmt/portlint/src | |
parent | - Update to version 0.9.3 (diff) |
Update to 2.5.9.
* Add code for formal master/slave checking rules as defined in ports/64393 [1]:
1. A port is a slave port if and only if MASTERDIR != .CURDIR
2. Slave ports should define MASTERDIR using one of the following lines:
MASTERDIR= ${.CURDIR}/../../<category>/<port>
MASTERDIR= ${.CURDIR}/../<port>
3. Non-slave ports shouldn't define MASTERDIR at all
4. The last line of a slave port's Makefile has to be
.include "${MASTERDIR}/Makefile"
5. The last line of a non-slave ports Makefile must be one of:
.include <bsd.port.mk>
.include <bsd.port.post.mk>
6. slave ports may not include bsd.port(.pre).mk
* Check to make sure MACHINE_ARCH is not defined and make sure it is never
tested directly [2]
* Fix some grammar nits [3]
PR: 64420 [1]
Submitted by: eik [1]
krion [3]
Requested by: kris [2]
Notes
Notes:
svn path=/head/; revision=104817
Diffstat (limited to 'ports-mgmt/portlint/src')
-rw-r--r-- | ports-mgmt/portlint/src/portlint.pl | 63 |
1 files changed, 47 insertions, 16 deletions
diff --git a/ports-mgmt/portlint/src/portlint.pl b/ports-mgmt/portlint/src/portlint.pl index 3225c91268d3..f89fc2352050 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.41 2004/03/10 06:25:06 marcus Exp $ +# $Id: portlint.pl,v 1.43 2004/03/21 07:31:33 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 = 8; +my $micro = 9; sub l { '[{(]'; } sub r { '[)}]'; } @@ -1046,16 +1046,6 @@ sub checkmakefile { } # - # whole file: anything after bsd.port(.post).mk - # - print "OK: checking for anything after bsd.port(.post).mk.\n" - if ($verbose); - if ($whole =~ /^\.include\s+<bsd\.port(?:\.post)?\.mk>\s*[^\s]/m) { - &perror("FATAL: $file: do not include anything after ". - "bsd.port(.post).mk."); - } - - # # whole file: USE_* as a user-settable option # print "OK: checking for USE_* as a user-settable option.\n" if ($verbose); @@ -1080,6 +1070,16 @@ sub checkmakefile { } # + # whole file: MACHINE_ARCH + # + print "OK: checking MACHINE_ARCH.\n" if ($verbose); + if ($whole =~ /\nMACHINE_ARCH/) { + my $lineno = &linenumber($`); + &perror("FATAL: $file [$lineno]: MACHINE_ARCH should never be ". + "overridden."); + } + + # # whole file: PKGNAME # print "OK: checking PKGNAME.\n" if ($verbose); @@ -1225,6 +1225,15 @@ pax perl printf rm rmdir ruby sed sh sort touch tr which xargs xmkmf } # + # whole file: ${MACHINE_ARCH} + # + if ($j =~ /\${MACHINE_ARCH}\s*[!=]=/) { + my $lineno = &linenumber($`); + &perror("FATAL: $file [$lineno]: MACHINE_ARCH should never be tested ". + "directly; use ARCH instead."); + } + + # # whole file: full path name # &abspathname($whole, $file); @@ -1274,14 +1283,36 @@ pax perl printf rm rmdir ruby sed sh sort touch tr which xargs xmkmf $slaveport = 1; print "OK: slave port detected, checking for inclusion of $masterdir/Makefile.\n" if ($verbose); - if ($whole !~ /\n\.include\s+[<"]\$\{MASTERDIR\}\/Makefile[">]\s*$/) { - &perror('FATAL: $file: the last line of a slave port\'s Makefile has to be'. + if ($whole =~ /^\.\s*include\s*[<"]bsd\.port(?:\.post)?\.mk[">]/m) { + &perror("FATAL: $file: supposedly non-slave port with". + " .CURDIR != MASTERDIR"); + } elsif ($whole =~ /^\.\s*include\s*[<"]bsd\.port\.pre\.mk[">]/m) { + &perror("FATAL: $file: slave ports may not include". + " bsd.port.pre.mk"); + } + if ($whole !~ /\n\.include\s+"\$\{MASTERDIR\}\/Makefile"\s*$/s) { + &perror("FATAL: $file: the last line of a slave port's Makefile has to be". ' .include "${MASTERDIR}/Makefile"'); } print "OK: checking master port in $masterdir.\n" if ($verbose); if (! -e "$masterdir/Makefile") { &perror("WARN: unable to locate master port in $masterdir"); } + if ($whole !~ /^MASTERDIR=\s*\$\{\.CURDIR\}(?:\/\.\.){1,2}(?:\/[\w\@.+-]+){1,2}\s*$/m) { + &perror("WARN: $file: slave ports must define MASTERDIR=". + '${.CURDIR}/..(/../<category>)/<port>'); + } + } else { + #$slaveport = 0; + print "OK: non-slave port detected, checking for anything after bsd.port(.post).mk.\n" + if ($verbose); + if ($whole !~ /\n\.include\s+<bsd\.port(?:\.post)?\.mk>\s*$/s) { + &perror("FATAL: $file: the last line of Makefile has to be". + ' .include <bsd.port(.post).mk>'); + } + if ($whole =~ /^MASTERDIR\s*[+?:!]?\s*=/m) { + &perror("WARN: $file: non-slave ports may not define MASTERDIR"); + } } # @@ -1555,10 +1586,10 @@ DISTFILES DIST_SUBDIR EXTRACT_ONLY "number"); } elsif ($portversion =~ /-/) { &perror("FATAL: $file: PORTVERSION should not contain a hyphen.". - "should modify \"$portversion\"."); + "You should modify \"$portversion\"."); } else { &perror("FATAL: $file: PORTVERSION looks illegal. ". - "should modify \"$portversion\"."); + "You should modify \"$portversion\"."); } |