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 debian NEWS files. If there is a debian/NEWS file, it is installed as
30 usr/share/doc/package/NEWS for native packages, and as
31 usr/share/doc/package/NEWS.Debian for non-native packages. debian/package.NEWS
32 files can also be used.
34 If an upstream changelog file is specified as an option, and the package is
35 not a native debian package, then this upstream changelog will be installed
36 as usr/share/doc/package/changelog in the package build directory. If the
37 changelog is a html file (determined by file extension), it will be
38 installed as usr/share/doc/package/changelog.html instead, and will be
39 converted to plain text with html2text to generate
40 usr/share/doc/package/changelog.
46 =item B<-k>, B<--keep>
48 Keep the original name of the upstream changelog. This will be accomplished
49 by installing the upstream changelog as "changelog", and making a symlink from
50 that to the original name of the changelog file. This can be useful if the
51 upstream changelog has an unusual name, or if other documentation in the
52 package refers to the changelog file.
56 Install this file as the upstream changelog.
62 It is an error to specify an upstream changelog file for a debian native
71 if (isnative($dh{MAINPACKAGE}) && defined $upstream) {
72 error("Cannot specify an upstream changelog for a native debian package.");
75 my $changelog_name="changelog.Debian";
76 my $news_name="NEWS.Debian";
77 if (isnative($dh{MAINPACKAGE})) {
78 $changelog_name='changelog';
82 foreach my $package (@{$dh{DOPACKAGES}}) {
83 my $tmp=tmpdir($package);
84 my $changelog=pkgfile($package,"changelog");
85 my $news=pkgfile($package,"NEWS");
88 $changelog="debian/changelog";
94 if (! -e $changelog) {
95 error("could not find changelog $changelog");
98 if (! -d "$tmp/usr/share/doc/$package") {
99 # If it is a dangling symlink, then don't do anything.
100 # Think multi-binary packages that depend on each other and
101 # want to link doc dirs.
102 next if -l "$tmp/usr/share/doc/$package";
104 doit("install","-d","$tmp/usr/share/doc/$package");
106 doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
107 "$tmp/usr/share/doc/$package/$changelog_name");
109 doit("install","-o",0,"-g",0,"-p","-m644",$news,
110 "$tmp/usr/share/doc/$package/$news_name");
115 if ($upstream=~m/\.html?$/i) {
117 doit("install","-o",0,"-g",0,"-p","-m644",
118 $upstream,"$tmp/usr/share/doc/$package/changelog.html");
119 doit("html2text","-nobs","-o","$tmp/usr/share/doc/$package/changelog",$upstream);
120 $link_to='changelog.html';
123 doit("install","-o",0,"-g",0,"-p","-m644",
124 $upstream,"$tmp/usr/share/doc/$package/changelog");
125 $link_to='changelog';
128 # Install symlink to original name of the upstream changelog file.
129 # Use basename in case original file was in a subdirectory or something.
130 doit("ln","-sf",$link_to,"$tmp/usr/share/doc/$package/".basename($upstream));
139 This program is a part of debhelper.
143 Joey Hess <joeyh@debian.org>