[pkg-perl-tools] 02/03: Refactor detect_tracker_url() into a sub

Alex Muntada alexm-guest at moszumanska.debian.org
Sun May 22 10:48:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

alexm-guest pushed a commit to branch master
in repository pkg-perl-tools.

commit dcbdef96fbb61ec4d4434f7cdfa6fa18023e021c
Author: Alex Muntada <alexm at alexm.org>
Date:   Sat May 21 20:35:06 2016 +0200

    Refactor detect_tracker_url() into a sub
---
 scripts/forward | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/scripts/forward b/scripts/forward
index b49f7f7..1cdf05e 100755
--- a/scripts/forward
+++ b/scripts/forward
@@ -158,20 +158,12 @@ die "Unable to determine distribution name.\n"
     . "Please use the --dist option.\n"
     unless $opt_dist;
 
+$opt_tracker_url ||= detect_tracker_url();
+
 if ( $meta and $meta->resources and $meta->resources->{bugtracker} ) {
-    $opt_tracker_url ||= $meta->resources->{bugtracker}{web};
     $opt_mailto      ||= $meta->resources->{bugtracker}{mailto};
 }
 
-unless ($opt_tracker_url) {
-    warn "Bug tracker web not found in META.\n";
-
-    $opt_tracker_url
-        = "https://rt.cpan.org/Public/Dist/Display.html?Name=$opt_dist";
-
-    warn "Falling back to $opt_tracker_url\n";
-}
-
 if ( $opt_use_mail and not $opt_mailto ) {
     warn "Bug tracker mail not found in META.\n";
 
@@ -728,6 +720,22 @@ sub mark_bug_as_forwarded {
     print " done.\n";
 }
 
+sub detect_tracker_url {
+    $opt_tracker_url ||= $meta->resources->{bugtracker}{web}
+        if $meta
+        and $meta->resources
+        and $meta->resources->{bugtracker};
+
+    unless ($opt_tracker_url) {
+        warn "Bug tracker web not found in META.\n";
+
+        $opt_tracker_url
+            = "https://rt.cpan.org/Public/Dist/Display.html?Name=$opt_dist";
+
+        warn "Falling back to $opt_tracker_url\n";
+    }
+}
+
 sub detect_tracker {
     # discover the appropriate tracker
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



More information about the Pkg-perl-cvs-commits mailing list