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

r1335 - in glibc-package/trunk/debian: . local/manpages local/usr_sbin



Author: barbier
Date: 2006-04-06 22:18:04 +0000 (Thu, 06 Apr 2006)
New Revision: 1335

Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/local/manpages/update-locale.8
   glibc-package/trunk/debian/local/usr_sbin/update-locale
Log:
  * update-locale: Drop the --remove flag, it is useless.
  * update-locale: Fix the --locale-file flag.


Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2006-04-06 22:11:23 UTC (rev 1334)
+++ glibc-package/trunk/debian/changelog	2006-04-06 22:18:04 UTC (rev 1335)
@@ -13,6 +13,8 @@
     initial installation.  (Closes: #357523)
   * update-locale: Fix buggy sanity check between LANGUAGE and LANG.
     (Closes: #361091)
+  * update-locale: Drop the --remove flag, it is useless.
+  * update-locale: Fix the --locale-file flag.
   * Add new Galician debconf translation, by Jacobo Tarrio.  (Closes: #361101)
   * Use new features of po-debconf 1.0 to remove unneeded strings from PO
     files.

Modified: glibc-package/trunk/debian/local/manpages/update-locale.8
===================================================================
--- glibc-package/trunk/debian/local/manpages/update-locale.8	2006-04-06 22:11:23 UTC (rev 1334)
+++ glibc-package/trunk/debian/local/manpages/update-locale.8	2006-04-06 22:18:04 UTC (rev 1335)
@@ -6,20 +6,15 @@
 .LP 
 update-locale 
 .RI [ OPTIONS ]
-[\fBLANG\fP=\fIlocale\fP]
-[\fBLC_NUMERIC\fP=\fIlocale\fP]
+[\fIvar\fP=\fIlocale\fP | \fIvar\fP]
 [...]
-.br
-update-locale 
-.B --remove
-[\fBLANG\fP]
-[\fBLC_NUMERIC\fP]
-[...]
 .SH "DESCRIPTION"
 .LP 
 This program can be called by maintainer scripts when Debian packages are
 installed or removed, it updates the \fB/etc/default/locale\fP file to
 reflect changes in system configuration related to global locale settings.
+When variables have no value assigned, they are removed from the locale
+file.
 Some basic checks are performed to ensure that requested settings are valid.
 .SH "OPTIONS"
 .TP
@@ -29,15 +24,19 @@
 .B \-\-reset
 Variables which are not set on command-line are cleared out.
 .TP
-.B \-\-remove
-Remove variables from locale file.
-.TP
-.B \-\-locale\-file
-File containing locale variables.  (Default:
+.BI \-\-locale\-file " FILE"
+Define file containing locale variables.  (Default:
 .BR /etc/default/locale )
 .TP
 .B \-\-no\-checks
 Do not perform sanity checks on locale variables.
+.SH "EXAMPLE"
+.nf
+The command
+.ft B
+        update-locale LANG=en_CA.UTF-8 LANGUAGE
+.ft R
+sets \fBLANG\fP to \fBen_CA.UTF-8\fP and removes definitions for \fBLANGUAGE\fP.
 .SH "FILES"
 .TP 
 .B /etc/default/locale

Modified: glibc-package/trunk/debian/local/usr_sbin/update-locale
===================================================================
--- glibc-package/trunk/debian/local/usr_sbin/update-locale	2006-04-06 22:11:23 UTC (rev 1334)
+++ glibc-package/trunk/debian/local/usr_sbin/update-locale	2006-04-06 22:18:04 UTC (rev 1335)
@@ -8,15 +8,16 @@
 
 my $help         = 0;
 my $reset        = 0;
+#  Kept for compatibility reasons
 my $remove       = 0;
 my $no_checks    = 0;
 
 GetOptions(
-	'reset'        => \$reset,
-	'remove'       => \$remove,
-	'locale-file'  => \$locale_file,
-	'no-checks'    => \$no_checks,
-	'h|help'       => \$help,
+	'reset'          => \$reset,
+	'remove'         => \$remove,
+	'locale-file=s'  => \$locale_file,
+	'no-checks'      => \$no_checks,
+	'h|help'         => \$help,
 );
 
 sub usage
@@ -24,12 +25,11 @@
 	my $rc = shift;
 	print STDERR "Usage: $progname [OPTIONS] [LANG=locale] [LC_NUMERIC=locale] ...
 Options:
-   --help          display this message and exit
-   --reset         ignore variables defined in the locale file
-   --remove        remove variables from locale file
-   --locale-file   file containing locale variables
-                   (Default: /etc/default/locale)
-   --no-checks     do not perform sanity checks on locale variables
+   --help              display this message and exit
+   --reset             ignore variables defined in the locale file
+   --locale-file=FILE  file containing locale variables
+                       (Default: /etc/default/locale)
+   --no-checks         do not perform sanity checks on locale variables
 ";
 	exit $rc;
 }
@@ -55,7 +55,7 @@
 	}
 	close(IN)
 		or die "$progname: Unable to close $locale_file: $!\n";
-	$content =~ s/^([^#])/#$1/mg;
+	$content =~ s/^(\s*\w+=)/#$1/mg;
 	$content .= "\n" unless $content =~ m/\n$/s;
 }
 else
@@ -68,21 +68,19 @@
 	{
 		$arg{$1} = $2;
 	}
-	elsif ($remove)
+	else
 	{
 		delete $arg{$_};
 	}
 }
 
 my $env = '';
-for (qw(LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL))
+my ($key, $value);
+while (($key, $value) = each %arg)
 {
-	if (defined $arg{$_} && $arg{$_} ne '')
-	{
-		$env .= " $_=$arg{$_}";
-		$content =~ s/^#[#\s]*$_=.*/$_=$arg{$_}/m or
-			$content .= "$_=$arg{$_}\n";
-	}
+	$env .= " $key=$value";
+	$content =~ s/^#\s*$key=.*/$key=$value/m or
+		$content .= "$key=$value\n";
 }
 
 #  Sanity checks



Reply to: