From 92959858e09949b2b69d5da023f08053e21c3557 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sat, 1 Jun 2019 19:40:13 +0200 Subject: [PATCH] - backported support for noarch subpackages --- rpm-noarch-subpackages.patch | 59 ++++++++++++++++++++++++++++++++++++ rpm.spec | 4 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 rpm-noarch-subpackages.patch diff --git a/rpm-noarch-subpackages.patch b/rpm-noarch-subpackages.patch new file mode 100644 index 0000000..a9d0b0e --- /dev/null +++ b/rpm-noarch-subpackages.patch @@ -0,0 +1,59 @@ +diff -urpa rpm-4.5.orig/build/parsePreamble.c rpm-4.5/build/parsePreamble.c +--- rpm-4.5.orig/build/parsePreamble.c 2019-06-01 18:55:39.351000000 +0200 ++++ rpm-4.5/build/parsePreamble.c 2019-06-01 19:24:30.398000000 +0200 +@@ -730,19 +730,32 @@ static int handlePreambleTag(Spec spec, + case RPMTAG_EXCLUSIVEOS: + addOrAppendListEntry(spec->sourceHeader, tag, field); + break; +- case RPMTAG_BUILDARCHS: +- if ((rc = poptParseArgvString(field, +- &(spec->BACount), +- &(spec->BANames)))) { ++ case RPMTAG_BUILDARCHS: { ++ int BACount; ++ const char **BANames = NULL; ++ if ((rc = poptParseArgvString(field, &BACount, &BANames))) { + rpmError(RPMERR_BADSPEC, + _("line %d: Bad BuildArchitecture format: %s\n"), + spec->lineNum, spec->line); + return RPMERR_BADSPEC; + } +- if (!spec->BACount) ++ if (spec->packages == pkg) { ++ spec->BACount = BACount; ++ spec->BANames = BANames; ++ } else { ++ if (BACount != 1 || strcmp(BANames[0], "noarch")) { ++ rpmError(RPMERR_BADSPEC, ++ _("line %d: Only noarch subpackages are supported: %s\n"), ++ spec->lineNum, spec->line); ++ BANames = _free(BANames); ++ return RPMRC_FAIL; ++ } ++ headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, "noarch", 1); ++ } ++ if (!BACount) + spec->BANames = _free(spec->BANames); + break; +- ++ } + default: + rpmError(RPMERR_INTERNAL, _("Internal error: Bogus tag %d\n"), tag); + return RPMERR_INTERNAL; +diff -urpa rpm-4.5.orig/build/parseSpec.c rpm-4.5/build/parseSpec.c +--- rpm-4.5.orig/build/parseSpec.c 2019-06-01 18:55:39.226000000 +0200 ++++ rpm-4.5/build/parseSpec.c 2019-06-01 19:27:44.338000000 +0200 +@@ -627,8 +627,11 @@ int parseSpec(rpmts ts, const char *spec + } + + (void) headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1); +- (void) headerAddEntry(pkg->header, RPMTAG_ARCH, +- RPM_STRING_TYPE, arch, 1); ++ /* noarch subpackages already have arch set here, leave it alone */ ++ if (!headerIsEntry(pkg->header, RPMTAG_ARCH)) { ++ (void) headerAddEntry(pkg->header, RPMTAG_ARCH, ++ RPM_STRING_TYPE, arch, 1); ++ } + (void) headerAddEntry(pkg->header, RPMTAG_PLATFORM, + RPM_STRING_TYPE, platform, 1); + diff --git a/rpm.spec b/rpm.spec index 6bddf66..64751f5 100644 --- a/rpm.spec +++ b/rpm.spec @@ -42,7 +42,7 @@ Summary(ru.UTF-8): Менеджер пакетов от RPM Summary(uk.UTF-8): Менеджер пакетів від RPM Name: rpm Version: 4.5 -Release: 86 +Release: 87 License: LGPL Group: Base Source0: %{name}-%{version}.tar.gz @@ -177,6 +177,7 @@ Patch114: %{name}-ruby-gem-build.patch Patch115: %{name}-glibc.patch Patch116: %{name}-trigger-flags-int-type.patch Patch117: %{name}-rpm2cpio-xz.patch +Patch118: %{name}-noarch-subpackages.patch URL: http://rpm5.org/ BuildRequires: autoconf >= 2.57 BuildRequires: automake >= 1.4 @@ -821,6 +822,7 @@ install %{SOURCE13} scripts/perl.prov %patch115 -p1 %patch116 -p1 %patch117 -p1 +%patch118 -p1 mv -f po/{sr,sr@Latn}.po rm -rf sqlite zlib popt -- 2.46.0