rpm/rpm-4.7.90-fedora-specspo.patch
Panu Matilainen 5e19ecce34 - update to rpm 4.8.0-beta1
- drop patches + other sources now included upstream
- add conflict for current ocaml-runtime
2009-12-07 13:35:12 +00:00

93 lines
2.4 KiB
Diff

diff -up rpm-4.7.90.git9301/lib/tagexts.c.fedora-specspo rpm-4.7.90.git9301/lib/tagexts.c
--- rpm-4.7.90.git9301/lib/tagexts.c.fedora-specspo 2009-09-02 13:59:38.000000000 +0300
+++ rpm-4.7.90.git9301/lib/tagexts.c 2009-09-02 14:51:10.000000000 +0300
@@ -460,12 +460,6 @@ static int filerequireTag(Header h, rpmt
}
/* I18N look aside diversions */
-
-#if defined(ENABLE_NLS)
-extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
-#endif
-static const char * const language = "LANGUAGE";
-
static const char * const _macro_i18ndomains = "%{?_i18ndomains}";
/**
@@ -477,61 +471,27 @@ static const char * const _macro_i18ndom
*/
static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
{
- char * dstring = rpmExpand(_macro_i18ndomains, NULL);
- int rc;
-
- td->type = RPM_STRING_TYPE;
- td->data = NULL;
- td->count = 0;
-
- if (dstring && *dstring) {
- char *domain, *de;
- const char * langval;
- char * msgkey;
- const char * msgid;
-
- rasprintf(&msgkey, "%s(%s)", headerGetString(h, RPMTAG_NAME),
- rpmTagGetName(tag));
-
- /* change to en_US for msgkey -> msgid resolution */
- langval = getenv(language);
- (void) setenv(language, "en_US", 1);
-#if defined(ENABLE_NLS)
- ++_nl_msg_cat_cntr;
-#endif
+ int rc = headerGet(h, tag, td, HEADERGET_ALLOC);
+ if (rc) {
+ char *de, *dstring = rpmExpand(_macro_i18ndomains, NULL);
+ const char *domain;
- msgid = NULL;
for (domain = dstring; domain != NULL; domain = de) {
+ const char *msgid = td->data;
+ const char *msg = NULL;
+
de = strchr(domain, ':');
if (de) *de++ = '\0';
- msgid = dgettext(domain, msgkey);
- if (msgid != msgkey) break;
- }
-
- /* restore previous environment for msgid -> msgstr resolution */
- if (langval)
- (void) setenv(language, langval, 1);
- else
- unsetenv(language);
-#if defined(ENABLE_NLS)
- ++_nl_msg_cat_cntr;
-#endif
-
- if (domain && msgid) {
- td->data = dgettext(domain, msgid);
- td->data = xstrdup(td->data); /* XXX xstrdup has side effects. */
- td->count = 1;
- td->flags = RPMTD_ALLOCED;
+ msg = dgettext(domain, td->data);
+ if (msg != msgid) {
+ free(td->data);
+ td->data = xstrdup(msg);
+ break;
+ }
}
- dstring = _free(dstring);
- free(msgkey);
- if (td->data)
- return 1;
+ free(dstring);
}
- dstring = _free(dstring);
-
- rc = headerGet(h, tag, td, HEADERGET_ALLOC);
return rc;
}