Evaluating macros from outside a spec file

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

 



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


_______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux