From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Jun 16 11:50:19 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 782D216A41C for ; Thu, 16 Jun 2005 11:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4429A43D55 for ; Thu, 16 Jun 2005 11:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j5GBoJ7V058214 for ; Thu, 16 Jun 2005 11:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j5GBoJFA058212; Thu, 16 Jun 2005 11:50:19 GMT (envelope-from gnats) Resent-Date: Thu, 16 Jun 2005 11:50:19 GMT Resent-Message-Id: <200506161150.j5GBoJFA058212@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sergey Matveychuk Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1CD6216A41C; Thu, 16 Jun 2005 11:44:44 +0000 (GMT) (envelope-from sem@fog.mbrd.ru) Received: from fog.mbrd.ru (fog-mtu.mbrd.ru [195.34.35.73]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D67C43D1F; Thu, 16 Jun 2005 11:44:42 +0000 (GMT) (envelope-from sem@fog.mbrd.ru) Received: from sem by fog.mbrd.ru with local (Exim 4.51 (FreeBSD)) id 1DisnY-0002ru-WB; Thu, 16 Jun 2005 15:44:41 +0400 Message-Id: Date: Thu, 16 Jun 2005 15:44:40 +0400 From: Sergey Matveychuk Sender: Sergey Matveychuk To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: marcus@FreeBSD.org Subject: ports/82316: [PATCH] devel/portlint: prevent use options before bsd.port.pre.mk included X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2005 11:50:19 -0000 >Number: 82316 >Category: ports >Synopsis: [PATCH] devel/portlint: prevent use options before bsd.port.pre.mk included >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Thu Jun 16 11:50:18 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Sergey Matveychuk >Release: FreeBSD 5.4-RELEASE i386 >Organization: >Environment: System: FreeBSD fog.mbrd.ru 5.4-RELEASE FreeBSD 5.4-RELEASE #5: Wed May 11 14:22:55 MSD 2005 >Description: I often see a mistake when contributors try to check OPTIONS values before bsd.port.pre.mk included. The patch checks this situation and show a fatal error. It works only when OPTIONS defined. Port maintainer (marcus@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.63 >How-To-Repeat: >Fix: --- portlint-2.7.2.patch begins here --- Index: Makefile =================================================================== RCS file: /home/pcvs/ports/devel/portlint/Makefile,v retrieving revision 1.91 diff -u -u -r1.91 Makefile --- Makefile 16 Apr 2005 19:01:15 -0000 1.91 +++ Makefile 16 Jun 2005 11:42:25 -0000 @@ -8,8 +8,7 @@ # PORTNAME= portlint -PORTVERSION= 2.7.1 -PORTREVISION= 1 +PORTVERSION= 2.7.2 CATEGORIES= devel MASTER_SITES= # none DISTFILES= # none Index: src/portlint.pl =================================================================== RCS file: /home/pcvs/ports/devel/portlint/src/portlint.pl,v retrieving revision 1.72 diff -u -u -r1.72 portlint.pl --- src/portlint.pl 16 Apr 2005 19:01:15 -0000 1.72 +++ src/portlint.pl 16 Jun 2005 11:42:25 -0000 @@ -937,6 +937,7 @@ my $useindex = 0; my %deprecated = (); my %autocmdnames = (); + my $pre_mk_line=0; open(IN, "< $file") || return 0; $rawwhole = ''; @@ -1067,6 +1068,8 @@ # pos($whole) = 0; if ($whole =~ /^\.include\s+$/gm) { + # remember position + $pre_mk_line = &linenumber($`)+1; print "OK: checking for USE_* used too late.\n" if ($verbose); my @use_early = qw( APACHE @@ -1102,6 +1105,35 @@ } # + # whole file: check OPTIONS + # + pos($whole) = 0; + print "OK: checking OPTIONS.\n" if ($verbose); + @oopt = ($makevar{OPTIONS} =~ /(\w+)\s+\".*?\"\s+\w+/sg); + while ($whole =~ /\n[^#\n]*?\(?\s*WITH(?:OUT)?_(\w+)\s*\)?/mg) { + push @mopt, $1; + my $lineno = &linenumber($`)+1; + &perror("FATAL: $file [$lineno]: option WITH(OUT)_$1 is used before ". + "including bsd.port.pre.mk.") + if(scalar(@oopt) && $lineno < $pre_mk_line); + } + foreach my $i (@oopt) { + if (!grep(/^$i$/, @mopt)) { + &perror("WARN: $file: $i is listed in OPTIONS, ". + "but neither WITH_$i nor WITHOUT_$i appears."); + } + } + foreach my $i (@mopt) { + next if ($i eq 'NLS'); # skip WITHOUT_NLS + if (!grep(/^$i$/, @oopt)) { + # XXX: disabled temporarily. + # OPTIONS is still "in flux" + #&perror("WARN: $file: WITH_$i or WITHOUT_$i appears, ". + # "consider using OPTIONS macro."); + } + } + + # # whole file: USE_* as a user-settable option # print "OK: checking for USE_* as a user-settable option.\n" if ($verbose); @@ -2396,26 +2428,6 @@ "defining USE_ANT"); } - # check OPTIONS - print "OK: checking OPTIONS.\n" if ($verbose); - @oopt = ($makevar{OPTIONS} =~ /(\w+)\s+\".*?\"\s+\w+/sg); - @mopt = ($tmp =~ /\(?\s*WITH(?:OUT)?_(\w+)\s*\)?/mg); - foreach my $i (@oopt) { - if (!grep(/^$i$/, @mopt)) { - &perror("WARN: $file: $i is listed in OPTIONS, ". - "but neither WITH_$i nor WITHOUT_$i appears."); - } - } - foreach my $i (@mopt) { - next if ($i eq 'NLS'); # skip WITHOUT_NLS - if (!grep(/^$i$/, @oopt)) { - # XXX: disabled temporarily. - # OPTIONS is still "in flux" - #&perror("WARN: $file: WITH_$i or WITHOUT_$i appears, ". - # "consider using OPTIONS macro."); - } - } - 1; } --- portlint-2.7.2.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: