[Rpm-maint] [rpm-software-management/rpm] How to expand possibly non-existent user constructed variable name? (Discussion #3411)

Michael Schroeder notifications at github.com
Wed Oct 30 11:06:17 UTC 2024


You just need to escape the first % in the expand macro:
```
rpm -D "name string-io" -D "string_io_prerelease .dev" --eval "%{expand:%%{?%{gsub %{name} - _}_prerelease}}"
.dev
```

Without the expand:
```
$ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval "%%{?%{gsub %{name} - _}_prerelease}"
%{?string_io_prerelease}
$ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval "%{?%{gsub %{name} - _}_prerelease}"
$
```
As you can see, the expand macro does not get anything to expand if you do not escape the `%`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/discussions/3411#discussioncomment-11098996
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/repo-discussions/3411/comments/11098996 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241030/61cebf21/attachment.html>


More information about the Rpm-maint mailing list