From 67b74298f08a3e2b30e43cbcd7cdaccc2e1b1614 Mon Sep 17 00:00:00 2001 From: joey Date: Thu, 2 Mar 2000 21:23:22 +0000 Subject: r338: * Patch from Jorgen `forcer' Schaefer (much modified)to make dh_installwm use new window manager registration method, update-alternatives. Closes: #52156, #34684 (latter bug is obsolete) * Fixed $dh{flavor} to be upper-case. * Deprecated dh_installemavcsen --number; use --priority instead. Also, the option parser requires the parameter be a number now. And, dh_installwm now accepts --priority, and window manager packages should start using it. * dh_installwm now behaves like a proper debhelper command, and reads debian/.wm too. This is a small behavior change; filenames specified on the command line no longer apply to all packages it acts on. I can't belive this program existed for 2 years with such a glaring problem; I guess most people don't need ot register 5 wm's in 3 sub-packages. Anyway, it can handle such things now. :-) * Moved Dh_*.pm to /usr/lib/perl5/Debian/Debhelper. *big* change. --- dh_perl | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 14 deletions(-) (limited to 'dh_perl') diff --git a/dh_perl b/dh_perl index 4136414f..dc614e45 100755 --- a/dh_perl +++ b/dh_perl @@ -3,12 +3,28 @@ # Find dependencies on perl stuff # Remove .packlist files -BEGIN { push @INC, "debian", "/usr/lib/debhelper" } -use Dh_Lib; +use Debian::Debhelper::Dh_Lib; init(); -my $perl = $ENV{'PERL'} || '/usr/bin/perl'; -$version=sprintf("%.3f", $]); +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. +my $version=sprintf("%.3f", $]); +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'}); foreach $PACKAGE (@{$dh{DOPACKAGES}}) { $TMP=tmpdir($PACKAGE); @@ -19,17 +35,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"`)) { + 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/); + $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"); @@ -38,7 +61,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { } if ($found and not $dep_arch) { - $dep = "perl5"; + $dep = "perl5$ext"; } elsif ($dep_arch) { $dep = $dep_arch; } @@ -68,14 +91,14 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { next unless $dep; - if (-e "debian/$EXT\subtsvars") { - open (IN, "; close IN; - open (OUT, ">debian/$EXT\subtsvars"); + open (OUT, ">debian/$EXT\substvars"); print OUT @lines; } else { - open (OUT, ">debian/$EXT\subtsvars"); + open (OUT, ">debian/$EXT\substvars"); } print OUT "perl:Depends=$dep\n"; close OUT; @@ -84,6 +107,9 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { sub add_deps { my ($dep, $new) = @_; + # If the $new-base package can exist then add $ext to $new + $new = "$new$ext" if ($new =~ m/^(?:perl5|perl-\d\.\d{3})$/); + # If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)? # is not already in the dependencies if ($new eq "perl5") { -- cgit v1.2.3