The following commit has been merged in the master branch:
commit e48a8c9349bb74a3d3137da6f4eb7f9db6972e27
Author: James Vega <[email protected]>
Date:   Sat Sep 4 15:14:39 2010 -0400

    dget: Fix parsing of apt-cache and sources.list when given only a package 
name.
    
    Closes: #594904
    Signed-off-by: James Vega <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index 1580132..5774a58 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+devscripts (2.10.68) UNRELEASED; urgency=low
+
+  * dget: Fix parsing of apt-cache and sources.list when given only a package
+    name.  (Closes: #594904)
+
+ -- James Vega <[email protected]>  Sat, 04 Sep 2010 15:12:05 -0400
+
 devscripts (2.10.67) unstable; urgency=low
 
   * debcommit: Use the first detected changelog instead of the last.  (Closes:
diff --git a/scripts/dget.pl b/scripts/dget.pl
index b7ef84e..57bc974 100755
--- a/scripts/dget.pl
+++ b/scripts/dget.pl
@@ -262,7 +262,9 @@ sub apt_get {
        if ($qversion and /^ [ *]{3} ($qversion) 0/) {
            while (<$apt>) {
                last OUTER unless /^  *(?:\d+) (\S+)/;
-               push @hosts, $1;
+               (my $host = $1) =~ s@/$@@;
+               next if $host eq '/var/lib/dpkg/status';
+               push @hosts, $host;
            }
        }
     }
@@ -274,7 +276,7 @@ sub apt_get {
        die "$progname: no hostnames in apt-cache policy $package for $version 
found\n";
     }
 
-    $apt = new IO::File("LC_ALL=C apt-cache --all-versions show $package |")
+    $apt = new IO::File("LC_ALL=C apt-cache show $package=$version |")
        or die "$!";
     my ($v, $p, $filename, $md5sum);
     while (<$apt>) {
@@ -312,7 +314,7 @@ sub apt_get {
     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\S+)/) {
+           if (/^\s*deb\s*($host_re\b)/) {
                push @repositories, $1;
            }
        }
@@ -325,7 +327,7 @@ sub apt_get {
        $_ = "/etc/apt/sources.list.d/$_";
        $apt = new IO::File("$_") or die "$_: $!";
        while (<$apt>) {
-           if (/^\s*deb\s*($host_re\S+)/) {
+           if (/^\s*deb\s*($host_re\b)/) {
                push @repositories, $1;
            }
        }

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to