0

I am working on 64 bits RHEL and I want rpm -q to use these tags by default:

'%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}'

Other than typing the tags by hand or defining an alias, is there a way I can configure this in ~/.rpmrc or another config file?

2 Answers 2

0

The %_query_all_fmt macro defines what format is used. Set it in ~/.rpmmacros.

%_query_all_fmt %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}
2
  • Works great, thanks! Before I accept your answer, can you please tell me where you found this? I searched for the answer but couldn't find it. Thanks! Jul 28, 2010 at 17:56
  • I can't remember. I've been using rpm for... about a decade, and it's one of the things I picked up along the way. Anyways, rpm --showrc is your friend. Jul 28, 2010 at 17:59
0

I found below output most practical:

rpm -q --qf \
    '%{name}-%|epoch?{%{epoch}:}:{}|%{version}-%{release}%|arch?{.%{arch}}:{}|\n'

in ~/.rpmmacros you can skip adding \n at the end of the format. Basically it skips displaying %{epoch} or %{arch} if package doesn't have it set. For example see output of rpm -q tar openssl bind-libs perl-CGI gpg-pubkey on Scientific Linux 6.2.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .