Evaluate conditional USE deps for *DEPEND atoms saved in vdb entries.
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:16:52 +0000 (20:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:16:52 +0000 (20:16 -0000)
(trunk r15351)

svn path=/main/branches/2.1.7/; revision=15578

pym/portage/__init__.py
pym/portage/dbapi/bintree.py

index 8d215ae752c6b0d43a3e49040ecba7db175ead74..32a7902d3483e44723f4b24a0e33cdf9179c1719 100644 (file)
@@ -5872,6 +5872,7 @@ def _post_src_install_chost_fix(settings):
 
 _vdb_use_conditional_keys = ('DEPEND', 'LICENSE', 'PDEPEND',
        'PROPERTIES', 'PROVIDE', 'RDEPEND', 'RESTRICT',)
+_vdb_use_conditional_atoms = frozenset(['DEPEND', 'PDEPEND', 'RDEPEND'])
 
 def _post_src_install_uid_fix(mysettings, out=None):
        """
@@ -5994,6 +5995,16 @@ def _post_src_install_uid_fix(mysettings, out=None):
                v = dep.paren_enclose(v)
                if not v:
                        continue
+               if v in _vdb_use_conditional_atoms:
+                       v_split = []
+                       for x in v.split():
+                               try:
+                                       x = dep.Atom(x)
+                               except exception.InvalidAtom:
+                                       v_split.append(x)
+                               else:
+                                       v_split.append(str(x.evaluate_conditionals(use)))
+                       v = ' '.join(v_split)
                codecs.open(_unicode_encode(os.path.join(build_info_dir,
                        k), encoding=_encodings['fs'], errors='strict'),
                        mode='w', encoding=_encodings['repo.content'],
index e07f58a47bb21dd399bacc784ad24e822f817709..ecc8424c009d89781a2dbfa9ee365f879744fbe4 100644 (file)
@@ -1049,6 +1049,16 @@ class binarytree(object):
                                writemsg("%s: %s\n" % (k, str(e)),
                                        noiselevel=-1)
                                raise
+                       if k in portage._vdb_use_conditional_atoms:
+                               v_split = []
+                               for x in deps.split():
+                                       try:
+                                               x = portage.dep.Atom(x)
+                                       except portage.exception.InvalidAtom:
+                                               v_split.append(x)
+                                       else:
+                                               v_split.append(str(x.evaluate_conditionals(raw_use)))
+                               deps = ' '.join(v_split)
                        metadata[k] = deps
 
        def exists_specific(self, cpv):