[Linux]Change your default rpm query format on multi-lib archs
[ 2009/05/10 00:59 | by ipaddr ]
I am now building rpms on, and using a multi-lib arch (x86_64) for the first time ... when using the standard command:>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
rpm -qa | grep pkg_name
The results might be pkg_name.i386 or pkg_name.x86_64 ... or both. But, the way it is shown by the default query format, looks the same ... like this:
pkg_name
pkg_name
----------------------------
example:
[root at x86-64 ~]# rpm -qa | grep popt
popt-1.9.1-21
popt-1.9.1-21
----------------------------
To fix this problem on multi-lib machines (and change the default query format), you can change your .rpmmacros (or create a .rpmmacros) in your user home directory and add this line:
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}
---------------------------
Now the result of the above example is:
[root at x86-64 ~]# rpm -qa | grep popt
popt-1.9.1-21.x86_64
popt-1.9.1-21.i386
---------------------------
By the way, you can also use --queryformat like this:
rpm -q --queryformat='%{NAME}-%{VERSION}.%{ARCH}\n'