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

Bug#636086: [PATCH] Use C.UTF-8 from current libc-bin, rather than our own private en_US.UTF-8



* Niels Thykier <niels@thykier.net>, 2011-08-22, 21:44:
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,7 @@ Build-Depends: binutils,
               intltool-debian,
               javahelper (>= 0.32~),
               libapt-pkg-perl,
+               libc-bin (>= 2.13) | locales,
               libclass-accessor-perl,
               libdpkg-perl,
               libdigest-sha-perl,
@@ -37,7 +38,6 @@ Build-Depends: binutils,
               libtext-template-perl,
               libtimedate-perl,
               liburi-perl,
-               locales,
               xz-lzma | lzma,
               man-db,
               perl,

Depends should be adjusted accordingly.

--- a/debian/postinst
+++ b/debian/postinst
@@ -17,6 +17,17 @@ gen_locale() {
    fi
}

+#DEBHELPER#
+
+# Do nothing if there is a system locale.
+if [ -d '/usr/lib/locale/C.UTF-8' ] ; then
+    if [ "$1" = 'configure' -a -d "$locale_dir/" ] ; then
+        # except clean up our unused private locale
+        rm -rf "$locale_dir"
+    fi
+    exit 0
+fi
+
if [ "$1" = "configure" ]; then
    if [ ! -f "$locale_dir/en_US.UTF-8/LC_CTYPE" ] &&
	[ -f /usr/share/locale/locale.alias ]; then
@@ -39,4 +50,3 @@ if [ "$1" = "triggered" ]; then
    fi
fi

-#DEBHELPER#
diff --git a/debian/prerm b/debian/prerm
index 698ed52..7e21104 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -3,9 +3,11 @@
set -e

#
-# Remove our generated locale unless we're only upgrading.
+# Remove our generated locale if we are not upgrading or
+# we are upgrading into a system with a libc provided
+# C.UTF-8 (libc-bin >= 2.13-1)

-if [ 'upgrade' != "$1" ] ; then
+if [ 'upgrade' != "$1" -o -d '/usr/lib/locale/C.UTF-8' ] ; then
    rm -rf /var/lib/lintian/
fi


I'd rather take advantage of triggers and replace this part with the attached patch. (Beware, I didn't test it yet!)

--
Jakub Wilk
diff --git a/debian/postinst b/debian/postinst
--- a/debian/postinst
+++ b/debian/postinst
@@ -19,7 +19,8 @@
 
 if [ "$1" = "configure" ]; then
     if [ ! -f "$locale_dir/en_US.UTF-8/LC_CTYPE" ] &&
-	[ -f /usr/share/locale/locale.alias ]; then
+	[ -f /usr/share/locale/locale.alias ] &&
+	! [ -d /usr/lib/locale/C.UTF-8/ ]; then
 
 	# handle upgrades from the previous, incorrect, directory:
 	rm -rf "$locale_dir"
@@ -34,7 +35,7 @@
     # If locales is upgraded, we should still regenerate our locale.
     rm -rf "$locale_dir"
 
-    if [ -f /usr/share/locale/locale.alias ]; then
+    if [ -f /usr/share/locale/locale.alias ] && ! [ -d /usr/lib/locale/C.UTF-8/ ]; then
 	gen_locale
     fi
 fi
diff --git a/debian/triggers b/debian/triggers
--- a/debian/triggers
+++ b/debian/triggers
@@ -1,2 +1,3 @@
 interest /usr/share/locale/locale.alias
 interest /usr/lib/locales-all
+interest /usr/lib/locale/C.UTF-8

Reply to: