teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.7.90-fedora-specspo.patch

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