]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_perl
r1469: fix tag name
[debhelper.git] / dh_perl
diff --git a/dh_perl b/dh_perl
index 0614b9b8553a803f4f616ffa30247e6646143e0b..fa9c8eb097ab4ff603d79277d0482d89c558f74f 100755 (executable)
--- a/dh_perl
+++ b/dh_perl
@@ -3,12 +3,12 @@
 # Find dependencies on perl stuff
 # Remove .packlist files
 
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+BEGIN { push @INC, "debian", "/usr/share/debhelper" }
 use Dh_Lib;
 init();
 
-my $perl = $ENV{PERL} || '/usr/bin/perl';
 my $ext = '';
+my $lib_dir = 'usr/lib/perl5';
 
 # Figure out the version of perl. If $ENV{PERL} is set, query the perl binary
 # it points to, otherwise query perl directly.
@@ -17,6 +17,12 @@ if (defined $ENV{PERL}) {
        $version=`$ENV{PERL} -e 'printf "%.3f", \$]'`;
 }
 
+# Cleaning the paths given on the command line
+foreach (@ARGV) {
+       s#/$##;
+       s#^/##;
+}
+
 # If -d is given, then we'll try to depend on one of the perl-5.00X-base 
 # package instead of perl-5.00X
 $ext='-base' if ($dh{'D_FLAG'});
@@ -30,17 +36,24 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        my $dep = '';
        my $found = 0;
 
+       # Check also for alternate locations given on the command line
+       my $dirs = '';
+       foreach ($lib_dir, @ARGV) {
+               $dirs .= "$TMP/$_ " if (-d "$TMP/$_");
+       }
+       my $re = '(?:' . join('|', ($lib_dir, @ARGV)) . ')';
+
        # Look for perl modules and check where they are installed
-       if (-d "$TMP/usr/lib/perl5") {
-           foreach $file (split(/\n/,`find $TMP/usr/lib/perl5 -type f \\( -name "*.pm" -or -name "*.so" \\)`)) {
+       if ($dirs) {
+           foreach $file (split(/\n/,`find $dirs -type f \\( -name "*.pm" -or -name "*.so" \\)`)) {
                $found++;
-               if ($file =~ m<^$TMP/usr/lib/perl5/(\d\.\d{3})/([^/]+)/>) {
+               if ($file =~ m<^$TMP/$re/(\d\.\d{3})/([^/]+)/>) {
                        $v = $1;
                        $arch = $2;
                        check_module_version ($v, $version);
                        $v .= '-thread' if ($arch =~ /-thread/); 
                        $dep_arch = add_deps ($dep_arch, "perl-$v");
-               } elsif ($file =~ m<^$TMP/usr/lib/perl5/(\d.\d{3})/>) {
+               } elsif ($file =~ m<^$TMP/$re/(\d.\d{3})/>) {
                        $v = $1;
                        check_module_version ($v, $version);
                        $dep_arch = add_deps ($dep_arch, "perl-$v");