r27283 - /trunk/dh-make-perl/dh-make-perl

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Nov 26 09:39:35 UTC 2008


Author: dmn
Date: Wed Nov 26 09:39:33 2008
New Revision: 27283

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27283
Log:
extend AptContents so that one can search by both file name and module name

Modified:
    trunk/dh-make-perl/dh-make-perl

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=27283&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Wed Nov 26 09:39:33 2008
@@ -213,7 +213,7 @@
     rename( "$homedir/Contents.cache.new", "$homedir/Contents.cache" );
 }
 
-sub find {
+sub find_file_packages {
     my( $self, $file ) = @_;
 
     my $packages = $self->cache->{apt_contents}{$file};
@@ -227,6 +227,24 @@
     s{[^/]+/}{} for @packages;  # remove section
 
     return @packages;
+}
+
+sub find_perl_module_package {
+    my ( $self, $module ) = @_;
+
+    my $module_file = $module;
+    $module_file =~ s|::|/|g;
+
+    my @matches = $self->find_file_packages("$module_file.pm");
+
+    # rank non -perl packages lower
+    @matches = sort {
+        if    ( $a !~ /-perl: / ) { return 1; }
+        elsif ( $b !~ /-perl: / ) { return -1; }
+        else                      { return $a cmp $b; }    # or 0?
+    } @matches;
+
+    return $matches[0];
 }
 
 1;




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