How to list rpm packages from certain repository

Usually, rpm --queryformat can be used to generate all sorts of rpm package listing. You could, for example, use the vendor tag to separate the packages that are tagged with RPM Fusion from the list of all installed packages (rpm -qa):

$ rpm -qa --queryformat "%{Name}:%{Vendor}\n" | grep -F "RPM Fusion"

Unfortunately, there is no 1:1 mapping between rpm’s vendor tag and the install repository. In some cases, the vendor tag is just slightly altered (upper case letters, etc.) or the tag is completely empty.

And there is obviously no rpm tag for repositories, since rpm itself doesn’t know anything about repositories (you can list all available tags by invoking rpm --querytags). But of course, yum does!
To get a list of packages from the RPM Fusion repository, you can use

$ yum list installed | grep -i fusion

Resources:
http://unix.stackexchange.com/questions/22560/list-all-rpm-packages-installed-from-repo-x
http://www.rpm.org/max-rpm/s1-rpm-query-parts.html

1 thought on “How to list rpm packages from certain repository

  1. avatarleolee192

    There isn’t a one-to-one mapping between Vendor and repos, and in some cases, the Vendor string is blank

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.