On 8/11/21 11:19 AM, Ankur Sinha wrote:
On Wed, Aug 11, 2021 10:56:39 +0300, Panu Matilainen wrote:
> On 8/10/21 8:53 PM, Ankur Sinha wrote:
>> On Thu, Aug 05, 2021 09:01:14 +0200, Miroslav Suchý wrote:
>>> Dne 05. 08. 21 v 2:42 Michel Alexandre Salim via devel napsal(a):
>>>> This is now implemented on Rawhide; Fedora updates are in testing:
>>>
>>> Where is it documented?
>>>
>>> I suggest one of these
>>>
>>>
https://rpm-packaging-guide.github.io/
>>>
https://docs.fedoraproject.org/en-US/packaging-guidelines/
>>
>> That would be great. I was trying to put %limit_build at the top of my
>> spec and kept getting errors. Then I looked at the mcrouter spec and
>> realised this needs to go into the %build section XD
>
> Yes, the macro is a strange as it mixes rpm macro language and shell
> language, relying on some rather subtle aspects of how spec parsing and
> macros work and has to be placed in a shell section. If you ask me, it's
> asking for trouble.
>
> Setting RPM_BUILD_NCPUS environment should achieve the same without
> requiring the twisty %global override which looks like it may break
> _smp_build_ncpus use in later sections (but I may be missing something
> there)
I think it does.
Yep. It breaks debuginfo processing for one, which is a showstopper.
Builds fail with "Empty %files file .../debugsourcefiles.list" and the like.
To ensure that at least 1 thread was available, I tried
various combinations of:
%if %{?_smp_build_ncpus} == 0
but kept getting errors. I tried with and without quotes, and with a 0
before the macro and all that, hoping I could redefine _smp_build_ncpus
to 1 if %limit_build set it to 0. Finally, I've restored to this, which
works:
test %{?_smp_build_ncpus} -gt "0" && ( echo "Building with
%{?_smp_build_ncpus} CPUs" ; %make_build ) || ( echo "Building with 1 CPUs"
; %{__make} %{_make_output_sync} -j1 %{_make_verbose} )
If someone can tell me how to use a simple %if there, that'll be great.
If the macro can be modified to ensure that _smp_build_ncpus is at least
1, that'll be even better :)
The macro needs to be fixed, ending up with 0 is unacceptable and so is
breaking debuginfo.
- Panu -