[dh-make-perl] 01/03: split simple module → package name into a separate routine

Damyan Ivanov dmn at alioth.debian.org
Thu Aug 8 15:44:23 UTC 2013


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository dh-make-perl.

commit 776fb4b3e2b01065ab3ac52467cc0bf33c24a9f6
Author: Damyan Ivanov <dmn at debian.org>
Date:   Thu Aug 8 17:02:45 2013 +0200

    split simple module → package name into a separate routine
---
 lib/Debian/Control/FromCPAN.pm      |   29 +++++++++++++++++++++++++++++
 lib/DhMakePerl/Command/Packaging.pm |    7 +------
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/lib/Debian/Control/FromCPAN.pm b/lib/Debian/Control/FromCPAN.pm
index 4135289..a669756 100644
--- a/lib/Debian/Control/FromCPAN.pm
+++ b/lib/Debian/Control/FromCPAN.pm
@@ -483,6 +483,35 @@ sub prune_perl_deps {
 
 =back
 
+=head1 CLASS METHODS
+
+=over
+
+=item module_name_to_pkg_name
+
+Receives a perl module name like C<Foo::Bar> and returns a suitable Debian
+package name for it, like C<libfoo-bar-perl>.
+
+=cut
+
+sub module_name_to_pkg_name {
+    my ( $self, $module ) = @_;
+
+    my $pkg = lc $module;
+
+    # ensure policy compliant names and versions (from Joeyh)...
+    $pkg =~ s/[^-.+a-zA-Z0-9]+/-/g;
+
+    $pkg =~ s/--+/-/g;
+
+    $pkg = 'lib' . $pkg unless $pkg =~ /^lib/;
+    $pkg .= '-perl';
+
+    return $pkg;
+}
+
+=back
+
 =head1 COPYRIGHT & LICENSE
 
 Copyright (C) 2009, 2010, 2012 Damyan Ivanov L<dmn at debian.org>
diff --git a/lib/DhMakePerl/Command/Packaging.pm b/lib/DhMakePerl/Command/Packaging.pm
index ca33a2e..adabea3 100644
--- a/lib/DhMakePerl/Command/Packaging.pm
+++ b/lib/DhMakePerl/Command/Packaging.pm
@@ -201,14 +201,9 @@ sub set_package_name {
       $pkgname = $self->cfg->packagename;
     }
     else {
-      $pkgname = lc $self->perlname;
-      $pkgname = 'lib' . $pkgname unless $pkgname =~ /^lib/;
-      $pkgname .= '-perl';
+        $pkgname = Debian::Control::FromCPAN->module_name_to_pkg_name( $self->perlname );
     }
 
-    # ensure policy compliant names and versions (from Joeyh)...
-    $pkgname =~ s/[^-.+a-zA-Z0-9]+/-/g;
-
     $self->control->source->Source($pkgname)
         unless $self->control->source->Source;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/dh-make-perl.git



More information about the Pkg-perl-cvs-commits mailing list