r37839 - in /trunk/dh-make-perl: TODO lib/Debian/AptContents.pm t/core-modules.t
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Mon Jun 8 04:35:52 UTC 2009
Author: dmn
Date: Mon Jun 8 04:35:48 2009
New Revision: 37839
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37839
Log:
AptContents: look for core modules only in Perl releases in Debian
this excludes some exotics like 5.8.9
Added:
trunk/dh-make-perl/t/core-modules.t (with props)
Modified:
trunk/dh-make-perl/TODO
trunk/dh-make-perl/lib/Debian/AptContents.pm
Modified: trunk/dh-make-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/TODO?rev=37839&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Mon Jun 8 04:35:48 2009
@@ -1,9 +1,3 @@
-* --refresh and core dependencies
- when a dependency module is in the core, do not blindly copy the version
- dependend on to perl-modules dependency, but use the first perl release the
- dependency is included in.
- mapping perl core versions to debian versions would be nice, otherwise we end up
- with something like "perl-modules (>= 5.9.4)" (happened with libparams-classify-perl).
* use Dpkg::Version::vercmp(v1, v2) for comparing versions all over (grep for
compare)
* investigate using App::Cmd
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=37839&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/AptContents.pm (original)
+++ trunk/dh-make-perl/lib/Debian/AptContents.pm Mon Jun 8 04:35:48 2009
@@ -390,26 +390,76 @@
return @packages;
}
-=item find_perl_module_package( $module, $version )
-
-Given Perl module name (e.g. Foo::Bar), returns a L<Debian::Dependency> object
-representing the required Debian package and version. If the module is a core
-one, suitable dependency on perl-modules is returned.
-
-=cut
-
-sub find_perl_module_package {
+=item find_core_perl_dependency( $module[, $version] )
+
+return a dependency on perl containing the required module version. If the
+module is not available in any perl as released by Debian, return undef.
+
+Currently Debian has only two releases of Perl: 5.8.8 (5.008008) and 5.10
+(5.010000).
+
+=cut
+
+our @debian_perls = qw( 5.008008 5.010000 );
+
+sub find_core_perl_dependency {
my ( $self, $module, $version ) = @_;
- my $core_ver = Module::CoreList->first_release( $module, $version );
+ # see if the module is included in perl core
+ my $core_ver;
+ for (@debian_perls) {
+ my $core = Module::CoreList->find_version($_);
+ next unless exists $core->{$module}; # not in that perl version
+
+ # reaching here, the module is in the core version in $_
+ # if we don't need a particular version, we are done
+ unless( defined($version) ) {
+ $core_ver = $_;
+ last;
+ }
+
+ # OTOH, if we do need a particular version, but
+ # the core module has none, try next core release
+ my $ver = $core->{$module};
+ next unless defined($ver);
+
+ # if the core module version is sufficiently new, we're done
+ if( $AptPkg::Config::_config->system->versioning->compare( $ver, $version ) >= 0 ) {
+ $core_ver = $_;
+ last;
+ }
+ }
if($core_ver) {
$core_ver = version->new($core_ver); # v5.9.2
( $core_ver = $core_ver->normal ) =~ s/^v//; # "5.9.2"
- return Debian::Dependency->new( 'perl-modules', $core_ver );
- }
-
+ return Debian::Dependency->new( 'perl', $core_ver );
+ }
+
+ # not a core module
+ return undef;
+}
+
+=item find_perl_module_package( $module, $version )
+
+Given Perl module name (e.g. Foo::Bar), returns a L<Debian::Dependency> object
+representing the required Debian package and version. If the module is a core
+one, suitable dependency on perl is returned.
+
+=cut
+
+sub find_perl_module_package {
+ my ( $self, $module, $version ) = @_;
+
+ # see if the module is included in perl core
+ my $core_dep = $self->find_core_perl_dependency( $module, $version );
+
+ return $core_dep if defined($core_dep);
+
+ # not a core module (or at least not in any perl release available in
+ # Debian)
+ # try module packages
my $module_file = $module;
$module_file =~ s|::|/|g;
Added: trunk/dh-make-perl/t/core-modules.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/core-modules.t?rev=37839&op=file
==============================================================================
--- trunk/dh-make-perl/t/core-modules.t (added)
+++ trunk/dh-make-perl/t/core-modules.t Mon Jun 8 04:35:48 2009
@@ -1,0 +1,20 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Debian::AptContents;
+
+my $apt = 'Debian::AptContents';
+
+is( $apt->find_core_perl_dependency('Module::CoreList'), 'perl (>= 5.10.0)',
+ 'Module::CoreList is in 5.10' );
+
+is( $apt->find_core_perl_dependency( 'Module::CoreList', '2.12' ), 'perl (>= 5.10.0)',
+ 'Module::CoreList 2.12 is in 5.10' );
+
+# 2.17 is in 5.8.9, which is not in Debian
+is( $apt->find_core_perl_dependency( 'Module::CoreList', '2.17' ), undef,
+ 'Module::CoreList 2.17 is not in core' );
Propchange: trunk/dh-make-perl/t/core-modules.t
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-perl-cvs-commits
mailing list