[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Translated manual pages & dh_installman behaviour



On Wed, 15 Feb 2012, Raphael Hertzog wrote:
> On Wed, 15 Feb 2012, Joey Hess wrote:
> > If your manual pages are already being installed to the correct
> > directories, you don't need to use dh_installman to install them,
> > you can just use dh_install. dh_installman will find man pages installed
> > by dh_install and do utf-8 fixups etc to them as needed.
> 
> We used to do that but we no longer can because dh_install treats a glob
> matching no files as an error and the translated manual pages come & go
> based on the percentage of completenees of each translation (wich itself
> varies based on the changes that we do when we update the english manual
> page).
> 
> Our first solution for this was to hack up a glob with a brace which
> included the always existing english manual page:
> debian/tmp/usr/share/man/{*,*/*}/dpkg-divert.8
> 
> While this was working, it was not officially supported and we only discovered
> it when lintian started warning about it.
> 
> Cf the discussion in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=642129
> 
> (And as indicated in the commit message, we're not really interested in
> making debian/dpkg.install a script just to allow for proper installation
> of optional files)
> 
> Thus I'm suggesting this dh_installman enhancement as a compromise. It
> does look reasonable to me.

So, Joey, would you accept the attached patch or should I hack around both
limitations?

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/liberation/
>From 70ba13e2d4b689f01fe29bd6e10df2210e76d214 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Thu, 23 Feb 2012 23:01:06 +0100
Subject: [PATCH] dh_installman: try to guess the language from the source
 path as fallback

---
 debian/changelog |    5 +++++
 dh_installman    |    9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 13bdc7f..f64f3cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,14 @@
 debhelper (9.20120116) UNRELEASED; urgency=low
 
+  [ Joey Hess ]
   * dh_auto_install: Set AM_UPDATE_INFO_DIR=no to avoid automake
     generating an info dir file. Closes: #634741
   * dh_install: Man page clarification. Closes: #659635
 
+  [ Raphaël Hertzog ]
+  * dh_installman can now guess the language from the path of the manual
+    page.
+
  -- Joey Hess <joeyh@debian.org>  Wed, 08 Feb 2012 13:46:13 -0400
 
 debhelper (9.20120115) unstable; urgency=low
diff --git a/dh_installman b/dh_installman
index e118281..c59a058 100755
--- a/dh_installman
+++ b/dh_installman
@@ -27,7 +27,8 @@ extension of F<.3perl>). If your B<.TH> line is incorrect or missing, the progra
 may guess wrong based on the file extension.
 
 It also supports translated man pages, by looking for extensions
-like F<.ll.8> and F<.ll_LL.8>, or by use of the B<--language> switch.
+like F<.ll.8> and F<.ll_LL.8>, by looking for source paths like
+F<.../man/ll/man8/>, or by use of the B<--language> switch.
 
 If B<dh_installman> seems to install a man page into the wrong section or with
 the wrong extension, this is because the man page has the wrong section
@@ -153,6 +154,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			# language code to the filename, so detect that and
 			# redirect to appropriate directory, stripping the code.
 			($langcode)=$basename=~m/.*\.([a-z][a-z](?:_[A-Z][A-Z])?)\.(?:[1-9]|man)/;
+			# Alternatively the language code might already be
+			# available in the source path
+			my $dirname=dirname($page);
+			if ($dirname=~m{/man/([a-z][a-z](?:_[A-Z][A-Z])?)/man\d$}) {
+				$langcode=$1 unless defined $langcode;
+			}
 		}
 		elsif ($dh{LANGUAGE} ne 'C') {
 			$langcode=$dh{LANGUAGE};
-- 
1.7.9.1


Reply to: