[Rpm-maint] [rpm-software-management/rpm] 4.17.0: problem with processing macros params (Issue #1998)

Tomasz Kłoczko notifications at github.com
Sun Apr 10 14:00:23 UTC 2022


I need macro which needs to use some optional parametr.
That macro looks like:
```spec
%build_foo() %{expand:\\\
        /usr/bin/command -a -b -c %[%{*}?"%{*}":"bar"] -d}
```
So theoreticall if that `%build_foo` macro should be called without parameters it should be unrolled to `/usr/bin/command -a -b -c bar -d`.
If it will be called as `%build_foo something` it shoud be unrolled to `/usr/bin/command -a -b -c somehing -d`.

Issue is that If I'm usig that macro without param it is indeed unrolled to `/usr/bin/command -a -b -c bar -d` however hen it is used with param rpmbuild fails with:
```console
RPM: error: macro expansion returned a bare word, please use "...": %{*}?"%{*}":"bar"
RPM: error:                                                         ^
RPM: error: expanded string: bar
Failed to open: 'test_package.spec', not a valid spec file: can't parse specfile

Error: Some packages could not be found.
error: macro expansion returned a bare word, please use "...": %{*}?"%*":"bar"
error:                                                         ^
error: expanded string: doc-source
  2<      (%build_foo)
  2<      (%)
  1<    (%expand)
  0<  (%build_foo)
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1998
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/1998 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220410/d03c4f66/attachment.html>


More information about the Rpm-maint mailing list