Florian Festi 43e89e
From d53499d1565dd7ba6d93939e552cc604b26dccd7 Mon Sep 17 00:00:00 2001
Florian Festi 43e89e
From: Florian Festi <ffesti@redhat.com>
Florian Festi 43e89e
Date: Fri, 26 Feb 2016 11:15:23 +0100
Florian Festi 43e89e
Subject: [PATCH] Use %_build_cpu instead of noarch when evaluating ExcludeArch
Florian Festi 43e89e
 and ExclusiveArch
Florian Festi 43e89e
Florian Festi 43e89e
Some noarch packages need build tools not available on all architectures.
Florian Festi 43e89e
By using %_build_cpu you can restrict the architectures those noarch
Florian Festi 43e89e
packages can be build on.
Florian Festi 43e89e
---
Florian Festi 43e89e
 build/parsePreamble.c | 5 +++++
Florian Festi 43e89e
 1 file changed, 5 insertions(+)
Florian Festi 43e89e
Florian Festi 43e89e
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
Florian Festi 43e89e
index 13501de..933f734 100644
Florian Festi 43e89e
--- a/build/parsePreamble.c
Florian Festi 43e89e
+++ b/build/parsePreamble.c
Florian Festi 43e89e
@@ -428,6 +428,11 @@ static rpmRC checkForValidArchitectures(rpmSpec spec)
Florian Festi 43e89e
     char *arch = rpmExpand("%{_target_cpu}", NULL);
Florian Festi 43e89e
     char *os = rpmExpand("%{_target_os}", NULL);
Florian Festi 43e89e
     rpmRC rc = RPMRC_FAIL; /* assume failure */
Florian Festi 43e89e
+
Florian Festi 43e89e
+    if (!strcmp(arch, "noarch")) {
Florian Festi 43e89e
+	free(arch);
Florian Festi 43e89e
+	arch = rpmExpand("%{_build_cpu}", NULL);
Florian Festi 43e89e
+    }
Florian Festi 43e89e
     
Florian Festi 43e89e
     if (isMemberInEntry(spec->buildRestrictions,
Florian Festi 43e89e
 			arch, RPMTAG_EXCLUDEARCH) == 1) {
Florian Festi 43e89e
-- 
Florian Festi 43e89e
2.5.0
Florian Festi 43e89e