G'day everyone, I've started to do clean-up dh-make-perl that have nothing to do with build_requires, META.yml, or the like. I'm not sure of the debian bug procedure, but I'd like to suggest opening another ticket, or dropping me on a mailing list, or doing something that means this bug won't get filled with patches that aren't directly relevant to it. I'm not sure of the correct procedure here from your end, so if you can enlighten me, I'd appreciate it.
As a little bit of recreational clean-up, I've written a basic test for get_stdmodules, as well as altering it so that instead of it rooting around in perl's @INC, and firing off `dpkg -L`, it instead just asks Module::CoreList, which has already been Debianised for etch, and which contains a list of all the core modules for each version of Perl. It significantly reduces the complexity, size, and execution time of the code. We're also no longer expecting external processes to run (eg, dpkg) and relying upon them to both exist and succeed. Patches are attached, again generated from git. The patches are generated from the 'module-corelist' branch of my git repo. A basic test is also included, and assumes the existence of a t/ directory for tests (my previous patches add this). If you want me to jump through whatever hoops are needed so I can push changes into svn after they've been appropriately reviewed, do let me know. Cheerio, Paul -- Paul Fenwick <[EMAIL PROTECTED]> | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681
>From 4a4b7942febf397781153a965e566aa3b5d34f85 Mon Sep 17 00:00:00 2001 From: Paul Fenwick <[EMAIL PROTECTED]> Date: Tue, 25 Nov 2008 16:40:24 +1100 Subject: [PATCH] Simple tests to ensure that get_stdmodules() works. --- t/corelist.t | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100755 t/corelist.t diff --git a/t/corelist.t b/t/corelist.t new file mode 100755 index 0000000..5bd6bf7 --- /dev/null +++ b/t/corelist.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; + +use Test::More 'no_plan'; + +use FindBin qw($Bin); + +require "$Bin/../dh-make-perl"; # Load our code for testing. + +my @std_modules = get_stdmodules(); + +# Check to see if our module list contains some obvious candidates. + +my %modules_index; [EMAIL PROTECTED]@std_modules} = (); + +foreach my $module ( qw(Fatal File::Copy FindBin CGI IO::Handle Safe) ) { + ok(exists $modules_index{$module}, "$module should be a core module"); +} -- 1.5.5.GIT
>From dcd05bb019bc47fa539873d3db3d26e003853789 Mon Sep 17 00:00:00 2001 From: Paul Fenwick <[EMAIL PROTECTED]> Date: Tue, 25 Nov 2008 16:50:05 +1100 Subject: [PATCH] Updated get_stdmodules to use Module::CoreList. Previously get_stdmodules() would manually root around in the directories listed in @INC. This could potentially have strange results if @INC was modified (eg, due to setting PERL5LIB). --- debian/control | 2 +- dh-make-perl | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/debian/control b/debian/control index 26c6985..0fd71c4 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,7 @@ Package: dh-make-perl Architecture: all Depends: debhelper (>= 4.0.2), libpod-parser-perl, ${perl:Depends}, make, dpkg-dev, fakeroot, ${misc:Depends}, libyaml-perl, libmodule-depends-perl, - libwww-mechanize-perl, libemail-date-format-perl + libwww-mechanize-perl, libemail-date-format-perl, libmodule-corelist-perl Recommends: apt-file (>= 2.1.0), libmodule-build-perl Description: Create Debian packages from perl modules dh-make-perl will create the files required to build a Debian source diff --git a/dh-make-perl b/dh-make-perl index dc0dfdb..21a1dbd 100755 --- a/dh-make-perl +++ b/dh-make-perl @@ -11,6 +11,7 @@ use Cwd; use CPAN; use Module::Depends::Intrusive; use Email::Date::Format qw(email_date); +use Module::CoreList (); use strict; # TODO: @@ -310,24 +311,17 @@ USAGE } sub get_stdmodules { - my ( $base_packages, @modules, $paths ); - $base_packages = $opts{basepkgs} || 'perl,perl-base,perl-modules'; - # We will check on all the base Perl packages for the modules they provide. - # To know which files we care for, we look at @INC - In a format easy to - # integrate into a regex - $paths = join( '|', @INC ); + # Module::CoreList already knows our core modules, so we ask it. + # $] is our perl version. - for my $pkg ( split( /,/, $base_packages ) ) { - for my $file ( map { chomp; $_ } `dpkg -L $pkg` ) { - next unless $file =~ s!^(?:$paths)[\d\.]*/(.*).pm$!$1!x; + my @modules = keys %{ $Module::CoreList::version{ $] } }; - $file =~ s!/!::!g; - push @modules, $file; - } - } + @modules + or die "Internal error: \$Module::CoreList::version{ $] } is empty"; + + return @modules; - return sort @modules; } sub setup_dir { -- 1.5.5.GIT