[Fedora-packaging] Retrieving the value of a macro defined in a spec file

Jeff Peeler jpeeler at redhat.com
Sat Jun 21 03:00:33 UTC 2014


I'm trying to extract a %global after it has been evaluated as it would end up
during build time. rpmspec -P almost works, but the output is stripped of all
the %global macros, so the macro is not able to be grepped. My understanding
is that I can't use eval as that does not evalute macros that are done only at
build time, which I assume is true for my spec below. I'm interested in getting
the value of release_version, but I guess the process would be the same for any
of them.

%global project_name heat
Source99: sources
%global release_version %(cat %{SOURCE99} | awk %'{sub(/%{project_name}-/, ""); sub(/.tar.gz/, ""); print $2}')
...

It would be great if there were a solution available in python, but I've not
found anything in the TransactionSet API of value. Surely this must be possible
as "fedpkg mockbuild" works as expected.

Jeff


More information about the packaging mailing list