rpm -qa and architecture info

Dag Wieers dag at wieers.com
Sat Mar 27 23:48:25 UTC 2010


On Fri, 26 Mar 2010, Yong Huang wrote:

>>> `rpm -qa' shows the package names (and versions and releases). This command
>>>
>>> rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n'
>>>
>>> shows that plus architecture. Is there a shorter command that does the same, i.e. shows name, version, release and arch? It's hard to remember and type that long line. I want something like
>>>
>>> rpm -qa [a simple option that shows arch IN ADDITION TO what the preceding option i.e. -qa shows]
>>
>> What I often do is create a file called /etc/rpm/macros.query_all_fmt and
>> add the following content:
>>
>>     %_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}
>>
>> This will automatically show the architecture in a way that is compatible
>> with yum if you do rpm -qa.
>>
>> This, however, will break any programs that does not specifically
>> provide a query format and somehow expects the default output (without
>> architecture).
>>
>> To be honest, I think the current default is a design bug. Not specifying
>> an architecture results in non-unique output and causes confusion with
>> users.
>
> Thank you very much! You're the only person that understands my 
> question. (To others, thank you all too, but you all missed my point.)
>
> I tried your /etc/rpm/macros.query_all_fmt. It works great. Can you 
> give an example of a program "that does not specifically provide a query 
> format" and fails after this file is created? And I agree with you on 
> the "design bug" comment on the current default.

Hi Yong,

I don't know of any scripts in Red Hat that use the rpm -qa output without 
a specific --queryformat (or --qf). But I would not be surprised that 
this change interferes with some stuff (custom or vendor) in some places.

The stuff I wrote myself all uses --qf specifically :-)

-- 
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[Any errors in spelling, tact or fact are transmission errors]




More information about the redhat-list mailing list