r29553 - in /trunk/dh-make-perl: dh-make-perl lib/DhMakePerl.pm lib/DhMakePerl/Config.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sat Jan 10 20:05:55 UTC 2009


Author: dmn
Date: Sat Jan 10 20:05:52 2009
New Revision: 29553

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29553
Log:
add --locate command

reports whether given Perl module is core or in which Debian package
(if any)

Modified:
    trunk/dh-make-perl/dh-make-perl
    trunk/dh-make-perl/lib/DhMakePerl.pm
    trunk/dh-make-perl/lib/DhMakePerl/Config.pm

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=29553&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Sat Jan 10 20:05:52 2009
@@ -21,6 +21,8 @@
 =item dh-make-perl [--make] {I<SOURCE_DIR> | --cpan I<MODULE>} I<options...>
 
 =item dh-make-perl --refresh I<options...>
+
+=item dh-make-perl --locate Foo::Bar
 
 =item dh-make-perl --refresh-cache
 
@@ -82,6 +84,13 @@
 doesn't contain much customisations. As always, you're strongly encouraged to
 verify if F<debian/rules> looks sane.
 
+=item --locate I<MODULE>
+
+Tries to locate the package that conains the given Perl I<MODULE>.
+
+Example:
+
+    dh-make-perl --locate IPC::Run3
 
 =item --refresh-cache
 

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=29553&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Sat Jan 10 20:05:52 2009
@@ -178,6 +178,39 @@
         $self->create_copyright("$debiandir/copyright");
         print "--- Done\n" if $self->cfg->verbose;
         return 0;
+    }
+
+    if ( $self->cfg->command eq 'locate' ) {
+        @ARGV == 1
+            or die
+                 "--locate command requires exactly one non-option argument\n";
+
+        my $apt_contents = $self->get_apt_contents;
+
+        unless ($apt_contents) {
+            die <<EOF;
+Unable to locate module packages, because APT Contents files
+are not available on the system.
+
+Install the 'apt-file' package, run 'apt-file update' as root
+and rettry.
+EOF
+        }
+        my $mod = $ARGV[0];
+
+        if ( defined( my $core_since = $self->is_core_module($mod) ) ) {
+            print "$mod is in Perl core (package perl-modules)";
+            print $core_since ? " since $core_since\n" : "\n";
+            return 0;
+        }
+
+        if ( my $pkg = $apt_contents->find_perl_module_package($mod) ) {
+            print "$mod is in $pkg package\n";
+            return 0;
+        }
+
+        print "$mod is not found in any Debian package\n";
+        return 1;
     }
 
     $self->load_overrides();

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=29553&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Config.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Config.pm Sat Jan 10 20:05:52 2009
@@ -24,7 +24,7 @@
     'verbose!',        'version=s',
 );
 
-use constant commands => ( 'refresh|R', 'refresh-cache', 'dump-config' );
+use constant commands => ( 'refresh|R', 'refresh-cache', 'dump-config', 'locate' );
 
 __PACKAGE__->mk_accessors(
     do {




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