]> TLD Linux GIT Repositories - packages/rpm.git/commitdiff
- backported support for noarch subpackages
authorMarcin Krol <hawk@tld-linux.org>
Sat, 1 Jun 2019 17:40:13 +0000 (19:40 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Sat, 1 Jun 2019 17:40:13 +0000 (19:40 +0200)
rpm-noarch-subpackages.patch [new file with mode: 0644]
rpm.spec

diff --git a/rpm-noarch-subpackages.patch b/rpm-noarch-subpackages.patch
new file mode 100644 (file)
index 0000000..a9d0b0e
--- /dev/null
@@ -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);
index 6bddf669268fe312e3142b8b8bbd802e69174d52..64751f57c60bc4c9373a18de102857f133ed56be 100644 (file)
--- 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