Re: determine package arch without/before building package?
On Jul 11, 2012, at 12:13 PM, Tim Mooney wrote: 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 Yes: SRPM's have a RPMTAG_ARCH associated. And yes sed/grep/awk can all be used if the *.spec file isn't all b00gered up with macro magic. The functionality is kinda tweaky and backward because ultimately the arch is determined by configuration and how rpm is invoked which are all mostly known a priori (noarch being the important exception, cross-building and multilib builds have never been directly supported by rpmbuild itself meaningfully). (aside) It wouldn't be too hard to add some sugary automatic syntax to all of the above to hide the gory details. All that stops the implementation is consensus on the option (technically the popt alias) name to be used and supported. I'm not going to hold my breath waiting for consensus to appear wrto rpmbuild however. hth 73 de Jeff __ RPM Package Managerhttp://rpm5.org User Communication List rpm-users@rpm5.org
Re: determine package arch without/before building package?
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. Tim -- Tim Mooney tim.moo...@ndsu.edu Enterprise Computing Infrastructure 701-231-1076 (Voice) Room 242-J6, IACC Building 701-231-8541 (Fax) North Dakota State University, Fargo, ND 58105-5164 __ RPM Package Managerhttp://rpm5.org User Communication List rpm-users@rpm5.org
Re: determine package arch without/before building package?
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 Managerhttp://rpm5.org User Communication List rpm-users@rpm5.org