1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/usr/bin/perl
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
use Debian::Control;
=head1 NAME
dh_perl6_depsfile -- create rakudo helper dependency file for perl 6 module packages
=head1 SYNOPSIS
B<dh_perl6_depsfile>
=head1 DESCRIPTION
This debhelper script will infer all perl6 module dependencies of the
package currently built, and place these, one per line, in
/usr/share/perl6/debian-sources/<package>/<package>.p6deps. rakudo-helper.pl
from the rakudo package, typically called from postinst and postrm, uses this
file to understand dependencies of packages and use them to order
precompilation file generation and removal.
=head1 SEE ALSO
L<dh_perl6_maintscript>(1), L<dh_perl6_test>(1), L<debhelper>(7), L<dh>(1)
=cut
my $control = Debian::Control->new();
$control->read("debian/control");
foreach my $binary_package (sort keys %{$control->{binary}}) {
my $target_dir = tmpdir($binary_package) . "/usr/share/perl6/debian-sources/$binary_package";
install_dir($target_dir);
open(my $fh, '>', "$target_dir/$binary_package.p6deps") or die "Could not open file: $!";
foreach my $dep (sort grep {defined $_ } map { $_->pkg } @{$control->{binary}->{$binary_package}->Depends}) {
if ($dep =~ /^(raku|perl6)-/) {
print $fh $dep . "\n";
}
}
close($fh);
}
|