DragonFly BSD
DragonFly bugs List (threaded) for 2005-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Problem with bsd.ports.mk


From: YONETANI Tomokazu <qhwt+dfly@xxxxxxxxxx>
Date: Thu, 24 Feb 2005 02:22:36 +0900

On Wed, Feb 23, 2005 at 04:31:18PM +0100, Joerg Sonnenberger wrote:
> On Wed, Feb 23, 2005 at 11:32:40PM +0900, YONETANI Tomokazu wrote:
> > I just committed a fix for libtool15, which was using <bsd.port.mk>
> > instead of <bsd.dfport.mk>. I also tried adding a pre-commit check
> > for this, but ran out of idea.
> 
> Thanks for fixing that. Why doesn't '^\.include.*bsd.port' as reject
> regex work?

Yes, below should work, but it can bark on false positives, for example
(not sure if such a thing is possible though):
. if DragonFly
. include <bsd.dfport.foo.mk>
. else
. include <bsd.port.foo.mk>
. endif

Index: commit_prep.pl
===================================================================
RCS file: /home/source/dragonfly/cvs/CVSROOT/commit_prep.pl,v
retrieving revision 1.1
diff -u -r1.1 commit_prep.pl
--- commit_prep.pl	28 Jul 2003 19:33:14 -0000	1.1
+++ commit_prep.pl	23 Feb 2005 17:10:56 -0000
@@ -212,6 +212,24 @@
 	return(0);
 }
 
+sub check_dfport_makefile {
+	my ($file, $directory) = @_;
+	my $bad_includes = 0;
+
+	open FILE, $file or die "Cannot open $file, stopped\n";
+	my $line_number = 0;
+	while (<FILE>) {
+		++$line_number;
+		if (/^\.include\s+[<"]bsd\.port/) {
+			printf("%s - use <bsd.dfport.*.mk> instead(line %d)\n",
+			    "$directory/$file", $line_number);
+			$bad_includes = 1;
+			last;
+		}
+	}
+	close FILE;
+	return($bad_includes);
+}
 
 # Do file fixups, i.e. replacing $ Id: .* $ with $ Id $.
 sub fix_up_file {
@@ -295,6 +313,12 @@
 
 		# Unexpand the rcsid if required.
 		fix_up_file($arg) if $cfg::UNEXPAND_RCSID and !$failed;
+
+		# do not allow <bsd.port*.mk> to be used in dfports Makefiles
+		if ($directory =~ m,^dfports/[^/]+/[^/]+,
+		    && $arg =~ m,Makefile,) {
+			$failed += check_dfport_makefile($arg, $directory);
+		}
 	}
 	if ($failed and not $cfg::WARN_HEADERS) {
 		print "\n";



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]