* Orion Poplawski:

> On 12/9/25 05:26, Florian Weimer wrote:
>> * Orion Poplawski:
>> 
>>> I'm trying to do something like this in %check:
>>>
>>> %{?with_xwayland:xwayland-run -- } %ctest --verbose || :
>>>
>>> but I'm ending up with just:
>>>
>>> xwayland-run --
>>>    /usr/bin/ctest --test-dir "redhat-linux-build-${mpi:-serial}" \
>>>
>>> because %ctest starts with a newline:
>>>
>>> %ctest(:-:h:j:u:v:A:C:D:E:F:H:I:L:M:N:O:Q:R:S:T:U:V:) \
>>>    %__ctest --test-dir "%{__cmake_builddir}" \\\
>>> ...
>>>
>>> So I have to do the strange:
>>>
>>> %{?with_xwayland:xwayland-run -- \ } %ctest --verbose || :
>>>
>>> Can we get some kind of standard that rpm macros should not be defined
>>> to start with a newline?
>> What about RPM macros that contain multiple shell commands?  They
>> wouldn't work in this situation, either.
>> 
>>> Or is there some other better way to handle this in general?
>> You can put the macro expansion into an exported bash function and
>> call
>> that.
>> wrapper () {
>> %ctest --verbose
>> }
>> declare -fx wrapper
>> %{?with_xwayland:xwayland-run -- } wrapper || :
>> This works if the macro expands to multiple shell commands, and
>> should
>> handle most shell control flow contructs, too.
>> Thanks,
>> Florian
>> 
>
> Unfortunately that failed with:
>
> Failed to run the command: [Errno 2] No such file or directory: 'ctest_wrap'

This would probably have worked:

%{?with_xwayland:xwayland-run -- } /usr/bin/bash -c ctest_wrap || :

Generating a script is a bit fragile because shell variables are now
double-expanded.

Thanks,
Florian

-- 
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://forge.fedoraproject.org/infra/tickets/issues/new

Reply via email to