ports/64420: [PATCH] devel/portlint: check for proper master-slave Makefile handling
Oliver Eikemeier
eikemeier at fillmore-labs.com
Thu Mar 18 13:40:23 UTC 2004
>Number: 64420
>Category: ports
>Synopsis: [PATCH] devel/portlint: check for proper master-slave Makefile handling
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Mar 18 05:40:22 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Oliver Eikemeier
>Release: FreeBSD 4.9-STABLE i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 4.9-STABLE
>Description:
This patch updates portlint to check for the rules formulated in PR 64393,
refer to this PR for some rationale.
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
>How-To-Repeat:
These are detected as follows:
1.) is flagged FATAL, check with
/usr/local/share/examples/portlint/portlintgrep 'CURDIR != MASTERDIR'
2.) and 3.) are flagged WARN, check with
/usr/local/share/examples/portlint/portlintgrep 'define MASTERDIR'
4.) and 5.) are flagged FATAL, check with
/usr/local/share/examples/portlint/portlintgrep 'last line of'
6.) is flagged FATAL, part of the is seen as violating 1.), check with
/usr/local/share/examples/portlint/portlintgrep 'may not include'
>Fix:
bump PORTVERSION and apply the following patch:
--- devel/portlint/src/portlint.pl Wed Mar 10 11:43:45 2004
+++ devel/portlint/src/portlint.pl Thu Mar 18 14:11:25 2004
@@ -1046,16 +1046,6 @@
}
#
- # 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);
@@ -1274,13 +1264,35 @@
$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");
}
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list