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, I'll give that a try!

--
Orion Poplawski
he/him/his  - surely the least important thing about me
IT Systems Manager                         720-772-5637
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       [email protected]
Boulder, CO 80301                 https://www.nwra.com/
--
_______________________________________________
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