[SCM] Git repository for devscripts branch, master, updated. v2.11.7-35-g3550f42

James McCoy jamessan at debian.org
Wed May 30 23:41:00 UTC 2012


The following commit has been merged in the master branch:
commit 3550f42237468c2cae73c0ace42d00a0f12d37da
Author: Raphael Geissert <geissert at debian.org>
Date:   Wed May 30 14:21:48 2012 -0500

    dget: ignore duplicate repository URLs
    
    Signed-off-by: James McCoy <jamessan at debian.org>

diff --git a/scripts/dget.pl b/scripts/dget.pl
index 9ab1e13..2ed2d36 100755
--- a/scripts/dget.pl
+++ b/scripts/dget.pl
@@ -318,14 +318,14 @@ sub apt_get {
     }
 
     # find deb lines matching the hosts in the policy output
-    my @repositories;
+    my %repositories;
     # the regexp within the map below can be removed and replaced with only the quotemeta statement once bug #154868 is fixed
     my $host_re = '(?:' . (join '|', map { my $host = quotemeta; $host =~ s@^(\w+\\:\\/\\/[^:/]+)\\/@$1(?::[0-9]+)?\\/@; $host; } @hosts) . ')';
     if (-f "/etc/apt/sources.list") {
 	$apt = new IO::File("/etc/apt/sources.list") or die "/etc/apt/sources.list: $!";
 	while (<$apt>) {
 	    if (/^\s*deb\s*($host_re\b)/) {
-		push @repositories, $1;
+		$repositories{$1} = 1;
 	    }
 	}
 	close $apt;
@@ -338,17 +338,17 @@ sub apt_get {
 	$apt = new IO::File("$_") or die "$_: $!";
 	while (<$apt>) {
 	    if (/^\s*deb\s*($host_re\b)/) {
-		push @repositories, $1;
+		$repositories{$1} = 1;
 	    }
 	}
 	close $apt;
     }
-    unless (@repositories) {
+    unless (%repositories) {
 	die "no repository found in /etc/apt/sources.list or sources.list.d";
     }
 
     # try each repository in turn
-    foreach my $repository (@repositories) {
+    foreach my $repository (keys %repositories) {
 	my ($dir, $file) = ($repository, $filename);
 	if ($filename =~ /(.*)\/([^\/]*)$/) {
 	    ($dir, $file) = ("$repository/$1", $2);

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list