pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files lintpkgsrc: eliminate common...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/12d82f2e5033
branches:  trunk
changeset: 383320:12d82f2e5033
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Aug 17 17:47:50 2022 +0000

description:
lintpkgsrc: eliminate common subexpression when parsing package

diffstat:

 pkgtools/lintpkgsrc/files/lintpkgsrc.pl |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (46 lines):

diff -r fc688da8f73a -r 12d82f2e5033 pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Wed Aug 17 17:46:52 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Wed Aug 17 17:47:50 2022 +0000
@@ -1,5 +1,5 @@
 #!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.109 2022/08/17 17:40:09 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.110 2022/08/17 17:47:50 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -998,16 +998,16 @@
        if (defined $pkgname) {
                $pkgname = canonicalize_pkgname($pkgname);
 
-               if (defined $vars->{PKGREVISION}
-                   and not $vars->{PKGREVISION} =~ /^\s*$/) {
-                       if ($vars->{PKGREVISION} =~ /^\$\{(_(CVS|GIT|HG|SVN)_PKGVERSION):.*\}$/) {
+               my $pkgrevision = $vars->{PKGREVISION};
+               if (defined $pkgrevision and not $pkgrevision =~ /^\s*$/) {
+                       if ($pkgrevision =~ /^\$\{(_(CVS|GIT|HG|SVN)_PKGVERSION):.*\}$/) {
                                # See wip/mk/*-package.mk.
-                       } elsif ($vars->{PKGREVISION} =~ /\D/) {
-                               print "\nBogus: PKGREVISION $vars->{PKGREVISION} (from $file)\n";
+                       } elsif ($pkgrevision =~ /\D/) {
+                               print "\n";
+                               print "Bogus: PKGREVISION $pkgrevision (from $file)\n";
 
-                       } elsif ($vars->{PKGREVISION}) {
-                               $pkgname .= 'nb';
-                               $pkgname .= $vars->{PKGREVISION};
+                       } elsif ($pkgrevision > 0) {
+                               $pkgname .= "nb$pkgrevision";
                        }
                }
 
@@ -1015,8 +1015,8 @@
                        print "\nBogus: $pkgname (from $file)\n";
 
                } elsif ($pkgname =~ /(.*)-(\d.*)/) {
-                       if ($pkgdata) {
-                               my ($pkgver) = $pkgdata->add($1, $2);
+                       if (defined $pkgdata) {
+                               my $pkgver = $pkgdata->add($1, $2);
 
                                debug("add $1 $2");
 



Home | Main Index | Thread Index | Old Index