From 4b92b8006c32c10a5443e201d8ca6058e1ff6c10 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 5 Feb 2009 13:58:38 +0000 Subject: [PATCH] - fixup rpm translation lookup to match Fedora specspo (#436941) --- rpm-4.6.0-fedora-specspo.patch | 96 ++++++++++++++++++++++++++++++++++ rpm.spec | 9 +++- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 rpm-4.6.0-fedora-specspo.patch diff --git a/rpm-4.6.0-fedora-specspo.patch b/rpm-4.6.0-fedora-specspo.patch new file mode 100644 index 0000000..7872041 --- /dev/null +++ b/rpm-4.6.0-fedora-specspo.patch @@ -0,0 +1,96 @@ +diff --git a/lib/tagexts.c b/lib/tagexts.c +index 501d8ac..cf71639 100644 +--- a/lib/tagexts.c ++++ b/lib/tagexts.c +@@ -460,12 +460,6 @@ static int filerequireTag(Header h, rpmtd td) + } + + /* 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,63 +471,27 @@ static const char * const _macro_i18ndomains = "%{?_i18ndomains}"; + */ + static int i18nTag(Header h, rpmTag tag, rpmtd td) + { +- char * dstring = rpmExpand(_macro_i18ndomains, NULL); +- int rc; ++ int rc = headerGet(h, tag, td, HEADERGET_ALLOC); ++ if (rc) { ++ char *de, *dstring = rpmExpand(_macro_i18ndomains, NULL); ++ const char *domain; + +- 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; +- const char * n; +- int xx; +- +- xx = headerNVR(h, &n, NULL, NULL); +- rasprintf(&msgkey, "%s(%s)", n, 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 +- +- 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_DEFAULT); ++ + return rc; + } + diff --git a/rpm.spec b/rpm.spec index 7b24df0..112fecf 100644 --- a/rpm.spec +++ b/rpm.spec @@ -18,7 +18,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: 0.%{snapver}.3%{?dist} +Release: 0.%{snapver}.4%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2 @@ -30,6 +30,9 @@ Source10: desktop-file.prov Patch0: rpm-4.5.90-devel-autodep.patch Patch1: rpm-4.5.90-pkgconfig-path.patch Patch2: rpm-4.5.90-gstreamer-provides.patch +# Fedora specspo is setup differently than what rpm expects, considering +# this as Fedora-specific patch for now +Patch3: rpm-4.6.0-fedora-specspo.patch # Patches already in upstream Patch200: rpm-4.6.0-rc1-defaultdocdir.patch @@ -166,6 +169,7 @@ that will manipulate RPM packages and databases. %patch0 -p1 -b .devel-autodep %patch1 -p1 -b .pkgconfig-path %patch2 -p1 -b .gstreamer-prov +%patch3 -p1 -b .fedora-specspo # upstream but not on 4.6.x branch yet, oops %patch200 -p1 -b .defaultdocdir @@ -370,6 +374,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Thu Feb 05 2009 Panu Matilainen - 4.6.0-0.rc4.4 +- fixup rpm translation lookup to match Fedora specspo (#436941) + * Wed Feb 04 2009 Panu Matilainen - 4.6.0-0.rc4.3 - extract mimehandler provides from .desktop files - preliminaries for extracting font provides (not enabled yet)