[Centos] Change your default rpm query format on multi-lib archs (like x86_64)

Wed Jan 12 00:19:11 UTC 2005
Johnny Hughes <mailing-lists at hughesjr.com>

All,

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
---------------------------

So now you can easily tell which arch of a program is installed on
multi-lib machines.

Thanks,
Johnny Hughes