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: cleanup: condens...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/15a7757222d8
branches:  trunk
changeset: 383322:15a7757222d8
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Aug 17 18:22:26 2022 +0000

description:
lintpkgsrc: cleanup: condense guess-parsing of PKGNAME

diffstat:

 pkgtools/lintpkgsrc/files/lintpkgsrc.pl |  23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diffs (41 lines):

diff -r be76e401c02b -r 15a7757222d8 pkgtools/lintpkgsrc/files/lintpkgsrc.pl
--- a/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Wed Aug 17 18:18:20 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/lintpkgsrc.pl   Wed Aug 17 18:22:26 2022 +0000
@@ -1,5 +1,5 @@
 #!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.111 2022/08/17 18:18:20 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.112 2022/08/17 18:22:26 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -952,23 +952,16 @@
 # Parse a pkgsrc package makefile and return the pkgname and set variables
 #
 sub parse_makefile_pkgsrc($file) {
-       my ($pkgname, $vars);
-
-       $vars = parse_makefile_vars($file, undef);
+       my $vars = parse_makefile_vars($file, undef);
        defined $vars or return undef; # Missing Makefile.
 
-       if (defined $vars->{PKGNAME}) {
-               $pkgname = $vars->{PKGNAME};
-       } elsif (defined $vars->{DISTNAME}) {
-               $pkgname = $vars->{DISTNAME};
-       }
+       my $pkgname = $vars->{PKGNAME};
+       my $distname = $vars->{DISTNAME};
 
-       if (defined $vars->{PKGNAME}) {
-               debug("$file: PKGNAME=$vars->{PKGNAME}");
-       }
-       if (defined $vars->{DISTNAME}) {
-               debug("$file: DISTNAME=$vars->{DISTNAME}");
-       }
+       debug("$file: PKGNAME=$pkgname") if defined $pkgname;
+       debug("$file: DISTNAME=$distname") if defined $distname;
+
+       $pkgname = $distname unless defined $pkgname;
 
        if (!defined $pkgname || $pkgname =~ /\$/ || $pkgname !~ /(.*)-(\d.*)/) {
 



Home | Main Index | Thread Index | Old Index