It occurred to me that I wanted to list all installed packages that come from overlays. (I'm doing some house cleaning, so I'm removing overlays I don't need anymore). There appears to be no way to generate this list via equery (the "gentoolkit" method of doing various package queries).
This one-liner should do the trick.
$ for i in /var/db/pkg/*/*; do if ! grep gentoo $i/repository >/dev/null; then echo -e "`basename $i`\t`cat $i/repository`"; fi; done
The output of which looks (only slightly messy) like:
revoco-0.5 Orpheus Local Overlay
nautilussvn-0.12_beta1-r2 Orpheus Local Overlay
evolution-data-server-2.28.2 Orpheus Local Overlay
gnome-hearts-0.3 Orpheus Local Overlay
nautilussvn-0.12_beta1_p2 Orpheus Local Overlay
mozilla-thunderbird-bin-3.0_beta2 Orpheus Local Overlay
libgii-1.0.2 Orpheus Local Overlay
xorg-server-1.7.4 Orpheus Local Overlay
You can see here that I have various packages installed from the SynCE overlay, the rion overlay and my homespun "Orpheus" overlay.
It assumes your overlay was set up correctly with the file profiles/repo_name containing the overlay name, at the time of install (not available in earlier versions of portage).