Saturday, April 5, 2014

How to find out which packages are taken from which repository in OpenSUSE/SUSE ?


Normally we often add repositories for specific applications for which we want the latest. Sometimes we get stuck in a soup where the whole repo suddenly goes down and we want to find what packages were in the repo.

Well if you are stuck in the same soup as I was then the following steps below might help.

1) Identify the names of the repositories. Go to yast -> Software repositories. Lets assumed we named a repository "xyz" (Note: this can be the repository alias/URI) 

Scenario 1: The repository is up and I want to know which packages where obtained from that alias/URI

zypper se -sir xyz  

Scenario 2: The repository is down and I want to know which packages where obtained from that alias/URI. In this case we must force a no refresh otherwise we won't get valid/useful output
zypper --no-refresh se -sir xyz

 
That's it. Now to show you some sample output of a real command.

zypper --no-refresh se -sir KDE:Extra
Loading repository data...
Reading installed packages...

S | Name                | Type    | Version   | Arch   | Repository
--+---------------------+---------+-----------+--------+-----------
i | dropbox             | package | 1.6.0-4.4 | x86_64 | KDE:Extra
i | kcm_tablet          | package | 2.0-1.6   | x86_64 | KDE:Extra
i | kcm_tablet-lang     | package | 2.0-1.6   | noarch | KDE:Extra
i | lensfun-devel       | package | 0.2.7-5.3 | x86_64 | KDE:Extra
i | lensfun-doc         | package | 0.2.7-5.3 | x86_64 | KDE:Extra 

Now assuming that the KDE:Extra repository which I have is now defunct I can see what packages were installed from there and either remove them or find another repo which has them and take appropriate action.

Go ahead and feel free to try it out.

AN IRC buddy had suggested a way to isolate and display only package names intead of the entire table.

His command syntax was:

zypper se -sir 12 | awk '$1 ~ /^i/{print $3}'


Feel free to try it out.

No comments:

Post a Comment