5 dh_installchangelogs - install changelogs into package build directories
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installchangelogs> [S<I<debhelper options>>] [B<-k>] [I<upstream>]
18 dh_installchangelogs is a debhelper program that is responsible for
19 installing changelogs into package build directories.
21 dh_installchangelogs determines if the package is a debian native package,
22 and if so, it installs debian/changelog into usr/share/doc/package/changelog
23 in the package build directory. Otherwise, it installs debian/changelog
24 into usr/share/doc/package/changelog.Debian in the package build directory. (If
25 files named debian/package.changelog exist, they will be used in preference
28 Parallelling the debian changelog handling, this program also takes care of
29 NEWS.Debian files. If there is a debian/NEWS file, it is installed as
30 usr/share/doc/package/NEWS.Debian. debian/package.NEWS files can also be
33 If an upstream changelog file is specified as an option, then this upstream
34 changelog will be installed as usr/share/doc/package/changelog in the
35 package build directory. If the changelog is a html file (determined by
36 file extension), it will be installed as
37 usr/share/doc/package/changelog.html instead, and will be converted to
38 plain text with html2text to generate usr/share/doc/package/changelog.
44 =item B<-k>, B<--keep>
46 Keep the original name of the upstream changelog. This will be accomplished
47 by installing the upstream changelog as "changelog", and making a symlink from
48 that to the original name of the changelog file. This can be useful if the
49 upstream changelog has an unusual name, or if other documentation in the
50 package refers to the changelog file.
54 Install this file as the upstream changelog.
64 my $changelog_name="changelog.Debian";
65 if (isnative($dh{MAINPACKAGE}) && ! defined $upstream) {
66 $changelog_name='changelog';
68 my $news_name="NEWS.Debian";
70 foreach my $package (@{$dh{DOPACKAGES}}) {
71 next if is_udeb($package);
73 my $tmp=tmpdir($package);
74 my $changelog=pkgfile($package,"changelog");
75 my $news=pkgfile($package,"NEWS");
78 $changelog="debian/changelog";
84 if (! -e $changelog) {
85 error("could not find changelog $changelog");
88 if (! -d "$tmp/usr/share/doc/$package") {
89 # If it is a dangling symlink, then don't do anything.
90 # Think multi-binary packages that depend on each other and
91 # want to link doc dirs.
92 next if -l "$tmp/usr/share/doc/$package";
94 doit("install","-d","$tmp/usr/share/doc/$package");
96 doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
97 "$tmp/usr/share/doc/$package/$changelog_name");
99 doit("install","-o",0,"-g",0,"-p","-m644",$news,
100 "$tmp/usr/share/doc/$package/$news_name");
105 if ($upstream=~m/\.html?$/i) {
107 doit("install","-o",0,"-g",0,"-p","-m644",
108 $upstream,"$tmp/usr/share/doc/$package/changelog.html");
109 doit("html2text","-nobs","-o","$tmp/usr/share/doc/$package/changelog",$upstream);
110 $link_to='changelog.html';
113 doit("install","-o",0,"-g",0,"-p","-m644",
114 $upstream,"$tmp/usr/share/doc/$package/changelog");
115 $link_to='changelog';
118 # Install symlink to original name of the upstream changelog file.
119 # Use basename in case original file was in a subdirectory or something.
120 doit("ln","-sf",$link_to,"$tmp/usr/share/doc/$package/".basename($upstream));
129 This program is a part of debhelper.
133 Joey Hess <joeyh@debian.org>