portageq: add new expand_virtual function
Something like this was requested in bug #157357. Now that Gentoo has
migrated all virtuals to GLEP 37 new-style virtuals, this kind of
function may be helpful in order to resolve the currently installed
provider of a particular virtual in scripts like bootstrap.sh.
Usage:
portageq expand_virtual <root> <atom>
Returns a \n separated list of atoms expanded from a
given virtual atom, excluding blocker atoms. Satisfied
virtual atoms are not included in the output, since
they are expanded to real atoms which are displayed.
Unsatisfied virtual atoms are displayed without
any expansion. The "match" command can be used to
resolve the returned atoms to specific installed
packages.
Example input/output:
$ portageq expand_virtual / virtual/jre
=dev-java/sun-jdk-1.6.0*
$ portageq expand_virtual / virtual/jre:1.5
dev-java/gcj-jdk
$ portageq expand_virtual / virtual/package-manager
sys-apps/portage
$ portageq expand_virtual / virtual/libc
sys-libs/glibc:2.2
$ portageq expand_virtual / virtual/os-headers
sys-kernel/linux-headers:0