=cut
use strict;
+use File::Find;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
a path as possible. It will also create any subdirectories it needs to to put
the symlinks in.
+dh_link also scans the package build tree for existing symlinks which do not
+conform to debian policy, and corrects them (v4 only).
+
=head1 OPTIONS
=over 4
error("parameters list a link without a destination.");
}
+ # v4 only
+ if (! compat(3)) {
+ # Scan for existing links and add them to @links, so they
+ # are recreated policy conformant.
+ find(
+ sub {
+ return unless -l;
+ my $dir=$File::Find::dir;
+ $dir=~s/^\Q$tmp\E//;
+ my $target = readlink($_);
+ if ($target=~/^\//) {
+ push @links, $target;
+ }
+ else {
+ push @links, "$dir/$target";
+ }
+ push @links, "$dir/$_";
+ doit("rm","-f",$_);
+
+ },
+ $tmp);
+ }
+
while (@links) {
my $dest=pop @links;
my $src=pop @links;