Zac Medico wrote:
1) Save test_conditionals.py in your PYTHONPATH as
portage/test/ebuild/test_conditionals.py
2) Run `trial portage.test.ebuild` and watch it fail.
3) Apply DepSet-AndRestriction.patch then watch the previous test
succeed.
4) Run vdb-depset-test.py to try it on your whole vdb (ParseErrors can
be expected due to invalid syntax).
Actually, step 4 will not work without the attached patch that fixes a
problem with the vdb multiplex repository.
After the DepSet and multiplex repository work mentioned above, I spend some
time experimenting with bin/tests/build_installed_state_graph.py and was able
to get the state_graph working correctly for most of the packages in my vdb
(neglecting ParseErrors which I fixed by editing vdb *DEPEND files directly).
The first and last hunks of the attached patch fix a couple small breakages
that are due to code changes elsewhere. The middle hunk fixes a problem with
block atoms that do not match any packages. Previously, these atoms would not
make it into the okay_atoms set which caused unresolved dependencies.
One other problem worth noting is that some DepSet conditionals may be
evaluated incorrectly due to USE flag handling in portage.vdb.repository where
USE flags are filtered to only include the ones listed in IUSE. This causes
the ARCH flag to be excluded (x86 in my case) and conseqent problems when the
pkg.rdepends DepSet is evaluated.
Zac
Index: portage/graph/state_graph.py
===
--- portage/graph/state_graph.py (revision 2326)
+++ portage/graph/state_graph.py (working copy)
@@ -6,7 +6,7 @@
import sets
from portage.package.atom import atom
-from portage.restrictions.packages import OrRestriction
+from portage.restrictions.boolean import OrRestriction
class StateGraph(object):
@@ -58,12 +58,19 @@
all_atoms.union_update(atomset)
okay_atoms = sets.Set()
for atom in all_atoms:
+have_blocker=False
for child in self.pkgs:
if atom.key != child.key:
continue
- if atom.match(child) ^ atom.blocks:
- okay_atoms.add(atom)
+ if atom.match(child):
+ if atom.blocks:
+ have_blocker=True
+ else:
+ okay_atoms.add(atom)
break
+if atom.blocks and not have_blocker:
+ # block atom that does not match any packages
+ okay_atoms.add(atom)
for choice in self.pkgs[pkg][0]:
if choice.issubset(okay_atoms):
break
@@ -187,10 +194,7 @@
ret = sets.Set()
if isinstance(restrict, OrRestriction):
- # XXX: OrRestrictions currently contain a single DepSet that contains
- # the Or'd elements. This seems broken to me.
- # -- jstubbs
- for element in restrict[0]:
+ for element in restrict:
if isinstance(element, atom):
newset = sets.Set()
newset.add(element)