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.
10 use Debian::Debhelper::Dh_Lib;
15 if (isnative($dh{MAINPACKAGE}) && defined $upstream) {
16 error("Cannot specify an upstream changelog for a native debian package.");
19 if (isnative($dh{MAINPACKAGE})) {
20 $changelog_name='changelog';
23 $changelog_name='changelog.Debian';
26 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
27 $TMP=tmpdir($PACKAGE);
28 $changelog=pkgfile($PACKAGE,"changelog");
31 $changelog="debian/changelog";
34 if (! -e $changelog) {
35 error("could not find changelog $changelog");
38 if (! -d "$TMP/usr/share/doc/$PACKAGE") {
39 # If it is a dangling symlink, then don't do anything.
40 # Think multi-binary packages that depend on each other and
41 # want to link doc dirs.
42 next if -l "$TMP/usr/share/doc/$PACKAGE";
44 doit("install","-d","$TMP/usr/share/doc/$PACKAGE");
46 doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
47 "$TMP/usr/share/doc/$PACKAGE/$changelog_name");
51 if ($upstream=~m/\.html?$/i) {
53 doit("install","-o",0,"-g",0,"-p","-m644",
54 $upstream,"$TMP/usr/share/doc/$PACKAGE/changelog.html");
55 complex_doit("lynx -dump $upstream > $TMP/usr/share/doc/$PACKAGE/changelog");
56 $link_to='changelog.html';
59 doit("install","-o",0,"-g",0,"-p","-m644",
60 $upstream,"$TMP/usr/share/doc/$PACKAGE/changelog");
64 # Install symlink to original name of the upstream changelog file.
65 # Use basename in case original file was in a subdirectory or something.
66 doit("ln","-sf",$link_to,"$TMP/usr/share/doc/$PACKAGE/".Debian::Debhelper::Dh_Lib::basename($upstream));