1
0
mirror of synced 2026-04-17 00:00:12 +00:00

Support sources.list.d (i.e. when no sources.list exists; closes #650300)

This commit is contained in:
Axel Beckert
2012-05-07 21:32:00 +02:00
parent f55461b1bc
commit a9aea889d8
2 changed files with 34 additions and 31 deletions

View File

@@ -68,7 +68,8 @@ my %fallback_suite = ( Debian => 'stable',
Ubuntu => 'lucid' );
# Where to look for the sources.list to parse
my $sources_list_file = '/etc/apt/sources.list';
my @sources_list_files = ( '/etc/apt/sources.list',
glob('/etc/apt/sources.list.d/*.list'));
use File::Slurp;
use Getopt::Long;
@@ -108,48 +109,49 @@ if ($want_manual) {
pod2usage( -verbose => 2 );
}
if (-r $sources_list_file) {
# sources.list exists, so it's something debianoid.
all_sources_list_files: foreach my $sources_list_file (@sources_list_files) {
if (-r $sources_list_file) {
# sources.list file exists, so it's something debianoid.
# read sources.list and split it into lines
my @sources_list = read_file($sources_list_file);
# read sources.list and split it into lines
my @sources_list = read_file($sources_list_file);
# Find the first line which is a Debian or Ubuntu mirror but not
# an updates, backports, volatile or security mirror.
foreach my $sources_list_entry (@sources_list) {
# Normalize line
chomp($sources_list_entry);
$sources_list_entry =~ s/^\s*(.*?)\s*$/$1/;
# Find the first line which is a Debian or Ubuntu mirror but not
# an updates, backports, volatile or security mirror.
foreach my $sources_list_entry (@sources_list) {
# Normalize line
chomp($sources_list_entry);
$sources_list_entry =~ s/^\s*(.*?)\s*$/$1/;
# Skip definite non-entries
next if $sources_list_entry =~ /^\s*($|#)/;
# Skip definite non-entries
next if $sources_list_entry =~ /^\s*($|#)/;
# Split up into fields
my @source_components = split(/\s+/, $sources_list_entry);
# Split up into fields
my @source_components = split(/\s+/, $sources_list_entry);
# Minimum number of components is 4
next if $#source_components < 3;
# Minimum number of components is 4
next if $#source_components < 3;
# Don't use deb-src entries.
next if $source_components[0] eq 'deb-src';
# Don't use deb-src entries.
next if $source_components[0] eq 'deb-src';
# Skip updates, backports, volatile or security mirror.
next if $source_components[2] !~ /^[a-z]+$/;
# Skip updates, backports, volatile or security mirror.
next if $source_components[2] !~ /^[a-z]+$/;
if ($source_components[1] =~ m(/debian/?$|/ubuntu/?$)) {
# Seems a typical mirror. Let's use that one
if ($source_components[1] =~ m(/debian/?$|/ubuntu/?$)) {
# Seems a typical mirror. Let's use that one
$mirror = $source_components[1];
$suite = $source_components[2];
$mirror = $source_components[1];
$suite = $source_components[2];
$found = 1;
last;
}
$found = 1;
last all_sources_list_files;
}
}
warn "Couldn't parse $sources_list_file of the Dom0.\n" unless $found;
}
warn "Couldn't parse $sources_list_file of the Dom0.\n" unless $found;
}
my $lsb_release = `which lsb_release`;
chomp($lsb_release);

1
debian/changelog vendored
View File

@@ -11,6 +11,7 @@ xen-tools (4.2.1+dev-1) UNRELEASED; urgency=low
- Fix wildcard vs regexp in memory configuration parsing.
- Fix misbehaviour if --ip option is passed multiple times (Closes:
#652110; Thanks Brian Bennett!)
- Supports /etc/apt/sources.list.d/ (Closes: #650300)
* No more suggest evms-cli -- it's no more available on any supported
Dom0 distribution. Thanks to Markus Waldeck for the hint.
* Bump Standards-Version to 3.9.3 (no changes)