On Fri, 25 Feb 2005 08:05:23 -0600, Tom 'spot' Callaway wrote:
On Fri, 2005-02-25 at 11:42 +0100, Matthias Saou wrote:
>Tom 'spot' Callaway wrote :
>
>> %disttaglong %{expand:%%(rpm -qi `rpm -qf /etc/redhat-release` |grep
>> Version | cut -d ":" -f 2 | cut -d " " -f 2 | perl -pe
's/^\s+//')}
>
>Hmm, haven't had enough coffee yet, but is the above just to get the
>version of the package that contains the redhat-release file!? If so, what
>about this instead :
>
>%(rpm -qf --qf '%{version}' /etc/redhat-release)
>
>I _must_ be missing something...
You are. We can't use %{version} in the macro, because when its parsed
at buildtime, it grabs the %{version} for the package being built, and
replaces it before running the command. Hence the ickiness.
%(rpm -qf --qf '%%{version}' /etc/redhat-release)
was used successfully before, e.g. in the fedora.us k3b package (see
e.g. Fedora Extras CVS FC-1 branch).