Re: Evaluating macros from outside a spec file

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

 



Hi Jeff,

jbj@xxxxxxxxxx (Jeff Johnson) writes:

[snip]
> > 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.

Yes, precisely.

[snip]
> 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}'

This works as expected, thanks, but it assumes you *know* that %{name}
is in the %_sourcedir macro definition.  Is there a generic way to get
rpm to provide the value of a macro defined from within a spec file?
(this is already done when creating the different rpm scriplets)

You mention that there are easier ways of getting a path. Perhaps you
could elaborate?

73 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