diff --git a/.cvsignore b/.cvsignore index 8d7d826..433d8d2 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1,2 @@ popt-1.13.tar.gz +png-mtime.py diff --git a/popt-1.13-popt_fprintf.patch b/popt-1.13-popt_fprintf.patch deleted file mode 100644 index a4f972b..0000000 --- a/popt-1.13-popt_fprintf.patch +++ /dev/null @@ -1,119 +0,0 @@ -Patch by Jeff Johnson for popt >= 1.13, which reverts all POPT_fprintf() -usage cases to avoid broken umlauts in --help output at some non-UTF8 locales. It should -not break anything, just restore the behaviour of popt 1.12 again to not introduce a new -regression. Clueless modified by Robert Scheck to hide the last found -two locale regression as well. - ---- popt-1.13/popthelp.c 2007-11-04 16:46:25.000000000 +0100 -+++ popt-1.13/popthelp.c.popt_fprintf 2007-12-30 22:10:24.000000000 +0100 -@@ -281,7 +281,6 @@ - char * left; - size_t nb = maxLeftCol + 1; - int displaypad = 0; -- int xx; - - /* Make sure there's more than enough room in target buffer. */ - if (opt->longName) nb += strlen(opt->longName); -@@ -406,9 +405,9 @@ - } - - if (help) -- xx = POPT_fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left); -+ fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left); - else { -- xx = POPT_fprintf(fp," %s\n", left); -+ fprintf(fp," %s\n", left); - goto out; - } - -@@ -428,18 +427,19 @@ - if (ch == help) break; /* give up */ - while (ch > (help + 1) && _isspaceptr(ch)) - ch = POPT_prev_char (ch); -- ch++; -+ ch = POPT_next_char(ch); - - sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), (int) indentLength); - /*@-formatconst@*/ -- xx = POPT_fprintf(fp, format, help, " "); -+ fprintf(fp, format, help, " "); - /*@=formatconst@*/ - help = ch; -- while (_isspaceptr(help) && *help) help++; -+ while (_isspaceptr(help) && *help) -+ help = POPT_next_char(help); - helpLength = strlen(help); - } - -- if (helpLength) xx = POPT_fprintf(fp, "%s\n", help); -+ if (helpLength) fprintf(fp, "%s\n", help); - help = NULL; - - out: -@@ -553,7 +553,6 @@ - { - const struct poptOption * opt; - const char *sub_transdom; -- int xx; - - if (table == poptAliasOptions) { - itemHelp(fp, con->aliases, con->numAliases, columns, NULL); -@@ -577,7 +576,7 @@ - sub_transdom = translation_domain; - - if (opt->descrip) -- xx = POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip)); -+ fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip)); - - singleTableHelp(con, fp, opt->arg, columns, sub_transdom); - } -@@ -767,7 +766,7 @@ - translation_domain = (const char *)opt->arg; - } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { - if (done) { -- int i; -+ int i = done->nopts; - if (done->opts != NULL) - for (i = 0; i < done->nopts; i++) { - const void * that = done->opts[i]; ---- popt-1.13/poptint.c 2007-11-04 16:56:24.000000000 +0100 -+++ popt-1.13/poptint.c.popt_fprintf 2007-12-30 22:10:24.000000000 +0100 -@@ -124,6 +124,18 @@ - } - } - -+char * -+POPT_next_char (const char *str) -+{ -+ char *p = (char *)str; -+ -+ while (1) { -+ p++; -+ if ((*p & 0xc0) != (char)0x80) -+ return (char *)p; -+ } -+} -+ - int - POPT_fprintf (FILE* stream, const char *format, ...) - { ---- popt-1.13/poptint.h 2007-12-11 19:02:29.000000000 +0100 -+++ popt-1.13/poptint.h.popt_fprintf 2007-12-30 22:10:24.000000000 +0100 -@@ -144,11 +144,14 @@ - #endif - #endif - -+char *POPT_prev_char (/*@returned@*/ const char *str) -+ /*@*/; -+ -+char *POPT_next_char (/*@returned@*/ const char *str) -+ /*@*/; -+ - int POPT_fprintf (FILE* stream, const char *format, ...) - /*@globals fileSystem @*/ - /*@modifies stream, fileSystem @*/; - --char *POPT_prev_char (/*@returned@*/ const char *str) -- /*@*/; -- - #endif diff --git a/popt-1.13-textdomain.patch b/popt-1.13-textdomain.patch new file mode 100644 index 0000000..e3847ee --- /dev/null +++ b/popt-1.13-textdomain.patch @@ -0,0 +1,158 @@ +Patch by Takao Fujiwara 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 + #endif + +-#define POPT_WCHAR_HACK +-#ifdef POPT_WCHAR_HACK +-#include /* 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 + #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 diff --git a/popt.spec b/popt.spec index d554fa5..7b0875c 100644 --- a/popt.spec +++ b/popt.spec @@ -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 @@ Install it if you need to link statically with libpopt. %prep %setup -q %patch0 -p1 -b .multilib -%patch1 -p1 -b .popt_fprintf +%patch1 -p1 -b .textdomain %build %configure --libdir=/%{_lib} @@ -52,7 +53,7 @@ doxygen # 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 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libpopt.a %changelog +* Thu Feb 14 2008 Robert Scheck 1.13-2 +- Added patch to work around missing bind_textdomain_codeset() + * Sun Dec 30 2007 Robert Scheck 1.13-1 - Upgrade to 1.13 (#290531, #332201, #425803) - Solved multilib problems at doxygen generated files (#342921) diff --git a/sources b/sources index 387f6af..7f79017 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ b5c47ce0185c83f947953c77000533bf popt-1.13.tar.gz +2fe94a35ebc84b35e8d9405215bbf89d png-mtime.py