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

[SCM] Debian package checker branch, master, updated. 2.3.1-14-g9b7c089



The following commit has been merged in the master branch:
commit 9b7c0896ae937cc29662cc4d385d94df27626268
Author: Russ Allbery <rra@debian.org>
Date:   Sun Jan 10 21:47:55 2010 -0800

    Generate a private UTF-8 locale for the use of tests
    
    * checks/infofiles:
      + [RA] Pass LOCPATH to subprocesses.
    * checks/manpages:
      + [RA] Pass LOCPATH to subprocesses.
    * debian/control:
      + [RA] Depend on locales.
    * debian/prerm:
      + [RA] Remove /var/lib/lintian/locale on any removal except upgrades.
    * debian/postinst:
      + [RA] Generate an en_US.UTF-8 locale in /var/lib/lintian/locale for
        use for tests, particularly man page tests.  (Closes: #555408)
    * frontend/lintian:
      + [RA] Set LOCPATH to LINTIAN_ROOT/locale or /var/lib/lintian/locale,
        whichever exist.
    * lib/Util.pm:
      + [RA] Pass LOCPATH to subprocesses.

diff --git a/checks/infofiles b/checks/infofiles
index 6e5d9f3..f1932ec 100644
--- a/checks/infofiles
+++ b/checks/infofiles
@@ -91,7 +91,8 @@ foreach my $file (sort keys %{$info->index}) {
 	if (not defined $pid) {
 	    fail("cannot fork: $!");
 	} elsif ($pid == 0) {
-	    my %newenv = (LANG => 'C', PATH => $ENV{PATH});
+	    my %newenv = (LANG => 'C', PATH => $ENV{PATH},
+			  LOCPATH => $ENV{LOCPATH});
 	    undef %ENV;
 	    %ENV = %newenv;
 	    exec "zcat \Qunpacked/$file\E 2>&1"
diff --git a/checks/manpages b/checks/manpages
index bf6177e..be9e22b 100644
--- a/checks/manpages
+++ b/checks/manpages
@@ -211,7 +211,8 @@ foreach my $file (sort keys %{$info->index}) {
 	    if (not defined $pid) {
 		fail("cannot run lexgrog: $!");
 	    } elsif ($pid == 0) {
-		my %newenv = (LANG => 'C', PATH => $ENV{PATH});
+		my %newenv = (LANG => 'C', PATH => $ENV{PATH},
+			      LOCPATH => $ENV{LOCPATH});
 		undef %ENV;
 		%ENV = %newenv;
 		exec "lexgrog unpacked/\Q$file\E 2>&1"
@@ -244,7 +245,8 @@ foreach my $file (sort keys %{$info->index}) {
 	if (not defined $pid) {
 	    fail("cannot run man -E UTF-8 -l: $!");
 	} elsif ($pid == 0) {
-	    my %newenv = (LANG => 'C', PATH => $ENV{PATH}, MANWIDTH => 80);
+	    my %newenv = (LANG => 'C', PATH => $ENV{PATH}, MANWIDTH => 80,
+			  LOCPATH => $ENV{LOCPATH});
 	    undef %ENV;
 	    %ENV = %newenv;
 	    exec "($cmd >/dev/null) 2>&1"
diff --git a/debian/changelog b/debian/changelog
index b16f68c..a3d2f93 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,22 +17,39 @@ lintian (2.3.2) UNRELEASED; urgency=low
       others are not.
   * checks/files.desc:
     + [JP] Fix outdated reference in file-in-usr-lib-site-python.
+  * checks/infofiles:
+    + [RA] Pass LOCPATH to subprocesses.
+  * checks/manpages:
+    + [RA] Pass LOCPATH to subprocesses.
 
   * data/output/manual-references:
     + [JP] Refresh reference data against Policy 3.8.3, doc-base 0.9.5,
       developers-reference 3.4.3, and Python Policy 0.9.0.
 
+  * debian/control:
+    + [RA] Depend on locales.
+  * debian/prerm:
+    + [RA] Remove /var/lib/lintian/locale on any removal except upgrades.
+  * debian/postinst:
+    + [RA] Generate an en_US.UTF-8 locale in /var/lib/lintian/locale for
+      use for tests, particularly man page tests.  (Closes: #555408)
+
+  * frontend/lintian:
+    + [RA] Set LOCPATH to LINTIAN_ROOT/locale or /var/lib/lintian/locale,
+      whichever exist.
+
   * lib/Lintian/Collect.pm:
     + [ADB] Update the documentation to reflect the existence of
       Lintian::Collect::Binary.
   * lib/Lintian/Collect/Binary.pm:
     + [ADB] Correct a reference in the documentation indicating that the 
       module collects data for source packages.
-
   * lib/Spelling.pm:
     + [RA] Add additional spelling corrections.
     + [RA] Remove spelling correction for parameterize.  This is the
       correct US spelling.  Thanks, Jonathan Yu.  (Closes: #564523)
+  * lib/Util.pm:
+    + [RA] Pass LOCPATH to subprocesses.
 
   * man/lintian.1:
     + [RA] Spelling fix.  Thanks, A. Costa.  (Closes: #564017)
diff --git a/debian/control b/debian/control
index 067ce8e..524395d 100644
--- a/debian/control
+++ b/debian/control
@@ -22,7 +22,7 @@ Depends: ${misc:Depends}, perl, libdigest-md5-perl | perl (>> 5.8),
  man-db (>= 2.4.0), gettext (>= 0.16), intltool-debian,
  libclass-accessor-perl, libdigest-sha-perl,
  libparse-debianchangelog-perl (>= 0.6), libtimedate-perl, liburi-perl,
- libipc-run-perl, libapt-pkg-perl
+ libipc-run-perl, libapt-pkg-perl, locales
 Suggests: binutils-multiarch, libtext-template-perl, man-db (>= 2.5.1-1)
 Description: Debian package checker
  Lintian dissects Debian packages and reports bugs and policy
diff --git a/debian/dirs b/debian/dirs
index ea49a65..7499b52 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1,4 +1,5 @@
 etc
 usr/bin
 usr/share/lintian
+var/lib/locale
 var/spool/lintian
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..fac26e5
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Lintian requires a UTF-8 locale in order to properly do man page tests.
+# Generate one at installation time so that we're guaranteed to have one.
+
+set -e
+
+if [ ! -d '/var/lib/lintian/locale/en_US.UTF-8/LC_CTYPE' ] ; then
+    echo 'Generating en_US.UTF-8 locale for internal Lintian use....'
+    mkdir -p /var/lib/lintian/locale
+    if ! localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias \
+                --quiet /var/lib/lintian/locale ; then
+        rm -rf /var/lib/lintian/locale
+        exit 1
+    fi
+fi
+
+#DEBHELPER#
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
index 0000000..e512653
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# Remove our generated locale unless we're only upgrading.
+
+if [ 'upgrade' != "$1" ] ; then
+    rm -rf /var/lib/lintian/locale
+fi
+
+#DEBHELPER#
diff --git a/frontend/lintian b/frontend/lintian
index d2d9a12..ddf7d0e 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -575,6 +575,15 @@ my $debug = $#debug + 1;
 $verbose = 1 if $debug;
 $ENV{'LINTIAN_DEBUG'} = $debug;
 
+# Use our custom-generated locale for programs we call, if it's available.  We
+# first look in the Lintian root and then in /var/lib/lintian, which is the
+# standard location for the install-time-generated locale.
+if (-d "$LINTIAN_ROOT/locale/en_US.UTF-8") {
+    $ENV{LOCPATH} = "$LINTIAN_ROOT/locale";
+} elsif (-d '/var/lib/lintian/locale/en_US.UTF-8') {
+    $ENV{LOCPATH} = '/var/lib/lintian/locale/en_US.UTF-8';
+}
+
 # }}}
 
 # {{{ Loading lintian's own libraries (now LINTIAN_ROOT is known)
diff --git a/lib/Util.pm b/lib/Util.pm
index f8934b9..7a82d64 100644
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -236,7 +236,7 @@ sub file_is_encoded_in_non_utf8 {
 # Just like system, except cleanses the environment first to avoid any strange
 # side effects due to the user's environment.
 sub system_env {
-    my @whitelist = qw(PATH INTLTOOL_EXTRACT);
+    my @whitelist = qw(PATH INTLTOOL_EXTRACT LOCPATH);
     my %newenv = map { exists $ENV{$_} ? ($_ => $ENV{$_}) : () } @whitelist;
     my $pid = fork;
     if (not defined $pid) {

-- 
Debian package checker


Reply to: