summaryrefslogtreecommitdiff
path: root/dh_installchangelogs
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2009-09-08 12:17:02 +0100
committerJoey Hess <joey@gnu.kitenet.net>2009-09-08 17:52:20 -0400
commit7e3a133029e9cbb6fb133c7074ad1bb53a5947e9 (patch)
tree0cc137aeccf244d95783338f9667f96266b1d27a /dh_installchangelogs
parent9ea927f370855991287d2ef6383cfbaafbdc830e (diff)
Bug#545676: dh_installdocs: option to link documentation directories
As discussed by e-mail, dh_installdocs could do with an option to make the documentation directory a symlink, to clean up dh-using packages that otherwise need to use override targets to arrange for dh_link to run before dh_installdocs. This turns out to be slightly involved due to the need to handle the case where you want to do this *and* also install some extra documentation in the symlink target, while also making a dangling symlink and avoiding file conflicts in the simple case, so I had to change dh_installchangelogs as well. I think this is right now; tested on debconf ('dh_installdocs -Ndebconf-doc --link-doc=debconf; dh_installdocs -pdebconf-doc') and groff ('dh_installdocs --link-doc=groff-base').
Diffstat (limited to 'dh_installchangelogs')
-rwxr-xr-xdh_installchangelogs20
1 files changed, 15 insertions, 5 deletions
diff --git a/dh_installchangelogs b/dh_installchangelogs
index 27e433c0..4bf97dcc 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -119,12 +119,22 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
error("could not find changelog $changelog");
}
- if (! -d "$tmp/usr/share/doc/$package") {
- # If it is a dangling symlink, then don't do anything.
- # Think multi-binary packages that depend on each other and
- # want to link doc dirs.
- next if -l "$tmp/usr/share/doc/$package";
+ # If it is a symlink to a documentation directory from the same
+ # source package, then don't do anything. Think multi-binary
+ # packages that depend on each other and want to link doc dirs.
+ if (-l "$tmp/usr/share/doc/$package") {
+ my $linkval=readlink("$tmp/usr/share/doc/$package");
+ my %allpackages=map { $_ => 1 } getpackages();
+ if ($allpackages{basename($linkval)}) {
+ next;
+ }
+ # Even if the target doesn't seem to be a doc dir from the
+ # same source package, don't do anything if it's a dangling
+ # symlink.
+ next unless -d "$tmp/usr/share/doc/$package";
+ }
+ if (! -d "$tmp/usr/share/doc/$package") {
doit("install","-d","$tmp/usr/share/doc/$package");
}
doit("install","-o",0,"-g",0,"-p","-m644",$changelog,