summaryrefslogtreecommitdiff
path: root/dh_perl
diff options
context:
space:
mode:
authorjoey <joey>2001-08-24 23:26:03 +0000
committerjoey <joey>2001-08-24 23:26:03 +0000
commitcad668da2afa9d3650429b149764d819f7ef633a (patch)
tree034e4d4cf13e65ca37b8e492399a5b29b8082566 /dh_perl
parent1f33258d1a687b64d7252fc144c2dd5530740272 (diff)
r488: * dh_perl: made it use doit commands so -v mode works. Yeah, uglier.
Closes: #92826 Also some indentation fixes.
Diffstat (limited to 'dh_perl')
-rwxr-xr-xdh_perl69
1 files changed, 30 insertions, 39 deletions
diff --git a/dh_perl b/dh_perl
index bb2dd69..4292029 100755
--- a/dh_perl
+++ b/dh_perl
@@ -88,11 +88,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp = tmpdir($package);
my $ext = pkgext($package);
- my @subs;
- if (open IN, "debian/${ext}substvars")
- {
- @subs = grep !/^perl:Depends=/, <IN>;
- close IN;
+ # For idempotency, remove anything this program might have
+ # previously added to the substvars file.
+ if (-e "debian/${ext}substvars") {
+ complex_doit("grep -v ^perl:Depends= debian/${ext}substvars > debian/${ext}substvars.new || true");
+ doit("mv", "debian/${ext}substvars.new","debian/${ext}substvars");
}
# Check also for alternate locations given on the command line
@@ -104,49 +104,40 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
return unless -f;
$deps |= PM_MODULE if /\.pm$/;
$deps |= XS_MODULE if /\.so$/;
- }, @dirs if @dirs;
+ }, @dirs if @dirs;
# find scripts
find sub {
return unless -f and (-x or /\.pl$/);
local *F;
return unless open F, $_;
- if (read F, local $_, 32 and m%^#!\s*/usr/bin/perl\s%)
- {
- $deps |= PROGRAM;
+ if (read F, local $_, 32 and m%^#!\s*/usr/bin/perl\s%) {
+ $deps |= PROGRAM;
}
-
close F;
- }, $tmp;
-
- if ($deps)
- {
- my $perl_depends = $perl;
- if ($deps & XS_MODULE or $dh{V_FLAG_SET})
- {
- ($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m
- unless $version;
-
- $perl_depends .= " (>= $version)";
- }
- elsif ($deps & PM_MODULE)
- {
- $perl_depends .= " (>= $min_version)";
- }
-
- # add perlapi-<ver> for XS modules
- $perl_depends .= ", perlapi-$Config{version}"
- if $deps & XS_MODULE;
-
- # don't need to depend on an un-versioned perl-base, it's
- # essential
- push @subs, "perl:Depends=$perl_depends\n"
- unless $perl_depends eq 'perl-base';
- }
+ }, $tmp;
+
+ if ($deps) {
+ my $perl_depends = $perl;
+ if ($deps & XS_MODULE or $dh{V_FLAG_SET}) {
+ ($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m
+ unless $version;
+ $perl_depends .= " (>= $version)";
+ }
+ elsif ($deps & PM_MODULE) {
+ $perl_depends .= " (>= $min_version)";
+ }
- open OUT, ">debian/${ext}substvars";
- print OUT @subs;
- close OUT;
+ # add perlapi-<ver> for XS modules
+ $perl_depends .= ", perlapi-$Config{version}"
+ if $deps & XS_MODULE;
+
+ # don't need to depend on an un-versioned perl-base, it's
+ # essential
+ unless ($perl_depends eq 'perl-base') {
+ complex_doit("echo 'perl:Depends=$perl_depends' >> debian/${ext}substvars");
+ }
+ }
}
=head1 SEE ALSO