RPM Community Forums

Mailing List Message of <rpm-users>

Re: determine package arch without/before building package?

From: Jeffrey Johnson <n3npq@me.com>
Date: Thu 12 Jul 2012 - 00:12:41 CEST
Message-id: <B41CAAEC-D524-4972-92E2-65943C8E6706@me.com>

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
Received on Thu Jul 12 00:12:56 2012
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.