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>] [B<-X>I<item>] [I<upstream>]
18 dh_installchangelogs is a debhelper program that is responsible for
19 installing changelogs into package build directories.
21 An upstream changelog file may be specified as an option. If none is
22 specified, a few common filenames are tried. (In compatibility level 7 and
25 If there is an upstream changelog file, it will be be installed as
26 usr/share/doc/package/changelog in the package build directory. If the
27 changelog is a html file (determined by file extension), it will be
28 installed as usr/share/doc/package/changelog.html instead, and will be
29 converted to plain text with html2text to generate
30 usr/share/doc/package/changelog.
36 =item debian/changelog
40 =item debian/I<package>.changelog
42 =item debian/I<package>.NEWS
44 Automatically installed into usr/share/doc/I<package>/
45 in the package build directory.
47 Use the package specific name if I<package> needs a different
48 NEWS or changelog file.
50 The changelog file is installed with a name of changelog
51 for native packages, and changelog.Debian for non-native packages.
52 The NEWS file is always installed with a name of NEWS.Debian.
60 =item B<-k>, B<--keep>
62 Keep the original name of the upstream changelog. This will be accomplished
63 by installing the upstream changelog as "changelog", and making a symlink from
64 that to the original name of the changelog file. This can be useful if the
65 upstream changelog has an unusual name, or if other documentation in the
66 package refers to the changelog file.
68 =item B<-Xitem>, B<--exclude=item>
70 Exclude upstream changelog files that contain "item" anywhere in their
71 filename from being installed.
75 Install this file as the upstream changelog.
84 my $changelog_name="changelog.Debian";
85 if (! defined $upstream) {
86 if (! isnative($dh{MAINPACKAGE}) && !compat(6)) {
87 my @files=sort glob("*");
88 foreach my $name (qw{changelog changes changelog.txt changes.txt}) {
90 lc $_ eq $name && -s $_ && ! excludefile($_)
93 $upstream=shift @matches;
98 if (isnative($dh{MAINPACKAGE})) {
99 $changelog_name='changelog';
102 my $news_name="NEWS.Debian";
104 foreach my $package (@{$dh{DOPACKAGES}}) {
105 next if is_udeb($package);
107 my $tmp=tmpdir($package);
108 my $changelog=pkgfile($package,"changelog");
109 my $news=pkgfile($package,"NEWS");
112 $changelog="debian/changelog";
118 if (! -e $changelog) {
119 error("could not find changelog $changelog");
122 if (! -d "$tmp/usr/share/doc/$package") {
123 # If it is a dangling symlink, then don't do anything.
124 # Think multi-binary packages that depend on each other and
125 # want to link doc dirs.
126 next if -l "$tmp/usr/share/doc/$package";
128 doit("install","-d","$tmp/usr/share/doc/$package");
130 doit("install","-o",0,"-g",0,"-p","-m644",$changelog,
131 "$tmp/usr/share/doc/$package/$changelog_name");
133 doit("install","-o",0,"-g",0,"-p","-m644",$news,
134 "$tmp/usr/share/doc/$package/$news_name");
137 if (defined $upstream) {
139 if ($upstream=~m/\.html?$/i) {
141 doit("install","-o",0,"-g",0,"-p","-m644",
142 $upstream,"$tmp/usr/share/doc/$package/changelog.html");
143 doit("html2text","-nobs","-o","$tmp/usr/share/doc/$package/changelog",$upstream);
144 $link_to='changelog.html';
147 doit("install","-o",0,"-g",0,"-p","-m644",
148 $upstream,"$tmp/usr/share/doc/$package/changelog");
149 $link_to='changelog';
152 # Install symlink to original name of the upstream changelog file.
153 # Use basename in case original file was in a subdirectory or something.
154 doit("ln","-sf",$link_to,"$tmp/usr/share/doc/$package/".basename($upstream));
163 This program is a part of debhelper.
167 Joey Hess <joeyh@debian.org>