The idea is to support package set operations such as | (union), & (intersection), and - (difference), using the same operator characters that python uses for the corresponding set operations. There will be a class called PackageSetExpression that will match packages against expressions such as "( @a & @b ) - ( @c | @d )". It will be used within the dependency resolver in much the same way that the PackageSet class is currently used. This is meant to solve problems with previous set operation support which was removed in these two commits: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=84de8f714de5d4599c5ea8dd207ed237b6a3c883 http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a650ded25b0b003a46b12824d1f7b8987cdae915 The issue with the previous support was that intersection between sets only worked if those sets contained identical atoms, even if those sets contained different atoms that happened to match the same packages. The new support will solve this issue by using intersection of matched packages instead of intersection of atoms. The PackageSetExpression will probably convert expressions from infix to postfix, in order to facilitate the use of a stack-based evaluation algorithm.
Unlike a PackageSet, a PackageSetExpression does not have a well-defined set of atoms that can be pulled into the dependency graph. Instead, it will have a set of candidate atoms that is generated from the sets contained in the expression. The dependency resolver will select a package instance to match a candidate atom, and then it will check whether or not the selected package actually matches the expression.