[Rpm-maint] [rpm-software-management/rpm] No build-in processing for multiple occurrences of an option with the same name (Issue #2448)

Ralf Habacker notifications at github.com
Thu Mar 23 08:51:48 UTC 2023


Attempting to process multiple occurrences of an option with the same name with the available rpm macros always returns the last occurrence of the specified option, as the following example shows:

```sh
$ rpm --version
RPM version 4.14.3

$ rpm --define='%_macro(D:) %(echo " option -D: %{-D:%{-D*}}")'  --eval "%_macro -Dxxx=aaa -Dyyy sdsdsd"
 option -D: -Dyyy
```
An evaluation of the [available](https://github.com/rpm-software-management/rpm/blob/master/docs/manual/macros.md) rpm macros for accessing macro parameters with: 
```sh
$ rpm --define='%_macro(D:) %(echo -e " name: %0 \\n non-option-count: %# \\n non-option-params: %* \\n all-params: %** \\n option -D: %{-D:%{-D*}}")'  --eval "%_macro -Dxxx=aaa -Dyy sdsdsd"
 name: _macro 
 non-option-count: 1 
 non-option-parameter: sdsdsd 
 all parameters: -Dxxx=aaa -Dyyy -- sdsdsd 
 Option -D: -Dyyy
```
shows that the requested option is basically available only through `%**` but requires additional processing to extract the multiple occurrences of the relevant option. It would therefore be helpful if rpm had support for this case.

This case has come up when revising an rpm macro for cmake support at the mingw project on build.opensuse.org, where single options would have to be processed in the macro in question but other options that may occur multiple times would have to be passed to cmake.

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

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


More information about the Rpm-maint mailing list