From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Jun 5 18:10:00 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B650984E for ; Wed, 5 Jun 2013 18:10:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 980A618E4 for ; Wed, 5 Jun 2013 18:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r55IA0fa095745 for ; Wed, 5 Jun 2013 18:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r55IA0mS095744; Wed, 5 Jun 2013 18:10:00 GMT (envelope-from gnats) Resent-Date: Wed, 5 Jun 2013 18:10:00 GMT Resent-Message-Id: <201306051810.r55IA0mS095744@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, Alex Kozlov Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B0D1E689 for ; Wed, 5 Jun 2013 18:07:01 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) by mx1.freebsd.org (Postfix) with ESMTP id A17CE18B1 for ; Wed, 5 Jun 2013 18:07:01 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r55I70Fe003268 for ; Wed, 5 Jun 2013 18:07:00 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r55I7057003166; Wed, 5 Jun 2013 18:07:00 GMT (envelope-from nobody) Message-Id: <201306051807.r55I7057003166@oldred.freebsd.org> Date: Wed, 5 Jun 2013 18:07:00 GMT From: Alex Kozlov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/179338: [patch] ports-mgmt/portlint various improvements X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 18:10:00 -0000 >Number: 179338 >Category: ports >Synopsis: [patch] ports-mgmt/portlint various improvements >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jun 05 18:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Alex Kozlov >Release: RELENG_10 >Organization: private >Environment: >Description: - Add check for misspelled (wrong) PORT_OPTIONS - Change 'Use USE_PKGCONFIG instead.' to 'Use USES+= pkgconfig instead.' - Add check for ${TRUE}/${FALSE} in DESKTOP_ENTRIES - Remove CDRTOOLS check - Remove USE_REINPLACE check, it was deprecated 6+ years ago - Remove USE_GETOPT_LONG check, it was deprecated 6+ years ago - Remove old OPTIONS support - Modify USE_GETTEXT -> USES gettext - Remove WITHOUT_NLS check - Relax headers check for $FreeBSD$ + $MCom$ case >How-To-Repeat: >Fix: Patch attached with submission follows: - Add check for misspelled (wrong) PORT_OPTIONS - Change 'Use USE_PKGCONFIG instead.' to 'Use USES+= pkgconfig instead.' - Add check for ${TRUE}/${FALSE} in DESKTOP_ENTRIES - Remove CDRTOOLS check - Remove USE_REINPLACE check, it was deprecated 6+ years ago - Remove USE_GETOPT_LONG check, it was deprecated 6+ years ago - Remove old OPTIONS support - Modify USE_GETTEXT -> USES gettext - Remove WITHOUT_NLS check - Relax headers check for $FreeBSD$ + $MCom$ case Index: portlint @@ -196,7 +196,7 @@ PKGDIR COMMENT DESCR PLIST PKGCATEGORY PKGINSTALL PKGDEINSTALL PKGREQ PKGMESSAGE DISTINFO_FILE .CURDIR USE_LDCONFIG USE_AUTOTOOLS USE_GNOME INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION PKGINSTALLVER - PLIST_FILES OPTIONS OPTIONS_DEFINE INSTALLS_OMF USE_GETTEXT USE_RC_SUBR + PLIST_FILES OPTIONS_DEFINE INSTALLS_OMF USE_RC_SUBR USES DIST_SUBDIR ALLFILES IGNOREFILES CHECKSUM_ALGORITHMS INSTALLS_ICONS GNU_CONFIGURE CONFIGURE_ARGS MASTER_SITE_SUBDIR LICENSE LICENSE_COMB ); @@ -705,7 +705,7 @@ if ($_ =~ /charset\.alias$/ || $_ =~ /locale\.alias$/) { &perror("WARN", $file, $., "installing charset.alias or locale.alias, ". - "please add USE_GETTEXT=yes and use libintl from devel/gettext ". + "please add USES[+]=gettext and use libintl from devel/gettext ". "instead of from outdated bundled one if possible. ". "See http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71531 ". "for more details."); @@ -745,9 +745,9 @@ "for more details)"); } - if ($_ =~ m|\.mo$| && $makevar{USE_GETTEXT} eq '') { + if ($_ =~ m|\.mo$| && $makevar{USES} !~ /\bgettext\b/) { &perror("WARN", $file, $., "installing gettext translation files, ". - "please define USE_GETTEXT as appropriate"); + "please define USES[+]=gettext as appropriate."); } if ($_ =~ m|\.core$| && $_ !~ /^\@/) { @@ -1128,11 +1128,11 @@ "USE_ICONV."); } - # check USE_GETTEXT + # check USES=gettext if ($m{'dep'} =~ /^(intl\.\d+)$/) { &perror("WARN", $file, -1, "dependency to $1 ". "listed in $j. consider using ". - "USE_GETTEXT."); + "USES[+]=gettext."); } # check USE_GMAKE @@ -1156,13 +1156,6 @@ "USE_LIBLTDL."); } - # check CDRTOOLS - if ($m{'dir'} =~ /(cdrtools|cdrtools-cjk)$/) { - &perror("WARN", $file, -1, "dependency to $1 ". - "listed in $j. consider using ". - "USE_CDRTOOLS."); - } - # check GHOSTSCRIPT if ($m{'dep'} eq "gs") { &perror("WARN", $file, -1, "dependency to gs ". @@ -1245,7 +1238,6 @@ my($realwrksrc, $wrksrc, $nowrksubdir) = ('', '', ''); my(@mman, @pman); my(@mopt, @oopt); - my(@nmopt, @noopt); my($pkg_version, $versiondir, $versionfile) = ('', '', ''); my $useindex = 0; my %deprecated = (); @@ -1254,8 +1246,7 @@ my $pre_mk_line = 0; my $options_mk_line = 0; my $docsused = 0; - my $nlsused = 0; - my $newoptused = 0; + my $desktop_entries = (); open(IN, "< $file") || return 0; $rawwhole = ''; @@ -1342,6 +1333,8 @@ #&perror("FATAL", $file, 3, "do not add extra ". # "empty comments after header."); } + # special case for $rcsidsrt\n$MCom$ + } elsif ($lines[1] =~ /^# \$$rcsidstr[:\$]/ and $lines[2] =~ /^#\s+\$MCom[:\$]/ and $lines[3] =~ /^$/) { } elsif ($lines[1] !~ /^# \$$rcsidstr[:\$]/ or $lines[2] !~ /^$/) { &perror("FATAL", $file, 1, "incorrect header; ". "use Created by: with a single space, then \$$rcsidstr\$."); @@ -1430,7 +1423,6 @@ # whole file: USE_* and others variables used too late # my @options_early = qw( - OPTIONS OPTIONS_DEFAULT OPTIONS_DEFINE OPTIONS_EXCLUDE @@ -1494,63 +1486,41 @@ } } + @oopt = split(/\s+/, $makevar{OPTIONS_DEFINE}); pos($whole) = 0; - if ($whole =~ /\nOPTIONS_DEFINE[+?]?=/) { - $newoptused++; - } - @oopt = ($makevar{OPTIONS} =~ /(\w+)\s+\".*?\"\s+\w+/sg); - @noopt = split(/\s+/, $makevar{OPTIONS_DEFINE}); - if (scalar(@oopt) && $newoptused) { - &perror("FATAL", $file, -1, "Both old and new OPTIONS are found. ". - "Remove one or another."); - } - if (scalar(@oopt)) { - &perror("WARN", $file, -1, "Use of OPTIONS is obsolete. Use the ". - "new options framework."); - } - pos($whole) = 0; - while ($whole =~ /\(?\s*WITH(?:OUT)?_(\w+)\s*\)?/mg) { + while ($whole =~ /PORT_OPTIONS:M(\w+)/mg) { push @mopt, $1; my $lineno = &linenumber($`) + 1; - &perror("FATAL", $file, $lineno, "option WITH(OUT)_$1 is used before ". + &perror("FATAL", $file, $lineno, "option $1 is used before ". "including bsd.port.pre.mk or bsd.port.options.mk.") - if (scalar(@oopt) && $lineno < $pre_mk_line && - $lineno < $options_mk_line); + if (scalar(@oopt) && $lineno < $pre_mk_line && + $lineno < $options_mk_line); } foreach my $i (@oopt) { if (!grep(/^$i$/, @mopt)) { - &perror("WARN", $file, -1, "$i is listed in OPTIONS, ". - "but neither WITH_$i nor WITHOUT_$i appears."); - } - } - if ($newoptused) { - pos($whole) = 0; - while ($whole =~ /PORT_OPTIONS:M(\w+)/mg) { - push @nmopt, $1; - my $lineno = &linenumber($`) + 1; - &perror("FATAL", $file, $lineno, "option $1 is used before ". - "including bsd.port.pre.mk or bsd.port.options.mk.") - if ($newoptused && $lineno < $pre_mk_line && - $lineno < $options_mk_line); - } - foreach my $i (@noopt) { - if (!grep(/^$i$/, @nmopt)) { - &perror("WARN", $file, -1, "$i is listed in OPTIONS_DEFINE, ". - "but no PORT_OPTIONS:M$i appears."); - } + &perror("WARN", $file, -1, "$i is listed in OPTIONS_DEFINE, ". + "but no PORT_OPTIONS:M$i appears."); } } foreach my $i (@mopt) { - next if ($i eq 'NLS'); # skip WITHOUT_NLS if (!grep(/^$i$/, @oopt)) { - # XXX: disable temporarily. - # OPTIONS is still "in flux" - #&perror("WARN: $file: WITH_$i or WITHOUT_$i appears, ". - # "consider using OPTIONS macro."); + # skip global options + next if ($i eq 'DOCS' or $i eq 'NLS' or $i eq 'EXAMPLES' or $i eq 'IPV6'); + &perror("WARN", $file, -1, "$i is appears in PORT_OPTIONS:M, ". + "but not listed in OPTIONS_DEFINE." ); } } # + # whole file: check DESKTOP_ENTRIES for ${TRUE}/${FALSE} + # + print "OK: checking DESKTOP_ENTRIES for \${TRUE}/\${FALSE}.\n" if ($verbose); + $desktop_entries = &get_makevar_raw('DESKTOP_ENTRIES'); + if ($desktop_entries =~ /\${TRUE}/ or $desktop_entries =~ /\${FALSE}/) { + &perror("FATAL", $file, -1, "Use true/false instead of \${TRUE}/\${FALSE} in DESKTOP_ENTRIES."); + } + + # # whole file: USE_* as a user-settable option # print "OK: checking for USE_* as a user-settable option.\n" if ($verbose); @@ -1641,16 +1611,6 @@ } # - # whole file: USE_REINPLACE - # - print "OK: checking for USE_REINPLACE.\n" if ($verbose); - if ($whole =~ /\nUSE_REINPLACE.?=/) { - my $lineno = &linenumber($`); - &perror("WARN", $file, $lineno, "USE_REINPLACE is now obsolete. ". - "You can safely use REINPLACE_CMD without it."); - } - - # # whole file: MAKE_JOBS_[UN]SAFE # print "OK: checking for MAKE_JOBS_SAFE in combination with NO_BUILD.\n" if ($verbose); @@ -1665,22 +1625,12 @@ } # - # whole file: USE_GETOPT_LONG - # - print "OK: checking for USE_GETOPT_LONG.\n" if ($verbose); - if ($whole =~ /\nUSE_GETOPT_LONG.?=/) { - my $lineno = &linenumber($`); - &perror("WARN", $file, $lineno, "USE_GETOPT_LONG is now obsolete. ". - "You can safely remove this macro from your Makefile."); - } - - # # whole file: USE_GNOME=pkgconfig # print "OK: checking for USE_GNOME=pkgconfig.\n" if ($verbose); if ($makevar{USE_GNOME} =~ /pkgconfig/) { &perror("WARN", $file, -1, "USE_GNOME=pkgconfig is now obsolete. ". - "Use USE_PKGCONFIG instead."); + "Use USES[+]= pkgconfig instead."); } # @@ -1740,28 +1690,16 @@ if ($whole =~ /NOPORTDOCS/) { my $lineno = &linenumber($`); &perror("WARN", $file, $lineno, "NOPORTDOCS found. Consider ". - "using PORT_OPTIONS:MDOCS"); + "using PORT_OPTIONS:MDOCS."); } # - # whole file: check for USE_GETTEXT + # whole file: check for USES=gettext # - print "OK: checking for USE_GETTEXT without PORT_OPTIONS:MNLS.\n" if ($verbose); - if ($whole =~ /\nUSE_GETTEXT/ && $whole =~ /PORT_OPTIONS:MNLS/) { - $nlsused++; - } - print "OK: checking for USE_GETTEXT without WITHOUT_NLS.\n" if ($verbose); - if ($whole =~ /\nUSE_GETTEXT/ && $whole !~ /def(?:ined)?\s*\(?WITHOUT_NLS\)?/) { - if ($nlsused == 0) { - &perror("WARN", $file, -1, "Consider adding support for a WITHOUT_NLS ". - "knob to conditionally disable gettext support."); - } - } else { - $nlsused++; - } - if ($nlsused > 1) { - &perror("FATAL", $file, -1, "Both WITHOUT_NLS and PORT_OPTIONS:MNLS are found. ". - "Remove one or another."); + print "OK: checking for USES=gettext without PORT_OPTIONS:MNLS.\n" if ($verbose); + if ($makevar{USES} =~ /\bgettext\b/ && $whole !~ /PORT_OPTIONS:MNLS/) { + &perror("WARN", $file, -1, "Consider adding support for a NLS ". + "knob to conditionally disable gettext support."); } # @@ -3369,6 +3307,17 @@ return chomp $result; } +sub get_makevar_raw { + my($mvar) = @_; + my($cmd, $result); + + $cmd = join(' -XV ', "make $makeenv MASTER_SITE_BACKUP=''", $mvar); + $result = `$cmd`; + chomp $result; + + return $result; +} + sub is_predefined { my($url, $file) = @_; my($site, $site_re); >Release-Note: >Audit-Trail: >Unformatted: