From 31441bb2d65db9bee2ea50490b9d4b666eb7806d Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Sun, 21 Mar 2004 08:24:41 +0000 Subject: [PATCH] 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}/../..// MASTERDIR= ${.CURDIR}/../ 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 .include 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] --- devel/portlint/Makefile | 2 +- devel/portlint/src/portlint.pl | 63 +++++++++++++++++++++-------- ports-mgmt/portlint/Makefile | 2 +- ports-mgmt/portlint/src/portlint.pl | 63 +++++++++++++++++++++-------- 4 files changed, 96 insertions(+), 34 deletions(-) diff --git a/devel/portlint/Makefile b/devel/portlint/Makefile index fd3b156d5583..809b4852e6fa 100644 --- a/devel/portlint/Makefile +++ b/devel/portlint/Makefile @@ -8,7 +8,7 @@ # PORTNAME= portlint -PORTVERSION= 2.5.8 +PORTVERSION= 2.5.9 CATEGORIES= devel MASTER_SITES= # none DISTFILES= # none diff --git a/devel/portlint/src/portlint.pl b/devel/portlint/src/portlint.pl index 3225c91268d3..f89fc2352050 100644 --- a/devel/portlint/src/portlint.pl +++ b/devel/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 { '[)}]'; } @@ -1045,16 +1045,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+\s*[^\s]/m) { - &perror("FATAL: $file: do not include anything after ". - "bsd.port(.post).mk."); - } - # # whole file: USE_* as a user-settable option # @@ -1079,6 +1069,16 @@ sub checkmakefile { "it is intended to be a user variable."); } + # + # 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 # @@ -1224,6 +1224,15 @@ pax perl printf rm rmdir ruby sed sh sort touch tr which xargs xmkmf "\"-p\" by default."); } + # + # 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 # @@ -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}/..(/../)/'); + } + } 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+\s*$/s) { + &perror("FATAL: $file: the last line of Makefile has to be". + ' .include '); + } + 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\"."); } diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile index fd3b156d5583..809b4852e6fa 100644 --- a/ports-mgmt/portlint/Makefile +++ b/ports-mgmt/portlint/Makefile @@ -8,7 +8,7 @@ # PORTNAME= portlint -PORTVERSION= 2.5.8 +PORTVERSION= 2.5.9 CATEGORIES= devel MASTER_SITES= # none DISTFILES= # none 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 { '[)}]'; } @@ -1045,16 +1045,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+\s*[^\s]/m) { - &perror("FATAL: $file: do not include anything after ". - "bsd.port(.post).mk."); - } - # # whole file: USE_* as a user-settable option # @@ -1079,6 +1069,16 @@ sub checkmakefile { "it is intended to be a user variable."); } + # + # 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 # @@ -1224,6 +1224,15 @@ pax perl printf rm rmdir ruby sed sh sort touch tr which xargs xmkmf "\"-p\" by default."); } + # + # 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 # @@ -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}/..(/../)/'); + } + } 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+\s*$/s) { + &perror("FATAL: $file: the last line of Makefile has to be". + ' .include '); + } + 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\"."); }