[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: To find out the installed packages repo section.



On Sat, May 29, 2010 at 23:21 +0700, Sthu Deus wrote:
> Is there an easy way how I can found out from which repo and which
> section (or whatever it is called, I mean here: main, contrib,
> non-free) one or more packages come from?

Certainly - Brought to me by #d's dpkg I now have the following among my
bash functions:

---- snip ---
function apt-listrepo () {
    dpkg -l | awk '/^.i/ {print $2}' \
    | xargs apt-cache policy \                                                                                                                          | awk '/^[a-z0-9.\-]+:/ {pkg=$1}; /\*\*\*/ {OFS="\t"; ver=$2; getline; print pkg,ver,$2,$3}'
}
--- snip ---

It produces output like:

    [...]
    xmonad: 0.9.1-2+b1  http://ftp.de.debian.org    squeeze/main
    xorg:   1:7.5+6 http://ftp.de.debian.org    squeeze/main
    xorg-dev:   1:7.5+6 http://ftp.de.debian.org    squeeze/main
    xorg-docs-core: 1:1.5-1 http://ftp.de.debian.org    squeeze/main
    [...]

Have fun :)
-- 
  .''`.     Wolodja Wentland    <wentland@cl.uni-heidelberg.de> 
 : :'  :    
 `. `'`     4096R/CAF14EFC 
   `-       081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC

Attachment: signature.asc
Description: Digital signature


Reply to: