[dpkg] 115/192: Dpkg::Gettxt: Add support for new DPKG_NLS environment variable
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:04:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit dd196e60b1b18f8b127a06d24c9095a1696838f1
Author: Guillem Jover <guillem at debian.org>
Date: Sat Jul 15 15:07:35 2017 +0200
Dpkg::Gettxt: Add support for new DPKG_NLS environment variable
When set to 0, it will disable NLS (i18n) support in the Dpkg modules,
and reduce the load chain.
---
debian/changelog | 3 +++
scripts/Dpkg/Gettext.pm | 33 ++++++++++++++++++++++++++-------
2 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 2b3c753..b215cae 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,9 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
- Disable decompression support for Dpkg::Vendor origin files.
- Move file_lock() function into a new Dpkg::Lock module, to reduce the
module load chain for several Dpkg modules.
+ - Add support for new DPKG_NLS environment variable in Dpkg::Gettext,
+ that when set to 0 will disable NLS (i18n) support in the Dpkg modules,
+ and reduce the load chain.
* Documentation:
- Document currently accepted syntax for changelogs in deb-changelog(5).
Closes: #858579
diff --git a/scripts/Dpkg/Gettext.pm b/scripts/Dpkg/Gettext.pm
index aa5aeb8..2e3e504 100644
--- a/scripts/Dpkg/Gettext.pm
+++ b/scripts/Dpkg/Gettext.pm
@@ -1,7 +1,7 @@
# Copied from /usr/share/perl5/Debconf/Gettext.pm
#
# Copyright © 2000 Joey Hess <joeyh at debian.org>
-# Copyright © 2007, 2009-2010, 2012-2015 Guillem Jover <guillem at debian.org>
+# Copyright © 2007, 2009-2010, 2012-2017 Guillem Jover <guillem at debian.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@ package Dpkg::Gettext;
use strict;
use warnings;
-our $VERSION = '1.02';
+our $VERSION = '1.03';
our @EXPORT = qw(
textdomain
ngettext
@@ -53,6 +53,17 @@ The Dpkg::Gettext module is a convenience wrapper over the Locale::gettext
module, to guarantee we always have working gettext functions, and to add
some commonly used aliases.
+=head1 ENVIRONMENT
+
+=over 4
+
+=item DPKG_NLS
+
+When set to 0, this environment variable will disable the National Language
+Support in all Dpkg modules.
+
+=back
+
=head1 VARIABLES
=over 4
@@ -98,11 +109,15 @@ or $msgid_plural otherwise.
use constant GETTEXT_CONTEXT_GLUE => "\004";
BEGIN {
- eval q{
- pop @INC if $INC[-1] eq '.';
- use Locale::gettext;
- };
- if ($@) {
+ my $use_gettext = $ENV{DPKG_NLS} // 1;
+ if ($use_gettext) {
+ eval q{
+ pop @INC if $INC[-1] eq '.';
+ use Locale::gettext;
+ };
+ $use_gettext = not $@;
+ }
+ if (not $use_gettext) {
eval q{
sub g_ {
return shift;
@@ -171,6 +186,10 @@ sub _g ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
=head1 CHANGES
+=head2 Version 1.03 (dpkg 1.19.0)
+
+New envvar: Add support for new B<DPKG_NLS> environment variable.
+
=head2 Version 1.02 (dpkg 1.18.3)
New function: N_().
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list