teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame 0001-Revert-_smp_build_ncpus-change-to-a-parametric-macro.patch

Panu Matilainen 1cc558
From 673bd62bd3035575f8fad501f1395b09a0f9f8fe Mon Sep 17 00:00:00 2001
Panu Matilainen 1cc558
Message-Id: <673bd62bd3035575f8fad501f1395b09a0f9f8fe.1685346662.git.pmatilai@redhat.com>
Panu Matilainen 1cc558
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 1cc558
Date: Mon, 29 May 2023 10:34:57 +0300
Panu Matilainen 1cc558
Subject: [PATCH] Revert %_smp_build_ncpus change to a parametric macro
Panu Matilainen 1cc558
 (RhBug:2210347)
Panu Matilainen 1cc558
Panu Matilainen 1cc558
Commit a213101bc3af65c860d045c65fb4e2ef7566a4c6 changed %_smp_build_ncpus
Panu Matilainen 1cc558
into a parametric macro, but this breaks common usage via the Lua macros
Panu Matilainen 1cc558
table as parametric macros are returned as closures rather than the
Panu Matilainen 1cc558
expanded value.
Panu Matilainen 1cc558
Panu Matilainen 1cc558
This seems like a design flaw of the macros table, but as an immediate
Panu Matilainen 1cc558
remedy for the breakage, add another layer of indirection to revert
Panu Matilainen 1cc558
%_smp_build_ncpus back to a non-parametric macro.
Panu Matilainen 1cc558
Panu Matilainen 1cc558
Fixes %constrain_build macro in Fedora, which ironically is made obsolete by
Panu Matilainen 1cc558
the change that (unintentionally) broke it.
Panu Matilainen 1cc558
---
Panu Matilainen 1cc558
 macros.in | 12 +++++++-----
Panu Matilainen 1cc558
 1 file changed, 7 insertions(+), 5 deletions(-)
Panu Matilainen 1cc558
Panu Matilainen 1cc558
diff --git a/macros.in b/macros.in
Panu Matilainen 1cc558
index 5521daba8..4dc6e3ca3 100644
Panu Matilainen 1cc558
--- a/macros.in
Panu Matilainen 1cc558
+++ b/macros.in
Panu Matilainen 1cc558
@@ -717,21 +717,23 @@ Supplements:   (%{name} = %{version}-%{release} and langpacks-%{1})\
Panu Matilainen 1cc558
 # Macro to fix broken permissions in sources
Panu Matilainen 1cc558
 %_fixperms      %{__chmod} -Rf a+rX,u+w,g-w,o-w
Panu Matilainen 1cc558
 
Panu Matilainen 1cc558
-# Maximum number of CPU's to use when building, 0 for unlimited.
Panu Matilainen 1cc558
-#%_smp_ncpus_max 0
Panu Matilainen 1cc558
-
Panu Matilainen 1cc558
-%_smp_build_ncpus() %([ -z "$RPM_BUILD_NCPUS" ] \\\
Panu Matilainen 1cc558
+%__smp_use_ncpus() %([ -z "$RPM_BUILD_NCPUS" ] \\\
Panu Matilainen 1cc558
 	&& RPM_BUILD_NCPUS="%{getncpus %{?1}}"; \\\
Panu Matilainen 1cc558
         ncpus_max=%{?_smp_ncpus_max}; \\\
Panu Matilainen 1cc558
         if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
Panu Matilainen 1cc558
         echo "$RPM_BUILD_NCPUS";)
Panu Matilainen 1cc558
 
Panu Matilainen 1cc558
+# Maximum number of CPU's to use when building, 0 for unlimited.
Panu Matilainen 1cc558
+#%_smp_ncpus_max 0
Panu Matilainen 1cc558
+
Panu Matilainen 1cc558
+%_smp_build_ncpus %{__smp_use_ncpus:proc}
Panu Matilainen 1cc558
+
Panu Matilainen 1cc558
 %_smp_mflags -j${RPM_BUILD_NCPUS}
Panu Matilainen 1cc558
 
Panu Matilainen 1cc558
 # Maximum number of threads to use when building, 0 for unlimited
Panu Matilainen 1cc558
 #%_smp_nthreads_max 0
Panu Matilainen 1cc558
 
Panu Matilainen 1cc558
-%_smp_build_nthreads %{_smp_build_ncpus:thread}
Panu Matilainen 1cc558
+%_smp_build_nthreads %{__smp_use_ncpus:thread}
Panu Matilainen 1cc558
 
Panu Matilainen 1cc558
 # Assumed task size of processes and threads in megabytes.
Panu Matilainen 1cc558
 # Used to limit the amount of parallelism based on available memory.
Panu Matilainen 1cc558
-- 
Panu Matilainen 1cc558
2.40.1
Panu Matilainen 1cc558