On Tue, Aug 24, 2004 at 09:37:28PM +0200, Simon J Mudd wrote: > 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} > Ummm, %name is pkg dependent, as you have discovered. > 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}' > Of course they don't work, --eval is immediate. Try (if you must, there's certainly easier ways to get a path): rpm --define "name `rpm -q --qf '%{name}' --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)? > Modulo typos and quoting, this should display the path that you desire. 73 de Jeff -- Jeff Johnson ARS N3NPQ jbj@xxxxxxxxxx (jbj@xxxxxxx) Chapel Hill, NC _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list