Add support for translated program output in multistrap

git-svn-id: http://emdebian.org/svn/current@6667 563faec7-e20c-0410-992a-a66f704d0ccd
main
codehelp 15 years ago
parent 2838624ee0
commit daea8a0205

@ -4,16 +4,20 @@ PREFIX ?= /usr
DEST = $(DESTDIR)$(PREFIX)
all: docbuild
$(MAKE) -C po
docbuild:
./genmanpages
install:
$(MAKE) -C po install DESTDIR=../debian/multistrap
clean:
$(RM) *~
-$(MAKE) -C doc clean
$(MAKE) -C doc clean
$(MAKE) -C po clean
# adds the POT file to the source tarball
native-dist: Makefile
./genmanpages --pot-only
$(MAKE) -C po pot

3
debian/changelog vendored

@ -5,8 +5,9 @@ emdebian-rootfs (2.0.4) unstable; urgency=low
(Closes: #553599)
* Use genmanpages code from svn-buildpackage for translated content.
* Apply useNativeDist to package POT file
* Add support for translated program output in multistrap
-- Neil Williams <codehelp@debian.org> Sun, 01 Nov 2009 16:54:27 +0000
-- Neil Williams <codehelp@debian.org> Sun, 01 Nov 2009 18:31:49 +0000
emdebian-rootfs (2.0.3) unstable; urgency=low

3
debian/rules vendored

@ -5,3 +5,6 @@
include /usr/share/cdbs/1/class/makefile.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk
DEB_MAKE_INSTALL_TARGET=install

@ -15,20 +15,26 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use IO::File;
use Config::Auto;
use File::Basename;
use Parse::Debian::Packages;
use strict;
use warnings;
use POSIX qw(locale_h);
use Locale::gettext;
use vars qw/ $progname $ourversion $dstrap $extra @aptsources
@archives $deb $cachedir $config_str %packages $retval $str $retries
$dir $include $arch $foreign $suite $url $unpack $sourcedir
$dir $include $arch $foreign $suite $url $unpack $sourcedir $msg
@e $sourcesname $libdir $dpkgdir @debootstrap %suites $mirror $etcdir
$repo @dirs @touch %sources $section %keys $host $key $value $type
$file $config $tidy $noauth $keyring %keyrings $deflist /;
setlocale(LC_MESSAGES, "");
textdomain("multistrap");
$progname = basename($0);
$ourversion = "0.0.7";
$ourversion = "0.0.8";
$unpack = "true";
while( @ARGV ) {
@ -64,10 +70,11 @@ while( @ARGV ) {
$noauth++;
}
else {
die "$progname: Unknown option $_.\n";
die "$progname: "._g("Unknown option")." $_.\n";
}
}
die ("Need a configuration file - use $progname -f\n")
$msg = printf (_g("Need a configuration file - use %s -f\n"), $progname);
die ($msg)
if (not defined $file);
$config = Config::Auto::parse("$file");
%keys=();
@ -111,30 +118,32 @@ foreach $section (sort keys %keys)
$keyrings{$section}=$keys{$section}{'keyring'};
}
}
print "$progname $ourversion using $file\n";
# Translators: fields are: programname, versionstring, configfile.
printf (_g("%s %s using %s\n"), $progname, $ourversion, $file);
$host = `dpkg-architecture -qDEB_BUILD_ARCH`;
chomp ($host);
if (not defined $arch)
{
$arch = $host;
printf ("Defaulting architecture to native: %s\n",$arch);
printf (_g("Defaulting architecture to native: %s\n"),$arch);
}
else
{
printf ("Using foreign architecture: %s\n", $arch);
printf (_g("Using foreign architecture: %s\n"), $arch);
}
$foreign++ if ($host ne $arch);
unless (keys %sources and @aptsources)
{
my $msg = sprintf("No sources defined for a foreign multistrap
my $msg = sprintf(_g("No sources defined for a foreign multistrap
Using your existing apt sources. To use different sources,
and list them with aptsources= in '%s'.", $file);
and list them with aptsources= in '%s'."), $file);
warn ("$progname: $msg\n");
$deflist = prepare_sources_list();
}
printf ("%s building %s multistrap on '%s'\n", $progname, $arch, $host);
# Translators: fields are: programname, architecture, host architecture.
printf (_g("%s building %s multistrap on '%s'\n"), $progname, $arch, $host);
$cachedir = "var/cache/apt/"; # archives
$libdir = "var/lib/apt/"; # lists
$etcdir = "etc/apt/"; # sources
@ -180,7 +189,7 @@ if (-l "${dir}lib64" ) {
chomp ($old);
unlink "${dir}lib64";
chdir ("$dir");
print "INF: ./lib64 -> /lib symbolic link reset to ./lib.\n";
print _g("INF: ./lib64 -> /lib symbolic link reset to ./lib.\n");
symlink "./lib", "lib64";
chdir ("${old}");
}
@ -190,7 +199,7 @@ else
my $old = `pwd`;
chomp ($old);
chdir ("$dir");
print "INF: Setting ./lib64 -> ./lib symbolic link.\n";
print _g("INF: Setting ./lib64 -> ./lib symbolic link.\n");
symlink "./lib", "lib64";
chdir ("${old}");
}
@ -223,7 +232,7 @@ foreach my $aptsrc (@aptsources)
if (defined $deflist)
{
open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list")
or die "Cannot open sources list $!";
or die _g("Cannot open sources list"). $!;
print SOURCES $deflist;
close SOURCES;
}
@ -253,7 +262,7 @@ if (defined $k)
my $e=`LC_ALL=C printenv`;
my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo ";
$str = (-f "/usr/bin/sudo") ? "$str" : "";
print "I: Installing $k\n";
printf (_g("I: Installing %s\n"), $k);
system ("$str apt-get install $k");
}
@ -270,9 +279,9 @@ $config_str .= " -o Dir::Etc::SourceList=${dir}${etcdir}$sourcesname";
$config_str .= " -o Dir::State=${dir}${libdir}";
$config_str .= " -o Dir::State::Status=${dir}${dpkgdir}status";
$config_str .= " -o Dir::Cache=${dir}${cachedir}";
printf ("Getting package lists: apt-get %s update\n", $config_str);
printf (_g("Getting package lists: apt-get %s update\n"), $config_str);
$retval = system ("apt-get $config_str update");
die (sprintf("apt update failed. Exit value: ").($retval/256)."\n")
die (sprintf (_g("apt update failed. Exit value: %d\n"), ($retval/256)))
if ($retval != 0);
$str = join (' ', values %packages) . " ";
chomp($str);
@ -283,7 +292,7 @@ $str .= join (' ', @$required);
chomp($str);
print "apt-get -y $config_str install $str\n";
$retval = system ("apt-get -y $config_str install $str");
die ("apt download failed. Exit value: ".($retval/256)."\n")
die (sprintf (_g("apt download failed. Exit value: %d\n"),($retval/256)))
if ($retval != 0);
&force_unpack if ($unpack eq "true");
@ -294,12 +303,12 @@ if (-l "${dir}lib64" ) {
my $r = readlink "${dir}lib64";
if ($r =~ m:^/:)
{
print "ERR: ./lib64 -> /lib symbolic link reset to ./lib after unpacking.\n";
printf ("ERR: Some files may have been unpacked outside %s!\n", $dir);
print _g("ERR: ./lib64 -> /lib symbolic link reset to ./lib after unpacking.\n");
printf (_g("ERR: Some files may have been unpacked outside %s!\n"), $dir);
}
else
{
printf ("\nMultistrap system installed successfully in %s.\n\n", $dir);
printf (_g("\nMultistrap system installed successfully in %s.\n\n"), $dir);
}
}
exit 0;
@ -308,10 +317,10 @@ sub force_unpack
{
my %unpack=();
opendir (DEBS, "${dir}${cachedir}archives/")
or die ("Cannot read apt archives directory.\n");
or die (_g("Cannot read apt archives directory.\n"));
@archives=grep(/.*\.deb$/, readdir DEBS);
closedir (DEBS);
print "I: Calculating obsolete packages\n";
print _g("I: Calculating obsolete packages\n");
foreach $deb (sort @archives)
{
my $version = `LC_ALL=C dpkg -f ${dir}${cachedir}archives/$deb Version`;
@ -328,13 +337,13 @@ sub force_unpack
{
my $old = $deb;
$old =~ s/$version/$unpack{$package}/;
printf ("I: Removing %s\n", $old);
printf (_g("I: Removing %s\n"), $old);
unlink "${dir}${cachedir}archives/$old";
next;
}
else
{
printf ("I: Removing %s\n", $deb);
printf (_g("I: Removing %s\n"), $deb);
unlink "${dir}${cachedir}archives/$deb";
}
}
@ -343,7 +352,7 @@ sub force_unpack
open (LOCK, ">${dir}${libdir}lists/lock");
close (LOCK);
opendir (DEBS, "${dir}${cachedir}archives/")
or die ("Cannot read apt archives directory.\n");
or die (_g("Cannot read apt archives directory.\n"));
@archives=grep(/.*\.deb$/, readdir DEBS);
closedir (DEBS);
my $old = `pwd`;
@ -351,7 +360,7 @@ sub force_unpack
chdir ("${dir}");
foreach $deb (sort @archives)
{
printf ("I: Extracting %s...\n", $deb);
printf (_g("I: Extracting %s...\n"), $deb);
system ("ar -p \"./${cachedir}archives/$deb\" data.tar.gz | zcat | tar -xf -");
my $ver=`LC_ALL=C dpkg -f ./${cachedir}archives/$deb Version`;
my $pkg=`LC_ALL=C dpkg -f ./${cachedir}archives/$deb Package`;
@ -401,7 +410,7 @@ sub force_unpack
if ( -f "./${dpkgdir}info/$pkg.conffiles")
{
print STATUS "Conffiles:\n";
printf (" -> Processing conffiles for %s\n", $pkg);
printf (_g(" -> Processing conffiles for %s\n"), $pkg);
open (CONF, "./${dpkgdir}info/$pkg.conffiles");
my @lines=<CONF>;
close (CONF);
@ -422,26 +431,26 @@ sub force_unpack
{
my $old = `pwd`;
chomp ($old);
printf ("ERR: lib64 -> ./lib symbolic link clobbered by %s\n", $pkg);
printf (_g("ERR: lib64 -> ./lib symbolic link clobbered by %s\n"), $pkg);
unlink "${dir}lib64";
chdir ("$dir");
print "INF: lib64 -> /lib symbolic link reset to ./lib.\n";
print _g("INF: lib64 -> /lib symbolic link reset to ./lib.\n");
symlink "./lib", "lib64";
chdir ("${old}");
}
}
}
chdir ("$old");
print "I: Unpacking complete.\n";
print _g("I: Unpacking complete.\n");
}
sub tidy_apt
{
print "I: Tidying up apt cache and list data.\n";
print _g("I: Tidying up apt cache and list data.\n");
unlink ("${dir}etc/apt/sources.list")
if (-f "${dir}etc/apt/sources.list");
opendir (DEBS, "${dir}${libdir}lists/")
or die ("Cannot read apt lists directory.\n");
or die (_g("Cannot read apt lists directory.\n"));
my @lists=grep(!m:\.\.?$:, readdir DEBS);
closedir (DEBS);
foreach my $file (@lists)
@ -450,7 +459,7 @@ sub tidy_apt
unlink ("${dir}${libdir}lists/$file");
}
opendir (DEBS, "${dir}${cachedir}/")
or die ("Cannot read apt cache directory/.\n");
or die (_g("Cannot read apt cache directory/.\n"));
my @files=grep(!m:\.\.?$:, readdir DEBS);
closedir (DEBS);
foreach my $file (@files)
@ -462,7 +471,7 @@ sub tidy_apt
if ($unpack eq "true")
{
opendir (DEBS, "${dir}${cachedir}/archives/")
or die ("Cannot read apt archives directory/.\n");
or die (_g("Cannot read apt archives directory/.\n"));
my @files=grep(!m:\.\.?$:, readdir DEBS);
closedir (DEBS);
foreach my $file (@files)
@ -480,14 +489,14 @@ sub tidy_apt
# if native arch, do a few tasks just because we can and probably should.
sub native
{
print "I: Native mode - configuring unpacked packages . . .\n";
print _g("I: Native mode - configuring unpacked packages . . .\n");
my $e=`LC_ALL=C printenv`;
my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo";
$str = (-f "/usr/bin/sudo") ? "$str" : "";
my $env = "DEBIAN_FRONTEND=noninteractive ".
"DEBCONF_NONINTERACTIVE_SEEN=true ".
"LC_ALL=C LANGUAGE=C LANG=C";
print "I: dpkg configuration settings:\n\t$env\n";
printf (_g("I: dpkg configuration settings:\n\t%s\n"), $env);
system ("$str $env chroot $dir dpkg --configure -a");
}
@ -500,7 +509,8 @@ sub get_required_debs
my @required=();
my @debs=();
opendir (PKGS, "${dir}${libdir}lists/")
or die sprintf("Cannot open %s directory. %s\n","${dir}${libdir}lists/", $!);
or die sprintf(_g("Cannot open %s directory. %s\n"),
"${dir}${libdir}lists/", $!);
my @lists=grep(/_Packages$/, readdir (PKGS));
closedir (PKGS);
foreach my $strap (@debootstrap)
@ -555,7 +565,7 @@ sub prepare_sources_list
}
sub usageversion {
printf STDERR ("
printf STDERR (_g("
%s version %s
Usage:
@ -614,8 +624,12 @@ General settings:
'directory' specifies the top level directory where the debootstrap
will be created - it is not packed into a .tgz once complete.
", $progname, $ourversion, $progname, $progname, $progname)
or die "$progname: "."failed to write usage:". "$!\n";
"), $progname, $ourversion, $progname, $progname, $progname)
or die ("$progname: ". _g("failed to write usage:") . "$!\n");
}
sub _g {
return gettext(shift);
}
=pod

@ -27,10 +27,6 @@ PODIR="po"
POTFILE=""
# base directory for generated files, e.g. doc
BASEDIR=""
# The scripts with translated output
SCRIPTS=""
# The language to declare for the SCRIPTS (xgettext)
SCRIPTS_LANG=""
# the binary packages that will contain generated manpages
BINARIES=""
# the binary packages with manpages in Section 3.
@ -139,9 +135,6 @@ if [ ! -z "$LANGS" ]; then
fi
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:po/\$lang.po"
#for file in $SCRIPTS; do
# wrap_langs "[type:$SCRIPTS_LANG]" "$file"
#done
for file in $XMLDIR/*.xml; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR/\$lang/$LOCAL"

@ -8,10 +8,6 @@ PODIR="doc/po"
POTFILE="doc/po/emdebian-rootfs.pot"
# base directory for generated files, e.g. doc
BASEDIR="doc"
# The scripts with translated output
SCRIPTS="em_multistrap"
# The language to declare for the SCRIPTS (xgettext)
SCRIPTS_LANG="perl"
# the binary packages that will contain generated manpages
BINARIES="emdebian-rootfs multistrap"
# the binary packages with manpages in Section 3.

@ -0,0 +1,143 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
#
# This file may be copied and used freely without restrictions. It may
# be used in projects which are not available under a GNU Public License,
# but which still want to provide support for the GNU gettext functionality.
#
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
#
# - Modified by Neil Williams <linux@codehelp.co.uk> for Debian native
# packages and to not require autoconf
# this Makefile is due to be replaced by [type:xgettext] support in po4a.
GETTEXT_PACKAGE = $(shell grep "^DOMAIN" Makevars |cut -d '=' -f2|tr -d ' ')
SHELL = /bin/sh
srcdir = .
top_srcdir = ..
top_builddir = ..
subdir = po
prefix = /usr
mkdir_p = mkdir -p
INSTALL_DATA = install -m 0644
datadir = ${datarootdir}
datarootdir = ${prefix}/share
DATADIRNAME = share
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
GMSGFMT = /usr/bin/msgfmt
MSGFMT = /usr/bin/msgfmt
XGETTEXT = /usr/bin/xgettext
INTLTOOL_UPDATE = /usr/bin/intltool-update
INTLTOOL_EXTRACT = /usr/bin/intltool-extract
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
ALL_LINGUAS =
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi)
USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
POTFILES = $(shell cat POTFILES.in|sed 's/\(.*\).*/..\/\1/'|tr -d ' ')
CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
.SUFFIXES:
.SUFFIXES: .po .pox .gmo .mo .msg .cat
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && gencat $@ $*.msg
all: all-yes
all-yes: $(CATALOGS)
all-no:
pot: $(GETTEXT_PACKAGE).pot
$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(GENPOT)
# the install fallbacks are probably unnecessary, just the first case is used.
install: install-data
install-data: install-data-yes
install-data-no: all
install-data-yes: all
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $$dir; \
if test -r $$lang.gmo; then \
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
else \
$(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
echo "installing $(srcdir)/$$lang.gmo as" \
"$$dir/$(GETTEXT_PACKAGE).mo"; \
fi; \
if test -r $$lang.gmo.m; then \
$(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
else \
if test -r $(srcdir)/$$lang.gmo.m ; then \
$(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
$$dir/$(GETTEXT_PACKAGE).mo.m; \
echo "installing $(srcdir)/$$lang.gmo.m as" \
"$$dir/$(GETTEXT_PACKAGE).mo.m"; \
else \
true; \
fi; \
fi; \
done
# Empty stubs to satisfy archaic automake needs
dvi info tags TAGS ID:
# Define this as empty until I found a useful application.
install-exec installcheck:
uninstall:
check: all $(GETTEXT_PACKAGE).pot
rm -f missing notexist
srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
if [ -r missing -o -r notexist ]; then \
exit 1; \
fi
mostlyclean:
rm -f *.pox *.old.po cat-id-tbl.tmp
rm -f .intltool-merge-cache
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES stamp-it
rm -f *.mo *.msg *.cat *.cat.m *.gmo $(GETTEXT_PACKAGE).pot
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f Makefile.in.in
Makefile POTFILES:
@if test ! -f $@; then \
rm -f stamp-it; \
$(MAKE) stamp-it; \
fi
stamp-it: POTFILES.in
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

@ -0,0 +1,41 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = multistrap
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = -L Perl --from-code=iso-8859-1 --keyword=_g
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Neil Williams
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = multistrap@packages.debian.org
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

@ -0,0 +1 @@
em_multistrap
Loading…
Cancel
Save