pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Wed Aug 17 18:22:26 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files: lintpkgsrc.pl

Log Message:
lintpkgsrc: cleanup: condense guess-parsing of PKGNAME


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl
diff -u pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.111 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.112
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.111        Wed Aug 17 18:18:20 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Wed Aug 17 18:22:26 2022
@@ -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 @@ sub package_globmatch($pkgmatch) {
 # 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