[devscripts] 02/03: dget: Ignore options in sources.list files
James McCoy
jamessan at debian.org
Sat Dec 5 01:36:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit c7eaf024bbc5f8ff3f1d67854c38910c41d77554
Author: James McCoy <jamessan at debian.org>
Date: Fri Dec 4 20:23:36 2015 -0500
dget: Ignore options in sources.list files
Closes: #674812
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 1 +
scripts/dget.pl | 19 +++++++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index bed0174..4c56384 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -100,6 +100,7 @@ devscripts (2.15.10) UNRELEASED; urgency=medium
* dget:
+ Remove unnecessary requirement that “apt-cache policy $pkg” shows a
priority of 0 for the Candidate version. (Closes: #807064)
+ + Fix parsing of sources.list lines with options. (Closes: #674812)
[ Daniel Kahn Gillmor ]
* debuild:
diff --git a/scripts/dget.pl b/scripts/dget.pl
index 844e848..8e6c8ac 100755
--- a/scripts/dget.pl
+++ b/scripts/dget.pl
@@ -333,23 +333,22 @@ sub apt_get {
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) . ')';
+
+ my @sources;
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)/) {
- $repositories{$1} = 1;
- }
- }
- close $apt;
+ push @sources, "/etc/apt/sources.list";
}
my %dir;
tie %dir, "IO::Dir", "/etc/apt/sources.list.d";
foreach (keys %dir) {
next unless /\.list$/;
- $_ = "/etc/apt/sources.list.d/$_";
- $apt = new IO::File("$_") or die "$_: $!";
+ push @sources, "/etc/apt/sources.list.d/$_";
+ }
+
+ foreach my $source (@sources) {
+ $apt = IO::File->new($source) or die "$source: $!";
while (<$apt>) {
- if (/^\s*deb\s*($host_re\b)/) {
+ if (/^\s*deb\s*(?:\[[^]]*\]\s*)?($host_re\b)/) {
$repositories{$1} = 1;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list