r48598 - in /trunk/dh-make-perl: debian/changelog dh-make-perl lib/Debian/AptContents.pm lib/DhMakePerl.pm lib/DhMakePerl/Config.pm t/AptContents.t
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Fri Dec 11 21:14:47 UTC 2009
Author: dmn
Date: Fri Dec 11 21:14:42 2009
New Revision: 48598
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48598
Log:
replace the hard-coded default to /etc/apt/sources.list with querying AptPkg's Config about possible sources.list files. Closes: #557961
Modified:
trunk/dh-make-perl/debian/changelog
trunk/dh-make-perl/dh-make-perl
trunk/dh-make-perl/lib/Debian/AptContents.pm
trunk/dh-make-perl/lib/DhMakePerl.pm
trunk/dh-make-perl/lib/DhMakePerl/Config.pm
trunk/dh-make-perl/t/AptContents.t
Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=48598&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Fri Dec 11 21:14:42 2009
@@ -4,6 +4,8 @@
* while looking for docs, do not delve into SVN and GIT dirs
* add perl (>= 5.10.1) as a preferred alternative (build) dependency to
libmodule-corelist-perl (>= 2.14) and libtest-simple-perl (>= 0.82)
+ * replace the hard-coded default to /etc/apt/sources.list with querying
+ AptPkg's Config about possible sources.list files. Closes: #557961
-- Damyan Ivanov <dmn at debian.org> Thu, 10 Dec 2009 07:29:05 +0200
Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=48598&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Fri Dec 11 21:14:42 2009
@@ -296,7 +296,7 @@
B<sources.list> are not parsed in order to save you time parsing old files from
mirrors you no longer use.
-Default: C</etc/apt/sources.list>
+Default: apt's default.
=item B<--verbose> | B<--no-verbose>
Modified: trunk/dh-make-perl/lib/Debian/AptContents.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/AptContents.pm?rev=48598&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/AptContents.pm (original)
+++ trunk/dh-make-perl/lib/Debian/AptContents.pm Fri Dec 11 21:14:42 2009
@@ -26,7 +26,7 @@
__PACKAGE__->mk_accessors(
qw(
cache homedir cache_file contents_dir contents_files verbose
- source sources_file dist
+ source sources dist
)
);
@@ -36,6 +36,7 @@
use IO::Uncompress::Gunzip;
use Module::CoreList ();
use Storable;
+use AptPkg::Config;
=head1 CONSTRUCTOR
@@ -60,9 +61,10 @@
Directory where L<apt-file> stores Contents files are stored. Default is
F</var/cache/apt/apt-file>
-=item sources_file
-
-Path to the F<sources.list> file. Default is F</etc/apt/sources.list>.
+=item sources
+
+A path to a F<sources.list> file or an array ref of paths to sources.list
+files. If not given uses AptPkg's Config to get the list.
=item dist
@@ -71,8 +73,8 @@
=item contents_files
-Arrayref of F<Contents> file names. Default is to parse C<sources_file> and to
-look in C<contents_dir> for matching files.
+Arrayref of F<Contents> file names. Default is to parse the files in C<sources>
+and to look in C<contents_dir> for matching files.
=item cache_file
@@ -105,8 +107,16 @@
# some defaults
$self->contents_dir( '/var/cache/apt/apt-file' )
unless $self->contents_dir;
- $self->sources_file('/etc/apt/sources.list')
- unless defined( $self->sources_file );
+ $self->sources( [ $self->sources ] )
+ if $self->sources and not ref( $self->sources );
+ $self->sources(
+ [ $AptPkg::Config::_config->get_file('Dir::Etc::sourcelist'),
+ glob(
+ $AptPkg::Config::_config->get_dir('Dir::Etc::sourceparts')
+ . '/*.list'
+ )
+ ]
+ ) unless defined( $self->sources );
$self->contents_files( $self->get_contents_files )
unless $self->contents_files;
$self->cache_file( catfile( $self->homedir, 'Contents.cache' ) )
@@ -195,34 +205,36 @@
{
my $self = shift;
- my $sources = IO::File->new( $self->sources_file, 'r' )
- or die "Unable to open '" . $self->sources_file . "': $!\n";
-
my $archspec = `dpkg --print-architecture`;
chomp($archspec);
my @res;
- while( <$sources> ) {
- chomp;
- s/#.*//;
- s/^\s+//;
- s/\s+$//;
- next unless $_;
-
- my $path = $self->repo_source_to_contents_path($_);
-
- next unless $path;
-
- # try all of with/out architecture and
- # un/compressed
- for my $a ( '', "-$archspec" ) {
- for my $c ( '', '.gz' ) {
- my $f = catfile(
- $self->contents_dir,
- "${path}_Contents$a$c",
- );
- push @res, $f if -e $f;
+ for my $s ( @{ $self->sources } ) {
+ my $src = IO::File->new( $s, 'r' )
+ or die "Unable to open '$s': $!\n";
+
+ while( <$src> ) {
+ chomp;
+ s/#.*//;
+ s/^\s+//;
+ s/\s+$//;
+ next unless $_;
+
+ my $path = $self->repo_source_to_contents_path($_);
+
+ next unless $path;
+
+ # try all of with/out architecture and
+ # un/compressed
+ for my $a ( '', "-$archspec" ) {
+ for my $c ( '', '.gz' ) {
+ my $f = catfile(
+ $self->contents_dir,
+ "${path}_Contents$a$c",
+ );
+ push @res, $f if -e $f;
+ }
}
}
}
Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=48598&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Fri Dec 11 21:14:42 2009
@@ -399,10 +399,10 @@
if $self->apt_contents;
my $apt_c = Debian::AptContents->new(
- { homedir => $self->cfg->home_dir,
- dist => $self->cfg->dist,
- sources_file => $self->cfg->sources_list,
- verbose => $self->cfg->verbose,
+ { homedir => $self->cfg->home_dir,
+ dist => $self->cfg->dist,
+ sources => $self->cfg->sources_list,
+ verbose => $self->cfg->verbose,
}
);
Modified: trunk/dh-make-perl/lib/DhMakePerl/Config.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Config.pm?rev=48598&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Config.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Config.pm Fri Dec 11 21:14:42 2009
@@ -63,7 +63,6 @@
email => '',
exclude => qr/$Dpkg::Source::Package::diff_ignore_default_regexp/,
home_dir => "$ENV{HOME}/.dh-make-perl",
- sources_list => '/etc/apt/sources.list',
verbose => 1,
};
Modified: trunk/dh-make-perl/t/AptContents.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/AptContents.t?rev=48598&op=diff
==============================================================================
--- trunk/dh-make-perl/t/AptContents.t (original)
+++ trunk/dh-make-perl/t/AptContents.t Fri Dec 11 21:14:42 2009
@@ -20,7 +20,7 @@
homedir => $Bin,
contents_dir => "$Bin/contents",
verbose => 0,
- sources_file => "$Bin/contents/sources.list",
+ sources => "$Bin/contents/sources.list",
@_,
});
}
More information about the Pkg-perl-cvs-commits
mailing list