teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
From d53499d1565dd7ba6d93939e552cc604b26dccd7 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Fri, 26 Feb 2016 11:15:23 +0100
Subject: [PATCH] Use %_build_cpu instead of noarch when evaluating ExcludeArch
 and ExclusiveArch

Some noarch packages need build tools not available on all architectures.
By using %_build_cpu you can restrict the architectures those noarch
packages can be build on.
---
 build/parsePreamble.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 13501de..933f734 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -428,6 +428,11 @@ static rpmRC checkForValidArchitectures(rpmSpec spec)
     char *arch = rpmExpand("%{_target_cpu}", NULL);
     char *os = rpmExpand("%{_target_os}", NULL);
     rpmRC rc = RPMRC_FAIL; /* assume failure */
+
+    if (!strcmp(arch, "noarch")) {
+	free(arch);
+	arch = rpmExpand("%{_build_cpu}", NULL);
+    }
     
     if (isMemberInEntry(spec->buildRestrictions,
 			arch, RPMTAG_EXCLUDEARCH) == 1) {
-- 
2.5.0