Mailinglist Archive: opensuse-factory (649 mails)

< Previous Next >
Re: [opensuse-factory] Which package recommends a certain other package?

On Tue, 22 Aug 2017, Werner Flamme wrote:
What could I use instead of the unknown "rpm -q --whatrecommends
libreoffice" (rpm: --whatrecommends: unknown option)?

A "rpm -qa --recommends" generates a lot of output, but applying a "grep
libreoffice" to it is quite senseless :-\

Well, not really what you need, and that's been solved, but you can
get the info that options give:

rpm -qa --qf '[%{NAME}-%{VERSION}-%{RELEASE}:\t%{RECOMMENDS}\n]' | \
awk '$2 ~ /libreoffice/ { print; }'


rpm -qa --qf '[%{NAME}-%{VERSION}-%{RELEASE}:\t%{RECOMMENDNAME}\n]' | \
awk '$2 ~ /libreoffice/ { print; }'

See 'rpm --querytags' for more available tags and the rpm-book for how
to generally use the queryformat option. And no, all-uppercase is not
neccessary for the querytags.

You could put that into a script / shell-function, e.g. something
along these lines:

==== ~/bin/rpm-whatrecommends ====

pat="$1"; shift;
test -z "$pat" && echo "USAGE: $0 'PATTERN' [options/args..]" >&2

rpm -qa --qf "$QF" "$@" | \
awk -vPAT="$pat" -F':' '$2 ~ PAT { print; }'

You could use '{print $1;}' in the awk to just get the package name
and add a 'sort -u' at the end ... ;)


"Wenn das Wörtchen 'wenn' nicht wär' ,
wär' die Platte jetzt nicht leer."
-- ratti in suse-linux
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >