pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: remove unnece...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/dccc5b3ab777
branches:  trunk
changeset: 338077:dccc5b3ab777
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Aug 18 07:51:40 2019 +0000

description:
pkgtools/url2pkg: remove unnecessary local variable

diffstat:

 pkgtools/url2pkg/files/url2pkg.pl |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (77 lines):

diff -r 1508af5669dd -r dccc5b3ab777 pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 07:47:58 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Sun Aug 18 07:51:40 2019 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: url2pkg.pl,v 1.54 2019/08/18 07:47:58 rillig Exp $
+# $NetBSD: url2pkg.pl,v 1.55 2019/08/18 07:51:40 rillig Exp $
 #
 
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -306,7 +306,6 @@
        my $github_release = "";
        my $dist_subdir = "";
 
-       my $found = false;
        open(SITES, "<", "../../mk/fetch/sites.mk") or die;
        while (defined(my $line = <SITES>)) {
                chomp($line);
@@ -318,8 +317,6 @@
                        my ($site) = ($1);
 
                        if (index($url, $site) == 0) {
-                               $found = true;
-
                                if ($url =~ qr"^\Q${site}\E(.+)/([^/]+)$") {
                                        my $subdir = $1;
                                        $distfile = $2;
@@ -346,7 +343,6 @@
                $master_sites = "\${MASTER_SITE_SOURCEFORGE:=${project}/}";
                $homepage = "https://${project}.sourceforge.net/";;
                $distfile = $filename;
-               $found = true;
        }
 
        if ($url =~ qr"^https://github\.com/";) {
@@ -361,7 +357,6 @@
                                $dist_subdir = '${GITHUB_PROJECT}';
                        }
                        $distfile = "$tag$ext";
-                       $found = true;
 
                } elsif ($url =~ qr"^https://github\.com/(.*)/(.*)/releases/download/(.*)/(.*)(\.tar\.gz|\.zip)$") {
                        my ($org, $proj, $tag, $base, $ext) = ($1, $2, $3, $4, $5);
@@ -374,15 +369,16 @@
                        }
                        $github_release = $tag eq $base ? '${DISTNAME}' : $tag;
                        $distfile = "$base$ext";
-                       $found = true;
+
                } else {
                        print("$0: ERROR: Invalid GitHub URL: ${url}, handling as normal URL\n");
                }
        }
 
-       if (!$found) {
+       if ($master_sites eq "") {
                if ($url =~ qr"^(.*/)(.*)$") {
-                       ($master_sites, $distfile) = ($1, $2);
+                       $master_sites = $1;
+                       $distfile = $2;
                        $homepage = $master_sites;
                } else {
                        die("$0: ERROR: Invalid URL: ${url}\n");
@@ -390,9 +386,11 @@
        }
 
        if ($distfile =~ qr"^(.*?)((?:\.tar)?\.\w+)$") {
-               ($distname, $extract_sufx) = ($1, $2);
+               $distname = $1;
+               $extract_sufx = $2;
        } else {
-               ($distname, $extract_sufx) = ($distfile, "# none");
+               $distname = $distfile;
+               $extract_sufx = "# none";
        }
 
        rename("Makefile", "Makefile-url2pkg.bak") or do {};



Home | Main Index | Thread Index | Old Index