Friday, October 2, 2009

3rd Party RPM Packages

While auditing an RPM based system, I started wondering what would be the easiest way to determine all the packages installed from 3rd party repositories, such as rpmforge.  Such knowledge is often useful, since some of these repositories contain packages which replace standard packages (example: php packages from remi repository).

I did not find any RPM query flags to query based on Vendor or Packager.  Which meant, extracting the information using queryformat and then parsing the output.

rpm --querytags provides a list of tags you can request in your queries.  For my purposes, I could use VENDOR and PACKAGER.

To find all 3rd party packages you can run:

~]# rpm -qa --queryformat '%{NAME}: %{VENDOR}\n' | grep -v ": CentOS"
gpg-pubkey: (none)
rpmforge-release: Dag Apt Repository, http://dag.wieers.com/apt/
gpg-pubkey: (none)
ncftp: Fedora Project
segatex: Dag Apt Repository, http://dag.wieers.com/apt/
python-xattr: Dag Apt Repository, http://dag.wieers.com/apt/
gpg-pubkey: (none)
gpg-pubkey: (none)
ipython: Fernando Perez

As you can see from the output above, I have ignored packages vended by CentOS.

Similarly, to select packages packaged by Dag Wieers, you can run:

~]# rpm -qa --queryformat '%{NAME}: %{PACKAGER}\n' | grep Dag
rpmforge-release: Dag Wieers
python-xattr: Dag Wieers

Cheers,
VVK


No comments:

Post a Comment