rpms/popt/devel popt-1.13-textdomain.patch, NONE, 1.1 .cvsignore, 1.3, 1.4 popt.spec, 1.2, 1.3 sources, 1.3, 1.4 popt-1.13-popt_fprintf.patch, 1.1, NONE

Robert Scheck (robert) fedora-extras-commits at redhat.com
Fri Feb 15 22:11:20 UTC 2008


Author: robert

Update of /cvs/pkgs/rpms/popt/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13770/devel

Modified Files:
	.cvsignore popt.spec sources 
Added Files:
	popt-1.13-textdomain.patch 
Removed Files:
	popt-1.13-popt_fprintf.patch 
Log Message:
Added patch to work around missing bind_textdomain_codeset()


popt-1.13-textdomain.patch:

--- NEW FILE popt-1.13-textdomain.patch ---
Patch by Takao Fujiwara <takao.fujiwara at sun.com> for popt >= 1.13, which should fix all
POPT_fprintf() usage cases where umlauts were broken in --help output at some non-UTF8
locales. Problem is, that some of the applications do not set bind_textdomain_codeset(),
so this patch is working around it and likely to get upstream for popt 1.13.1. 

--- popt-1.13/popthelp.c				2008-01-16 02:19:01.000000000 +0900
+++ popt-1.13/popthelp.c.textdomain			2008-01-25 02:18:08.000000000 +0900
@@ -15,13 +15,6 @@
 #include <sys/ioctl.h>
 #endif
 
-#define	POPT_WCHAR_HACK
-#ifdef 	POPT_WCHAR_HACK
-#include <wchar.h>			/* for mbsrtowcs */
-/*@access mbstate_t @*/
-#endif
-
-
 #include "poptint.h"
 
 /*@access poptContext@*/
