cros_workon: Handle workon-only packages.

This adds a --workon_only flag, which maps to the subset of --all
packages that have nothing but 9999 ebuild (i.e. no stable). This flag
can be used in conjunction with:

 start, info, list ==> applies to all workon-only packages

 stop, iterate ==> applies to all live packages that are workon-only

The implementation is quite inefficient because, for each atom found for
the --all set, it will scan all overlays looking for a stable (non-9999)
ebuild. This can probably be improved if need arises, by combining these
two scans into one.

BUG=brillo:634
TEST=Manually tested all command/flag combinations.

Change-Id: Id8276072e8a5a9a772baecbc893a4c7092d2de78
Reviewed-on: https://chromium-review.googlesource.com/262334
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
1 file changed