On Jul 11, 2012, at 4:54 PM, Tim Mooney wrote:
> In regard to: Re: determine package arch without/before building package?,...:
>
>>> Given a spec file foo.spec, is there a way use rpmbuild or rpm to
>>> determine what the package architecture will be without (or before)
>>> actually building the package?
>>>
>>> I know I could use sed or grep on the spec file looking for BuildArch,
>>> but I'm wondering if there's a way to essentially run the equivalent of
>>> a macro --eval query against a spec file.
>>>
>>
>> The "recommended" way is this
>>
>> ./rpm -q --qf '%{arch}\n' --specsrpm rpm.spec
>> x86_64
>
> Thanks Jeff, that worked perfectly, at least with RPM 5.x.
>
Yes --specsrpm is unique to rpm5 (SRPM, not binary, headers are queried).
But also "works" with --specfile everywhere, just watch out for
1) you will get multiple replies, one for each binary subpkg (head -n 1
solves instantly)
2) all modern rpm permits noarch subpkgs, older (like >3y old) legacy
rpm does not.
73 de Jeff
______________________________________________________________________
RPM Package Manager http://rpm5.org
User Communication List [email protected]