@@ -374,6 +367,16 @@ static void singleOptionHelp(FILE * fp, 
 	    case POPT_ARG_STRING:
 		*le++ = (opt->longName != NULL ? '=' : ' ');
 		strcpy(le, argDescrip);		le += strlen(le);
+		{   const char * scopy = argDescrip;
+		    size_t n = 0;
+
+		    while (*scopy != '\0') {
+			scopy = POPT_next_char (scopy);
+			n++;
+		    }
+
+		    displaypad = (int) (strlen (argDescrip) - n);
+		}
 		break;
 	    default:
 		break;
@@ -387,18 +390,17 @@ static void singleOptionHelp(FILE * fp, 
 	    lelen = strlen(le);
 	    le += lelen;
 
-#ifdef	POPT_WCHAR_HACK
 	    {	const char * scopy = argDescrip;
-		mbstate_t t;
-		size_t n;
+		size_t n = 0;
 
-		memset ((void *)&t, 0, sizeof (t));	/* In initial state.  */
 		/* Determine number of characters.  */
-		n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
+		while (*scopy != '\0') {
+		    scopy = POPT_next_char (scopy);
+		    n++;
+		}
 
 		displaypad = (int) (lelen-n);
 	    }
-#endif
 	}
 	if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
 	    *le++ = ']';
@@ -420,6 +422,7 @@ static void singleOptionHelp(FILE * fp, 
     helpLength = strlen(help);
     while (helpLength > lineLength) {
 	const char * ch;
+	char * formatted_help = NULL;
 	char format[16];
 
 	ch = help + lineLength - 1;
@@ -430,9 +433,12 @@ static void singleOptionHelp(FILE * fp, 
 	    ch = POPT_prev_char (ch);
 	ch++;
 
-	sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), (int) indentLength);
+	formatted_help = xstrdup (help);
+	formatted_help[ch - help] = '\0';
+	sprintf(format, "%%s\n%%%ds", (int) indentLength);
 	/*@-formatconst@*/
-	xx = POPT_fprintf(fp, format, help, " ");
+	xx = POPT_fprintf(fp, format, formatted_help, " ");
+	free (formatted_help);
 	/*@=formatconst@*/
 	help = ch;
 	while (_isspaceptr(help) && *help) help++;
@@ -594,7 +600,7 @@ static size_t showHelpIntro(poptContext 
     size_t len = (size_t)6;
     const char * fn;
 
-    fprintf(fp, POPT_("Usage:"));
+    POPT_fprintf(fp, POPT_("Usage:"));
     if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) {
 /*@-type@*/	/* LCL: wazzup? */
 	fn = con->optionStack->argv[0];
@@ -614,9 +620,9 @@ void poptPrintHelp(poptContext con, FILE
 
     (void) showHelpIntro(con, fp);
     if (con->otherHelp)
-	fprintf(fp, " %s\n", con->otherHelp);
+	POPT_fprintf(fp, " %s\n", con->otherHelp);
     else
-	fprintf(fp, " %s\n", POPT_("[OPTION...]"));
+	POPT_fprintf(fp, " %s\n", POPT_("[OPTION...]"));
 
     if (columns) {
 	columns->cur = maxArgWidth(con->options, NULL);
--- popt-1.13/poptint.c					2008-01-16 00:28:39.000000000 +0900
+++ popt-1.13/poptint.c.textdomain			2008-01-25 02:20:34.000000000 +0900
@@ -2,6 +2,35 @@
 #include <stdarg.h>
 #include "poptint.h"
 
+const char utf8_skip_data[256] = {
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+#if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
+char *
+_D_ (const char * dom, const char * str)
+{
+    char * codeset = NULL;
+    char * retval = NULL;
+
+    if (!dom) 
+	dom = textdomain (NULL);
+    codeset = bind_textdomain_codeset (dom, NULL);
+    bind_textdomain_codeset (dom, "UTF-8");
+    retval = dgettext(dom, str);
+    bind_textdomain_codeset (dom, codeset);
+
+    return retval;
+}
+#endif
+
 #ifdef HAVE_ICONV
 static /*@only@*/ /*@null@*/ char *
 strdup_locale_from_utf8 (/*@null@*/ char *buffer)
--- popt-1.13/poptint.h					2008-01-16 02:01:07.000000000 +0900
+++ popt-1.13/poptint.h.textdomain			2008-01-25 01:44:43.000000000 +0900
@@ -104,8 +104,10 @@ struct poptContext_s {
 #define _(foo) foo
 #endif
 
+extern const char utf8_skip_data[];
+#define POPT_next_char(p) (char *)((p) + utf8_skip_data[*(const unsigned char *)(p)])
 #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
-#define D_(dom, str) dgettext(dom, str)
+#define D_(dom, str) _D_(dom, str)
 #define POPT_(foo) D_("popt", foo)
 #else
 #define D_(dom, str) str


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/popt/devel/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- .cvsignore	30 Dec 2007 21:38:50 -0000	1.3
+++ .cvsignore	15 Feb 2008 22:10:41 -0000	1.4
@@ -1 +1,2 @@
 popt-1.13.tar.gz
+png-mtime.py


Index: popt.spec
===================================================================
RCS file: /cvs/pkgs/rpms/popt/devel/popt.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- popt.spec	30 Dec 2007 21:38:50 -0000	1.2
+++ popt.spec	15 Feb 2008 22:10:41 -0000	1.3
@@ -1,13 +1,14 @@
 Summary:	C library for parsing command line parameters
 Name:		popt
 Version:	1.13
-Release:	1%{?dist}
+Release:	2%{?dist}
 License:	MIT
 Group:		System Environment/Libraries
 URL:		http://www.rpm5.org/
-Source:		http://www.rpm5.org/files/%{name}/%{name}-%{version}.tar.gz
+Source0:	http://www.rpm5.org/files/%{name}/%{name}-%{version}.tar.gz
+Source1:	http://people.redhat.com/jantill/fedora/png-mtime.py
 Patch0:		popt-1.13-multilib.patch
-Patch1:		popt-1.13-popt_fprintf.patch
+Patch1:		popt-1.13-textdomain.patch
 BuildRequires:	gettext, doxygen, graphviz
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -43,7 +44,7 @@
 %prep
 %setup -q
 %patch0 -p1 -b .multilib
-%patch1 -p1 -b .popt_fprintf
+%patch1 -p1 -b .textdomain
 
 %build
 %configure --libdir=/%{_lib}
@@ -52,7 +53,7 @@
 
 # Solve multilib problems by changing the internal PNG timestamp to a reference timestamp;
 # see http://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks for further information.
-perl -pi -e "s/tIME.{11}/tIME\x07\xd7\x0c\x0b\x17\x0a\x28\xc4\x1d\x23\xfc/" doxygen/html/*.png
+for png in doxygen/html/*{__,graph_legend}*.png; do python %{SOURCE1} $png CHANGES; done
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -96,6 +97,9 @@
 %{_libdir}/libpopt.a
 
 %changelog
+* Thu Feb 14 2008 Robert Scheck <robert at fedoraproject.org> 1.13-2
+- Added patch to work around missing bind_textdomain_codeset()
+
 * Sun Dec 30 2007 Robert Scheck <robert at fedoraproject.org> 1.13-1
 - Upgrade to 1.13 (#290531, #332201, #425803)
 - Solved multilib problems at doxygen generated files (#342921)


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/popt/devel/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sources	30 Dec 2007 21:38:50 -0000	1.3
+++ sources	15 Feb 2008 22:10:41 -0000	1.4
@@ -1 +1,2 @@
 b5c47ce0185c83f947953c77000533bf  popt-1.13.tar.gz
+2fe94a35ebc84b35e8d9405215bbf89d  png-mtime.py


--- popt-1.13-popt_fprintf.patch DELETED ---




More information about the fedora-extras-commits mailing list