[Yum] Can yum show a listing of just the locally installed packages?

William Stearns wstearns at pobox.com
Thu Mar 19 20:36:55 UTC 2009


Good afternoon, Gerry, Seth, all,

On Thu, 19 Mar 2009, Gerry Reno wrote:

> Seth Vidal wrote:
>> 
>> 
>> On Thu, 19 Mar 2009, Gerry Reno wrote:
>>> Yeah, I was afraid that was the case. I'd tried about everything in the 
>>> man page.
>>> 
>>> Suggestion: What would be great from the standpoint of yum metadata is if 
>>> we could query yum and have it tell us what repository delivered each 
>>> package. Something like:
>>> 
>>> # yum list installed
>>> Loading "fastestmirror" plugin
>>> Loading mirror speeds from cached hostfile
>>> * fedora: ftp-stud.hs-esslingen.de
>>> * updates: ftp-stud.hs-esslingen.de
>>> fedora 100% |=========================| 2.1 kB 00:00
>>> updates 100% |=========================| 2.3 kB 00:00
>>> Installed Packages
>>> yum.noarch 3.2.8-2.fc7 installed fedora
>>> yum-fastestmirror.noarch 1.1.11-1.fc7 installed fedora-updates
>>> yum-metadata-parser.i386 1.1.0-2.fc7 installed fedora-updates
>>> yum-updatesd.noarch 3.2.8-2.fc7 installed fedora-updates
>>> yum-versionlock.noarch 1.1.11-1.fc7 installed local
>>> 
>> 
>> 
>> As of this time there is no place to store the information of where a 
>> package came from.
>> 
>> -sv
>> 
> We need such metadata in yum though. Maybe this 'place' could be added in the 
> newer versions?

 	This can be inferred from the "Signature" field.  I add this in 
with a sed script, attached, that adds a repository named based on the 
"Key ID".  There would be quite a bit of work in coming up with a general 
set of Key ID <-> Repo mappings.
 	If your local packages are signed, you could use this approach as 
well.
 	Cheers,
 	- Bill

---------------------------------------------------------------------------
 	"Vi has two modes; the one in which it beeps and the one in
which it doesn't."
 	-- Alan Cox
--------------------------------------------------------------------------
William Stearns (wstearns at pobox.com, tools and papers: www.stearns.org)
Top-notch computer security training at www.sans.org , www.giac.net
--------------------------------------------------------------------------
-------------- next part --------------
#!/bin/bash
#Copyright 2005-2009 William Stearns <wstearns at pobox.com>
#Released under the GPL

#This adds the repository name to the rpm -qai output, such as:
#Signature   : DSA/SHA1, Tue Oct  3 22:44:57 2006, Key ID b44269d04f2a6fd2
#Repo        : fedora

#Sample call:
#rpm -qai | add-repo-name


sed \
 -e 's/Key ID 508ce5e666534c2b$/Key ID 508ce5e666534c2b\
Repo        : atrpms/' \
 -e 's/Key ID c12beffc68d9802a$/Key ID c12beffc68d9802a\
Repo        : ccrma/' \
 -e 's/Key ID a20e52146b8d79e6$/Key ID a20e52146b8d79e6\
Repo        : dag/' \
 -e 's/Key ID 9c14a19c1aa78495$/Key ID 9c14a19c1aa78495\
Repo        : dries/' \
 -e 's/Key ID 82ed95041ac70ce6$/Key ID 82ed95041ac70ce6\
Repo        : extras/' \
 -e 's/Key ID b44269d04f2a6fd2$/Key ID b44269d04f2a6fd2\
Repo        : fedora/' \
 -e 's/Key ID da84cbd430c9ecf8$/Key ID da84cbd430c9ecf8\
Repo        : fedora testing/' \
 -e 's/Key ID 692ac459e42d547b$/Key ID 692ac459e42d547b\
Repo        : freshrpms/' \
 -e 's/Key ID 5c6cfff7c431416d$/Key ID 5c6cfff7c431416d\
Repo        : jpackage/' \
 -e 's/Key ID 71295441a109b1ec$/Key ID 71295441a109b1ec\
Repo        : livna/' \
 -e 's/Key ID 924c9edfb8693f2c$/Key ID 924c9edfb8693f2c\
Repo        : newrpms/' \
 -e 's/Key ID 219180cddb42a60e$/Key ID 219180cddb42a60e\
Repo        : redhat/' \
 -e 's/Key ID 012334cbf322929d$/Key ID 012334cbf322929d\
Repo        : wstearns/' \
 -e 's/Key ID 35d8da21fd4fe9e9$/Key ID 35d8da21fd4fe9e9\
Repo        : ximian/' \




exit

# -e 's/Key ID $/Key ID \
#Repo        : /' \


More information about the Yum mailing list