Pretty much like the title says.I have a set of (source) URIs, distributions and sections enabled in my Debian Wheezy apt configuration. Now I want a list of all installed packages, and for each of those, the source URI, distribution and section that the currently installed version of each respective package has been installed from.I'm basically looking for something like the output of dpkg -l but instead of the description it would show the source URI, distribution and section. Something like:||/ Name       Version           Arch  InstalledFrom+++-==========-=================-=====-===================ii  package1   1:4.14-1.1+deb7u1 amd64 ftp://ftp.se.debian.org/debian wheezy mainii  package2   1.7-1             all   ftp://ftp.se.debian.org/debian wheezy/updates mainii  package3   1.0.25+3~deb7u1   all   ftp://ftp.se.debian.org/debian wheezy non-freeii  package4   0.9.8~3           amd64 localii  package5   7.2.107           i386  localHow can I obtain such a list of packages?Nicely formatted would be a bonus, but mostly anything that I can grep for interesting line substrings (or even just browse through) will likely do.
How do I list installed packages with source URI, distribution and section in Debian?
debian;software installation;apt
I found myself putting together pieces from the different answers, particularly Braiam's and muru's. In the end, I ended up with this oneliner, which gets me close enough to a start that I should be able to figure out the rest:dpkg-query --showformat '${Package}\n' -W | \while read package; do \  apt-cache policy $package | grep -q wheezy/non-free && echo $package ; \doneThe above lists the names of all packages which apt-cache policy reports as coming from wheezy/non-free (not exactly, but close enough for the moment). By adjusting what the script does with the apt-cache policy output, while it won't be in a nice tabular format (at least out of the box), it should be possible to get fairly close to what I am after.Thanks to everyone who helped out!