[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Evaluating macros from outside a spec file



I would like to evaluate the macro expansion of values defined in a spec file from *outside* of the rpmbuild procedure.

A simple example in a shell script would be to evaluate %{_sourcedir}

$ rpm --eval '%{_sourcedir}'

This is fine and works as expected when %{_sourcedir} itself contains no macro names.

However in my ~/.rpmmacros I have %_sourcedir defined as follows:

%_sourcedir %{_topdir}/SRC/%{name}

Again this works correctly when building the rpm, but I need the correct value of %{_sourcedir} as defined in the spec file I am using, but I need to evaluate it from a shell script.

There is an rpm option --specfile XXXX but neither of the following works:

$ rpm --eval '%{_sourcedir}' --specfile /path/to/specfile.spec
$ rpm --specfile /path/to/specfile.spec --eval '%{_sourcedir}'

Is there any way to extract the correct value of %_sourcedir (or any other macro defined this way)?

Thanks for any pointers,

Regards,

Simon



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]