From 4a2b9346d2bfbec26be2f575ffbec5726cc85e48 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 5 Dec 2008 15:48:10 +0000 Subject: [PATCH] - Fixed generation of globalized PPDs. --- gutenprint-locale.patch | 84 +++++++++++++++++++++++++++++++++++++++++ gutenprint.spec | 7 +++- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 gutenprint-locale.patch diff --git a/gutenprint-locale.patch b/gutenprint-locale.patch new file mode 100644 index 0000000..8a3ee2d --- /dev/null +++ b/gutenprint-locale.patch @@ -0,0 +1,84 @@ +diff -up gutenprint-5.2.2/src/cups/genppd.c.locale gutenprint-5.2.2/src/cups/genppd.c +--- gutenprint-5.2.2/src/cups/genppd.c.locale 2008-09-26 00:41:00.000000000 +0100 ++++ gutenprint-5.2.2/src/cups/genppd.c 2008-12-05 13:46:48.000000000 +0000 +@@ -1,5 +1,5 @@ + /* +- * "$Id: genppd.c,v 1.170 2008/09/25 23:41:00 rlk Exp $" ++ * "$Id: genppd.c,v 1.171 2008/12/05 03:27:20 easysw Exp $" + * + * PPD file generation program for the CUPS drivers. + * +@@ -200,6 +200,13 @@ int /* O - Exit status */ + main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ + { ++ /* ++ * Force POSIX locale, since stp_init incorrectly calls setlocale... ++ */ ++ ++ putenv((char *)"LANG=C"); ++ putenv((char *)"LC_ALL=C"); ++ putenv((char *)"LC_NUMERIC=C"); + + /* + * Initialise libgutenprint +@@ -893,6 +900,7 @@ write_ppd( + min_height, + max_width, + max_height; ++ char dimstr[255]; /* Dimension string */ + stp_parameter_t desc; + stp_parameter_list_t param_list; + const stp_param_string_t *opt; +@@ -1794,13 +1802,10 @@ write_ppd( + for (i = desc.bounds.dimension.lower; + i <= desc.bounds.dimension.upper; i++) + { +- /* FIXME +- * For now, just use mm; we'll fix it later +- * for the locale-appropriate setting. +- * --rlk 20040818 +- */ +- gzprintf(fp, "*Stp%s %d/%.1f mm: \"\"\n", +- desc.name, i, ((double) i) * 25.4 / 72); ++ snprintf(dimstr, sizeof(dimstr), _("%.1f mm"), ++ (double)i * 25.4 / 72.0); ++ gzprintf(fp, "*Stp%s %d/%s: \"\"\n", ++ desc.name, i, dimstr); + } + + print_close_ui = 0; +@@ -2197,19 +2202,14 @@ write_ppd( + if (!desc.is_mandatory) + gzprintf(fp, "*%s.Stp%s %s/%s: \"\"\n", lang, desc.name, + "None", _("None")); +- if (localize_numbers) ++ /* Unlike the other fields, dimensions are not strictly numbers */ ++ for (i = desc.bounds.dimension.lower; ++ i <= desc.bounds.dimension.upper; i++) + { +- for (i = desc.bounds.dimension.lower; +- i <= desc.bounds.dimension.upper; i++) +- { +- /* FIXME +- * For now, just use mm; we'll fix it later +- * for the locale-appropriate setting. +- * --rlk 20040818 +- */ +- gzprintf(fp, "*%s.Stp%s %d/%.1f mm: \"\"\n", lang, +- desc.name, i, ((double) i) * 25.4 / 72); +- } ++ snprintf(dimstr, sizeof(dimstr), _("%.1f mm"), ++ (double)i * 25.4 / 72.0); ++ gzprintf(fp, "*%s.Stp%s %d/%s: \"\"\n", lang, ++ desc.name, i, dimstr); + } + gzprintf(fp, "*%s.ParamCustomStp%s Value/%s: \"\"\n", lang, + desc.name, _("Value")); +@@ -2320,5 +2320,5 @@ write_ppd( + + + /* +- * End of "$Id: genppd.c,v 1.170 2008/09/25 23:41:00 rlk Exp $". ++ * End of "$Id: genppd.c,v 1.171 2008/12/05 03:27:20 easysw Exp $". + */ diff --git a/gutenprint.spec b/gutenprint.spec index 3384d7d..e5cd955 100644 --- a/gutenprint.spec +++ b/gutenprint.spec @@ -4,7 +4,7 @@ Name: gutenprint Summary: Printer Drivers Package. Version: 5.2.2 -Release: 1%{?dist} +Release: 2%{?dist} Group: System Environment/Base URL: http://gimp-print.sourceforge.net/ Source0: http://dl.sf.net/gimp-print/gutenprint-%{version}.tar.bz2 @@ -12,6 +12,7 @@ Source1: gutenprint-foomaticppdupdate Patch0: gutenprint-menu.patch Patch1: gutenprint-O6.patch Patch2: gutenprint-selinux.patch +Patch3: gutenprint-locale.patch License: GPLv2+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: cups-libs >= 1.1.22-0.rc1.9.10, cups >= 1.1.22-0.rc1.9.10 @@ -129,6 +130,7 @@ Epson, HP and compatible printers.. %patch0 -p1 -b .menu %patch1 -p1 -b .O6 %patch2 -p1 -b .selinux +%patch3 -p1 -b .locale %build %ifarch ppc64 @@ -252,6 +254,9 @@ exit 0 /bin/rm -f /var/cache/foomatic/* %changelog +* Fri Dec 5 2008 Tim Waugh 5.2.2-2 +- Fixed generation of globalized PPDs. + * Thu Nov 20 2008 Tim Waugh 5.2.2-1 - 5.2.2. - Restore SELinux file contexts of modified PPDs.