[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Displaying %doc and language specific files of an rpm

On Tue, 9 Dec 2008, Till Maas wrote:

On Mon December 1 2008, Panu Matilainen wrote:

Docs, config files, ghosts and the like can be viewed with this ('d' is
for doc):
rpm -qp --qf "[%{fileflags:fflags} %{filenames}\n]" <pkg>

I want to extend this to display a "-> linktarget" if a file is a symlink.
This is what I tried, but it always adds the "->":

rpm -qp --qf "[%{filenames} %|filelinktos?{-> %{filelinktos}}:{}| \n]"

Do you know, how to make this work? I found the %|foo?{bar}:{baz}| syntax in
the queryformat doc file from rpm.

The queryformat conditional result is about tag existence (and all packages have filelinktos tag, regardless if they contain symlinks or not), not would it print something for a particular item.

In other words, there's no way to do that within queryformat, but you can of course pipe the output for extra processing, eg rpm -q --qf "[%{FILENAMES} %{FILELINKTOS}\n]\n" libcap.x86_64 | awk '{print $2 ? $1 " -> " $2 : $1}'

Or use --pipe option to rpm but that's hardly useful outside popt aliases. But that's not likely to work too well if you have lots of optional data. Sooner or later it's going to be easier to just use python for fancy formatting.

	- Panu -

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]