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:25:26 UTC 2022

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

Log Message:
lintpkgsrc: cleanup: reduce indentation of parse_makefile_pkgsrc


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 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.112 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.113
--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl:1.112        Wed Aug 17 18:22:26 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl      Wed Aug 17 18:25:26 2022
@@ -1,5 +1,5 @@
 #!@PERL5@
-# $NetBSD: lintpkgsrc.pl,v 1.112 2022/08/17 18:22:26 rillig Exp $
+# $NetBSD: lintpkgsrc.pl,v 1.113 2022/08/17 18:25:26 rillig Exp $
 
 # Written by David Brownlee <abs%netbsd.org@localhost>.
 #
@@ -988,58 +988,55 @@ sub parse_makefile_pkgsrc($file) {
                }
        }
 
-       if (defined $pkgname) {
-               $pkgname = canonicalize_pkgname($pkgname);
+       defined $pkgname or return ();
 
-               my $pkgrevision = $vars->{PKGREVISION};
-               if (defined $pkgrevision && $pkgrevision !~ /^\s*$/) {
-                       if ($pkgrevision =~ /^\$\{ (?:
-                           _CVS_PKGVERSION |
-                           _GIT_PKGVERSION_CMD |
-                           _HG_PKGVERSION_CMD |
-                           _SVN_PKGREVISION_CMD) :.* \}$ /x) {
-                               # See wip/mk/*-package.mk.
-                       } elsif ($pkgrevision =~ /\D/) {
-                               print "\n";
-                               print "Bogus: PKGREVISION $pkgrevision (from $file)\n";
+       $pkgname = canonicalize_pkgname($pkgname);
 
-                       } elsif ($pkgrevision > 0) {
-                               $pkgname .= "nb$pkgrevision";
-                       }
+       my $pkgrevision = $vars->{PKGREVISION};
+       if (defined $pkgrevision && $pkgrevision !~ /^\s*$/) {
+               if ($pkgrevision =~ /^\$\{ (?:
+                   _CVS_PKGVERSION |
+                   _GIT_PKGVERSION_CMD |
+                   _HG_PKGVERSION_CMD |
+                   _SVN_PKGREVISION_CMD) :.* \}$ /x) {
+                       # See wip/mk/*-package.mk.
+               } elsif ($pkgrevision =~ /\D/) {
+                       print "\n";
+                       print "Bogus: PKGREVISION $pkgrevision (from $file)\n";
+
+               } elsif ($pkgrevision > 0) {
+                       $pkgname .= "nb$pkgrevision";
                }
+       }
 
-               if ($pkgname =~ /\$/) {
-                       print "\nBogus: $pkgname (from $file)\n";
+       if ($pkgname =~ /\$/) {
+               print "\nBogus: $pkgname (from $file)\n";
 
-               } elsif ($pkgname =~ /(.*)-(\d.*)/) {
-                       if (defined $pkgdata) {
-                               my $pkgver = $pkgdata->add($1, $2);
+       } elsif ($pkgname =~ /(.*)-(\d.*)/) {
+               if (defined $pkgdata) {
+                       my $pkgver = $pkgdata->add($1, $2);
 
-                               debug("add $1 $2");
+                       debug("add $1 $2");
 
-                               foreach my $var (qw(DEPENDS RESTRICTED OSVERSION_SPECIFIC BROKEN)) {
-                                       $pkgver->var($var, $vars->{$var});
-                               }
+                       foreach my $var (qw(DEPENDS RESTRICTED OSVERSION_SPECIFIC BROKEN)) {
+                               $pkgver->var($var, $vars->{$var});
+                       }
 
-                               if (defined $vars->{NO_BIN_ON_FTP}) {
-                                       $pkgver->var('RESTRICTED', 'NO_BIN_ON_FTP');
-                               }
+                       if (defined $vars->{NO_BIN_ON_FTP}) {
+                               $pkgver->var('RESTRICTED', 'NO_BIN_ON_FTP');
+                       }
 
-                               if ($file =~ m:([^/]+/[^/]+)/Makefile$:) {
-                                       $pkgver->var('dir', $1);
-                               } else {
-                                       $pkgver->var('dir', 'unknown');
-                               }
+                       if ($file =~ m:([^/]+/[^/]+)/Makefile$:) {
+                               $pkgver->var('dir', $1);
+                       } else {
+                               $pkgver->var('dir', 'unknown');
                        }
-               } else {
-                       print "Cannot extract $pkgname version ($file)\n";
                }
-
-               return ($pkgname, $vars);
-
        } else {
-               return (undef);
+               print "Cannot extract $pkgname version ($file)\n";
        }
+
+       ($pkgname, $vars);
 }
 
 



Home | Main Index | Thread Index | Old Index