summaryrefslogtreecommitdiff
path: root/dh_installchangelogs
diff options
context:
space:
mode:
authorjoey <joey>1999-09-06 05:47:41 +0000
committerjoey <joey>1999-09-06 05:47:41 +0000
commit37c69d4e7124fb03edf46bea4eb38f6721f2aa2a (patch)
tree2ab81f9330d3cb5b01d3600ec41d1f1988b17f68 /dh_installchangelogs
parentda7d6c32c080678dc672f7c6e680c11569f46eda (diff)
r266: * FHS complience. Patch from Johnie Ingram <johnie@netgod.net>.
For the most part, this was a straight-forward substitution, dh_installmanpages needed a non-obvious change though. * Closes: #42489, #42587, #41732. * dh_installdocs: Adds code to postinst and prerm as specified in http://www.debian.org/Lists-Archives/debian-ctte-9908/msg00038.html, to make /usr/doc/<package> a compatability symlink to /usr/share/doc/<package>. Note that currently if something exists in /usr/doc/<package> when the postinst is run, it will silently not make the symlink. I'm considering more intellingent handing of this case. * Note that if you build a package with this version of debhelper, it will use /usr/share/man, /usr/share/doc, and /usr/share/info. You may need to modify other files in your package that reference the old locations.
Diffstat (limited to 'dh_installchangelogs')
-rwxr-xr-xdh_installchangelogs69
1 files changed, 50 insertions, 19 deletions
diff --git a/dh_installchangelogs b/dh_installchangelogs
index 935a87a6..187e134c 100755
--- a/dh_installchangelogs
+++ b/dh_installchangelogs
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/usr/bin/perl -w
#
# Installs debian/changelog. If another filename is passed to it, installs
# that file as the upstream changelog.
@@ -7,26 +7,57 @@
# if so, the debian changelog is just installed as "changelog", and it is an
# error to specify an upstream changelog on the command line.
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
+BEGIN { push @INC, "debian", "/usr/share/debhelper" }
+use Dh_Lib;
+init();
-UPSTREAM=$1
+$upstream=shift;
-if [ "$NATIVE" -a "$UPSTREAM" ]; then
- error "Cannot specify an upstream changelog for a native package."
-fi
+if (isnative($dh{MAINPACKAGE}) && defined $upstream) {
+ error("Cannot specify an upstream changelog for a native debian package.");
+}
-if [ "$NATIVE" ]; then
- CHANGELOG_NAME=changelog
-else
- CHANGELOG_NAME=changelog.Debian
-fi
+if (isnative($dh{MAINPACKAGE})) {
+ $changelog_name='changelog';
+}
+else {
+ $changelog_name='changelog.Debian';
+}
-if [ ! -d debian/tmp/usr/doc/$PACKAGE ]; then
- doit "install -d debian/tmp/usr/doc/$PACKAGE"
-fi
-doit "install -p -m644 debian/changelog debian/tmp/usr/doc/$PACKAGE/$CHANGELOG_NAME"
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+ $TMP=tmpdir($PACKAGE);
+ $changelog=pkgfile($PACKAGE,"changelog");
-if [ "$UPSTREAM" ]; then
- doit "install -p -m644 $UPSTREAM debian/tmp/usr/doc/$PACKAGE/changelog"
-fi
+ if (!$changelog) {
+ $changelog="debian/changelog";
+ }
+
+ if (! -e $changelog) {
+ error("could not find changelog $changelog");
+ }
+
+ if (! -d "$TMP/usr/share/doc/$PACKAGE") {
+ doit("install","-d","$TMP/usr/share/doc/$PACKAGE");
+ }
+ doit("install","-o","root","-g","root","-p","-m644",$changelog,
+ "$TMP/usr/share/doc/$PACKAGE/$changelog_name");
+
+ if ($upstream) {
+ if ($upstream=~m/\.html?$/i) {
+ # HTML changelog
+ doit("install","-o","root","-g","root","-p","-m644",
+ $upstream,"$TMP/usr/share/doc/$PACKAGE/changelog.html");
+ doit("ln", "-sf", 'changelog.html',
+ "$TMP/usr/share/doc/$PACKAGE/changelog");
+ }
+ else {
+ doit("install","-o","root","-g","root","-p","-m644",
+ $upstream,"$TMP/usr/share/doc/$PACKAGE/changelog");
+ }
+ if ($dh{K_FLAG}) {
+ # Install symlink to original name of the upstream changelog file.
+ # Use basename in case original file was in a subdirectory or something.
+ doit("ln","-sf","changelog","$TMP/usr/share/doc/$PACKAGE/".Dh_Lib::basename($upstream));
+ }
+ }
+}