Date: Tue, 3 Mar 2009 19:30:44 GMT From: Sergey Skvortsov <skv@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: marcus@FreeBSD.org Subject: ports/132289: [PATCH] ports-mgmt/portlint: fix for perl5.10; use warnings Message-ID: <200903031930.n23JUink062599@freefall.freebsd.org> Resent-Message-ID: <200903031940.n23Je1dm065778@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 132289 >Category: ports >Synopsis: [PATCH] ports-mgmt/portlint: fix for perl5.10; use warnings >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Mar 03 19:40:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Sergey Skvortsov >Release: FreeBSD 7.1-PRERELEASE amd64 >Organization: >Environment: System: FreeBSD protey.ru 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Thu Jan 1 18:06:58 UTC >Description: 1. Fix regex for compatibility with rigid perl-5.10 2. Use "use warnings;"; fix code to remove warnings (maybe not all of them) 3. Other code improvements; use modern Perl features (because current versions on FreeBSD are 5.8 and 5.10 only - so we can do not worry about compatiBility with older versions) Port maintainer (marcus@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.77 >How-To-Repeat: >Fix: --- portlint-2.10.2_1.patch begins here --- Index: src/portlint.pl =================================================================== RCS file: /home/pcvs/ports/ports-mgmt/portlint/src/portlint.pl,v retrieving revision 1.106 diff -u -u -r1.106 portlint.pl --- src/portlint.pl 19 Jan 2009 06:58:42 -0000 1.106 +++ src/portlint.pl 3 Mar 2009 19:24:30 -0000 @@ -1,4 +1,4 @@ -#! /usr/bin/perl +#! /usr/bin/perl -w # ex:ts=4 # # portlint - lint for port directory @@ -20,15 +20,18 @@ # $MCom: portlint/portlint.pl,v 1.164 2009/01/19 06:57:51 marcus Exp $ # -use vars qw/ $opt_a $opt_A $opt_b $opt_C $opt_c $opt_g $opt_h $opt_t $opt_v $opt_M $opt_N $opt_B $opt_V /; +use strict; +use warnings; + use Getopt::Std; use File::Find; use IPC::Open2; use POSIX qw(strftime); -use strict; sub perror($$$$); +our ($opt_a, $opt_A, $opt_b, $opt_C, $opt_c, $opt_g, $opt_h, $opt_t, $opt_v, $opt_M, $opt_N, $opt_B, $opt_V); + my ($err, $warn); my ($extrafile, $parenwarn, $committer, $verbose, $usetabs, $newport, $grouperrs); @@ -154,6 +157,8 @@ # The PORTSDIR environment variable overrides our defaults. $portsdir = $ENV{PORTSDIR} if ( defined $ENV{'PORTSDIR'} ); +$ENV{'PL_CVS_IGNORE'} //= ''; + if ($verbose) { print "OK: config: portsdir: \"$portsdir\" ". "rcsidstr: \"$rcsidstr\" ". @@ -1056,9 +1061,8 @@ my $file = shift; my (%seen_depends, $j); - if (!defined $ENV{'PORTSDIR'}) { - $ENV{'PORTSDIR'} = $portsdir; - } + $ENV{'PORTSDIR'} //= $portsdir; + foreach my $i (grep(/^(PATCH_|EXTRACT_|LIB_|BUILD_|RUN_|FETCH_)*DEPENDS[?+]?=/, split(/\n/, $tmp))) { $i =~ s/^((PATCH_|EXTRACT_|LIB_|BUILD_|RUN_|FETCH_)*DEPENDS)[?+]?=[ \t]*//; $j = $1; @@ -1208,7 +1212,7 @@ my $tmp; my $bogusdistfiles = 0; my @varnames = (); - my($portname, $portversion, $distfiles, $distversionprefix, $distversion, $distversionsuffix, $distname, $extractsufx) = ('', '', '', '', ''); + my($portname, $portversion, $distfiles, $distversionprefix, $distversion, $distversionsuffix, $distname, $extractsufx) = ('') x 8; my $masterport = 0; my $slaveport = 0; my $use_gnome_hack = 0; @@ -1432,7 +1436,7 @@ # whole file: USE_* as a user-settable option # print "OK: checking for USE_* as a user-settable option.\n" if ($verbose); - while ($whole =~ /\n\s*\.\s*(?:el)?if[^\n]*?\b(\w*USE_)(\w+)(?\![^\n]*\n#?\.error)/g) { + while ($whole =~ /\n\s*\.\s*(?:el)?if[^\n]*?\b(\w*USE_)(\w+)(?![^\n]*\n#?\.error)/g) { my $lineno = &linenumber($`); &perror("WARN", $file, $lineno, "is $1$2 a user-settable option? ". "Consider using WITH_$2 instead.") @@ -1885,7 +1889,8 @@ # # whole file: check for --mandir and --infodir when GNU_CONFIGURE # - if ($makevar{GNU_CONFIGURE} ne '' && + if (exists $makevar{GNU_CONFIGURE} && + $makevar{GNU_CONFIGURE} ne '' && $makevar{CONFIGURE_ARGS} =~ /--(man|info)dir/) { &perror("WARN", $file, -1, "--mandir and --infodir are not needed ". "in CONFIGURE_ARGS as they are already set in bsd.port.mk"); @@ -2089,13 +2094,13 @@ print "OK: checking PORTNAME/PORTVERSION/DISTVERSION.\n" if ($verbose); if ($tmp !~ /\nPORTNAME(.)?=/) { &perror("FATAL", $file, -1, "PORTNAME has to be there.") unless ($slaveport && $makevar{PORTNAME} ne ''); - } elsif ($1 ne '') { + } elsif (defined $1 && $1 ne '') { &perror("WARN", $file, -1, "unless this is a master port, PORTNAME has to be set by \"=\", ". "not by \"$1=\".") unless ($masterport); } if ($tmp !~ /\n(PORTVERSION|DISTVERSION)(.)?=/) { &perror("FATAL", $file, -1, "PORTVERSION or DISTVERSION has to be there.") unless ($slaveport && ($makevar{PORTVERSION} ne '' || $makevar{DISTVERSION} ne '')); - } elsif ($2 ne '') { + } elsif (defined $2 && $2 ne '') { &perror("WARN", $file, -1, "unless this is a master port, PORTVERSION has to be set by \"=\", ". "not by \"$2=\".") unless ($masterport); } @@ -2126,7 +2131,7 @@ print "OK: checking CATEGORIES.\n" if ($verbose); if ($tmp !~ /\nCATEGORIES(.)?=/) { &perror("FATAL", $file, -1, "CATEGORIES has to be there.") unless ($slaveport && $makevar{CATEGORIES} ne ''); - } elsif (($i = $1) ne '' && $i =~ /[^?+]/) { + } elsif (defined $1 && ($i = $1) ne '' && $i =~ /[^?+]/) { &perror("WARN", $file, -1, "unless this is a master port, CATEGORIES should be set by \"=\", \"?=\", or \"+=\", ". "not by \"$i=\".") unless ($masterport); } @@ -2373,7 +2378,7 @@ } } - $versiondir = $ENV{VERSIONDIR} ? $ENV{VERSIONDIR} : '/var/db/chkversion'; + $versiondir = $ENV{VERSIONDIR} // '/var/db/chkversion'; $versionfile = "$versiondir/VERSIONS"; $useindex = !-r "$versionfile"; @@ -2546,7 +2551,7 @@ # check COMMENT if ($tmp !~ /\nCOMMENT(.)?=/) { &perror("FATAL", $file, -1, "COMMENT has to be there.") unless ($slaveport && $makevar{COMMENT} ne ''); - } elsif ($1 ne '') { + } elsif (defined $1 && $1 ne '') { &perror("WARN", $file, -1, "unless this is a master port, COMMENT has to be set by \"=\", ". "not by \"$1=\".") unless ($masterport); } else { # check for correctness @@ -2692,7 +2697,7 @@ if ($tmp =~ /MAN\U$i\E=\s*([^\n]*)\n/) { @mman = grep($_ !~ /^\s*$/, split(/\s+/, $1)); @pman = grep($_ !~ /^\s*$/, - split(/\s+/, $plistmanall{$i})); + split(/\s+/, $plistmanall{$i} // '')); foreach my $j (@mman) { print "OK: checking $j (Makefile)\n" if ($verbose); --- portlint-2.10.2_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903031930.n23JUink062599>