On Fri, 2007-10-12 at 16:58 -0500, Miguel Cobá wrote: > I have a mixed installation with packages from stable and testing and > I want to list the packages and what version (stable, testing, > unstable) of debian are they from. > > I have searched the web for a solution, but nothing until now. With > > dpkg -l or apt-show-versions > > I can find the version number of the package, but not the repo. > > Do you know how to get the list this way? >
This should get you a list of installed packages, what archive they are from, and if they are from a main archive, or the security archive: dpkg --get-selections |while read pkg dummy; do src=$(apt-cache policy $pkg |grep -A1 ' \*' |sed 1d | tr -s "[:blank:]" ); [ -n "$src" ] && echo $pkg: $(apt-cache policy |grep -A1 "$src" |grep -oE '(a| l)=[A-Za-z-]+'); done Sample output: [EMAIL PROTECTED]:~$ ./pkglist |head -n 5 a2ps: a=stable l=Debian abiword-common: a=stable l=Debian abiword-gnome: a=stable l=Debian acpi: a=stable l=Debian acpid: a=stable l=Debian -davidc -- gpg-key: http://www.zettazebra.com/files/key.gpg
signature.asc
Description: This is a digitally signed message part