summaryrefslogtreecommitdiff
path: root/dh_perl
diff options
context:
space:
mode:
Diffstat (limited to 'dh_perl')
-rwxr-xr-xdh_perl23
1 files changed, 18 insertions, 5 deletions
diff --git a/dh_perl b/dh_perl
index 735711c3..fa9c8eb0 100755
--- a/dh_perl
+++ b/dh_perl
@@ -7,8 +7,8 @@ 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");