3 # Installs debian/changelog. If another filename is passed to it, installs
4 # that file as the upstream changelog.
6 # Looks at debian/control to determine if this is a native debian package,
7 # if so, the debian changelog is just installed as "changelog", and it is an
8 # error to specify an upstream changelog on the command line.
11 use Debian::Debhelper::Dh_Lib;
16 if (isnative($dh{MAINPACKAGE}) && defined $upstream) {
17 error("Cannot specify an upstream changelog for a native debian package.");
20 my $changelog_name="changelog.Debian";
21 if (isnative($dh{MAINPACKAGE})) {
22 $changelog_name='changelog';
25 foreach my $package (@{$dh{DOPACKAGES}}) {
26 my $tmp=tmpdir($package);
27 my $changelog=pkgfile($package,"changelog");
30 $changelog="debian/changelog";
33 if (! -e $changelog) {
34 error("could not find changelog $changelog");
37 if (! -d "$tmp/usr/share/doc/$package") {
38 # If it is a dangling symlink, then don't do anything.
39 # Think multi-binary packages that depend on each other and
40 # want to link doc dirs.
41 next if -l "$tmp/usr/share/doc/$package";
43 doit("install","-d","$tmp/usr/share/doc/$package");
45 doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
46 "$tmp/usr/share/doc/$package/$changelog_name");
50 if ($upstream=~m/\.html?$/i) {
52 doit("install","-o",0,"-g",0,"-p","-m644",
53 $upstream,"$tmp/usr/share/doc/$package/changelog.html");
54 complex_doit("lynx -dump $upstream > $tmp/usr/share/doc/$package/changelog");
55 $link_to='changelog.html';
58 doit("install","-o",0,"-g",0,"-p","-m644",
59 $upstream,"$tmp/usr/share/doc/$package/changelog");
63 # Install symlink to original name of the upstream changelog file.
64 # Use basename in case original file was in a subdirectory or something.
65 doit("ln","-sf",$link_to,"$tmp/usr/share/doc/$package/".basename($upstream));