]> git.donarmstrong.com Git - debhelper.git/commitdiff
recode manual pages to UTF-8
authorColin Watson <cjwatson@debian.org>
Mon, 28 Jan 2008 21:31:35 +0000 (16:31 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 28 Jan 2008 21:31:35 +0000 (16:31 -0500)
I uploaded man-db 2.5.1-1 to incoming this morning, so I think we can
now proceed with the plan we discussed a while back:

  http://lists.debian.org/debian-i18n/2007/10/msg00063.html

I've attached a patch against git HEAD that recodes all manual pages to
UTF-8 on installation. I've tested this with debconf and it seems to be
doing the right thing. I suspect a small number of packages that have
inconsistently-encoded manual pages will fail to build as a result of
this, but I believe that these are rather few and I contend that they
were buggy anyway (as man would fail to display those pages).

The reason for the slightly baroque installation method (install file,
man --recode to .new, mv back) is that this allows man to guess the
encoding based on the installation directory.

Note that the original (non-.UTF-8) installation directories are
retained, per the latest discussion in #440420.

debian/control
dh_installman

index 1b707b277bc2b19542594181af4a8b7ae7c0ae25..1a8ffe88bd8f7f6f0df747a6940a3093cea23ccf 100644 (file)
@@ -9,7 +9,7 @@ Homepage: http://kitenet.net/~joey/code/debhelper/
 
 Package: debhelper
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23-1), dpkg-dev (>= 1.14.15), html2text, binutils, po-debconf
+Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23-1), dpkg-dev (>= 1.14.15), html2text, binutils, po-debconf, man-db (>= 2.5.1-1)
 Suggests: dh-make
 Conflicts: dpkg-cross (<< 1.18), python-support (<< 0.5.3), python-central (<< 0.5.6)
 Description: helper programs for debian/rules
index 2ce0e377fa70dd3030e13508fa25f6582c3bceec..55c573701d5f33af3b441f51584812ce892cbb17 100755 (executable)
@@ -38,6 +38,11 @@ like /usr/share/man/pl/man1/, that is because your program has a
 name like "foo.pl", and dh_installman assumes that means it is translated
 into Polish. Use --language=C to avoid this.
 
+dh_installman will use man to guess the character encoding of each manual
+page and convert it to UTF-8. If the guesswork fails for some reason, you
+can override it using an encoding declaration. See L<manconv(1)> for
+details.
+
 Any man page filenames specified as parameters will be installed into the
 first package dh_installman is told to act on. By default, this is the
 first binary package in debian/control, but if you use -p, -i, or -a flags,
@@ -162,16 +167,23 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                        $destdir="$tmp/usr/share/man/$langcode/man$realsection/";
                }
                $destdir=~tr:/:/:s; # just for looks
+               my $instpage="$destdir/$instname.$section";
 
-               next if -l "$destdir/$instname.$section";
-               next if compat(5) && -e "$destdir/$instname.$section";
+               next if -l $instpage;
+               next if compat(5) && -e $instpage;
 
                if (! -d $destdir) {
                        doit "install","-d",$destdir;
                }
-               doit "install","-p","-m644",$page,
-                       "$destdir$instname.$section$gz";
-               
+               if ($gz) {
+                       complex_doit "zcat \Q$page\E > \Q$instpage\E";
+               }
+               else {
+                       doit "install","-p","-m644",$page,$instpage;
+               }
+               complex_doit "man --recode UTF-8 \Q$instpage\E > \Q$instpage.new\E";
+               doit "chmod",644,"$instpage.new";
+               doit "mv","$instpage.new",$instpage;
        }
 
        # Now the .so conversion.