dpkg-gentdeb

Langue: en

Version: 2009-04-14 (debian - 07/07/09)

Section: 1 (Commandes utilisateur)

NAME

dpkg-gentdeb - generate Debian TDeb translation packages and source.

SYNOPSIS

dpkg-gentdeb
  Copyright (C) 2007-2008  Neil Williams <codehelp@debian.org>
 
  This package is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
 
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
 
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 

DESCRIPTION

dpkg-gentdeb is a dpkg-dev add-on created by Emdebian to create translation packages (tdebs). dpkg-gentdeb is intended to separate out the individual translation files from the current Debian packages into packages without any translation files and a single TDeb locale packages, one per source package.

This script is a mix of dpkg and debhelper abstractions that simply provides some tdebs until the main packages are updated. As such, it contains some code that needs to be implemented in debhelper (identification of po files) and some that need to be in dpkg (packing up the .mo files into the .tdeb itself). Therefore, a large part of this script needs to be implemented as dh_gentdeb.

Generated packages use the syntax:
 $srcpackage-locale_$version_all.tdeb

(Note that Debian TDebs are architecture-independent, Emdebian TDebs are architecture-dependent.)

Once a package uses dpkg-gentdeb, translation files should be removed from all packages in the normal build. This includes all translated manpages and other translated content. Original, untranslated, content should remain.

dpkg-gentdeb runs as a part of the normal package build - simply add the call to the binary-indep target of debian/rules, usually after dh_install and before dh_builddeb. dpkg-gentdeb handles locating the relevant files, a .install file is not normally necessary.

Support for a tdeb diff1.gz will be added as dpkg-gentdeb develops. The extra diff is used by translators to build updated or new tdeb packages. Tdeb packages depend on the source:Version of the mainpackage but no packages may depend upon the tdeb. (Not even other TDebs). The mainpackage can be specified using the -p option.

Use of diff1.gz should remove the need to create a customised source with a debian/rules stub etc. by allowing Emdebian TDebs to be created during an Emdebian build and Debian TDebs in a Debian build. Translators would then be able to use:

  $ apt-get source $package
  $ cd $package-$version/
  $ poedit po/$lang.po
 
 

To build the package, either dpkg-gentdeb can behave as em_installtdeb does now and run a build only of the TDeb components or dpkg-buildpackage could gain an option to only process the TDeb. The current single-language update mode of em_installtdeb is unlikely to be retained as translations are less likely to be updated within Emdebian.

dpkg-gentdeb currently only supports gettext translation.

The locale package must use GETTEXT_PACKAGE for the eventual filename of the binary translation file - although this may be the same as the $dh{MAINPACKAGE}. GETTEXT_PACKAGE is determined by upstream, not Debian. When building the whole package, the binary translation file may be in debian/tmp/usr/share/locale/$lang/LC_MESSAGES but when in translator mode, this location is not available. Instead retrieve GETTEXT_PACKAGE from the POT filename, the Makefile GETTEXT_PACKAGE macro or if that is not set, use the upstream source package name. This may need extending.

The Emdebian script currently has a different way of handling the ``source'' for translators. Work on dpkg-gentdeb continues to make a format that will satisfy Debian and Emdebian.

Some packages use multiple po directories and dpkg-gentdeb checks for a POT file in all usable po directories, including them in the tdeb source along with all po files: e.g.

  po/fr.po
  po-lib/fr.po
  po/application.pot
  po-lib/library.pot
 
 

When packaged, the Debian tdeb built from this source would contain:

  ./usr/share/locale/fr/LC_MESSAGES/application.mo
  ./usr/share/locale/de/LC_MESSAGES/application.mo
  ./usr/share/locale/fr/LC_MESSAGES/library.mo
  ./usr/share/locale/de/LC_MESSAGES/library.mo
 
 

Any package can have a source tdeb, as long as the POT file is either packaged or can be built. The package does not have to have been translated already.

For more detail on Tdebs, see: <http://www.emdebian.org/emdebian/langupdate.html> <http://wiki.debian.org/i18n/TranslationDebs>

Note that the Emdebian implementation of tdebs differs from the proposed tdebs for Debian because Emdebian does not care about manpages in general, let alone translated manpages. Once the 'nodocs' DEB_BUILD_OPTION is supported in debhelper, this will not be an issue as the tdebs can be built for Emdebian without any manpages. Other translated documentation would be omitted under 'nodocs' too. Images containing translated text are relatively few.

A new C/C++ application then handles the installation and update of tdeb packages according to the list of supported locales and the list of installed packages. Data cached by langupdate is temporary and is not intended to be stored between runs of langupdate.

OPTIONS

The default action is to process all available po files and all identifiable translated content.

Use in Debian

generate_source will be removed before inclusion into Debian.

At the same time, XC-Package-Type: tdeb needs support too. Notably, many of the scripts in the devscripts package fail to identify the TDeb in the .changes file and certain debhelper scripts fail to handle the TDeb package-type.

reprepro needs a patch to accept .tdeb and allow .tdeb in the repository files:
 $ reprepro --ignore=extension -b /path/ includedeb \
 unstable ../qof-locale-sv_0.7.5-1em1_arm.tdeb
 $ ls /opt/reprepro/locale/pool/main/q/qof/
 qof-locale-sv_0.7.5-1em1_arm.deb

  Filename: pool/main/q/qof/qof-locale-sv_0.7.5-1em1_arm.deb
  Description: sv translation for qof (tdeb)
 
 

reprepro also needs a way to handle a .tdeb in a .changes file.
 reprepro -b /opt/reprepro/locale/ include unstable ../qof_0.7.5-1em1_arm.changes
 'qof-locale-id_0.7.5-1em1_arm.tdeb' is not .deb or .udeb!
 There have been errors!

Other translations

Packages may also contain translated manpages and translations for debconf templates. These translations are not yet packaged or processed by dpkg-gentdeb. For Tdebs to be supported in Debian, these issues will need to be resolved such that Emdebian can continue to only package the gettext program translations, omitting translated manpages and leaving debconf translation support to existing tools or implement sufficient changes in cdebconf.

Development status

dpkg-gentdeb is based on em_installtdeb from the emdebian-tdeb package (built from the emdebian-tools source package). In many places, em_installtdeb code has been retained so that the two scripts can develop together and make it easier for Emdebian to convert Debian TDebs as they become available.

Therefore, there are numerous bits of code in dpkg-gentdeb that are commented out to act as prompts for where the two scripts have had to diverge.

Generate a -locale TDeb package

This is currently automated (if it does not exist) but that could mess up various maintainer version control systems (and debian/control should not be changed once the build starts). (This was the problem with emlocale). Could be an optional stage that could be migrated into one of the Dpkg perl modules.

Generated locale package descriptions get omitted from the .changes content:
 dpkg-genchanges: warning: package foo-locale in control file but not in files list

Emdebian control info

Emdebian TDebs are architecture-dependent and this function covers the creation of one TDeb per locale per architecture.

Debconf Templates

Packages may need to rename the templates file for the template file and change the reference in debian/po/POTFILES.in to the new file. This results in a lintian warning:
  Now running lintian...
  W: dpkg-cross: no-debconf-templates
  Finished running lintian.
 
 

The package probably now needs to Pre-Depend on the TDeb. Alternatively either dpkg or debconf should automatically install a TDeb prior to trying to configure the main package.

Templates files are the most common reason for l10n rebuilds of packages prior to a release.