aboutsummaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-05-04 03:17:33 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-05-04 03:17:33 +0000
commitf0a03faf8bdac8a5ef8178a22187ecb7111a93f1 (patch)
tree77ba32509b26b884f3aa417de46bd2b5f0fc157f /pym
parentBUILDDIR has been renamed (diff)
downloadportage-cvs-f0a03faf8bdac8a5ef8178a22187ecb7111a93f1.tar.gz
portage-cvs-f0a03faf8bdac8a5ef8178a22187ecb7111a93f1.tar.bz2
portage-cvs-f0a03faf8bdac8a5ef8178a22187ecb7111a93f1.zip
Added remove_preferentials() method to the DependSpec class. Simplified
PkgGlue to just being a container.
Diffstat (limited to 'pym')
-rw-r--r--pym/portage_dep.py24
-rw-r--r--pym/portage_syntax.py8
2 files changed, 25 insertions, 7 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index 4b0e2cc..8772568 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -1,8 +1,8 @@
# deps.py -- Portage dependency resolution functions
# Copyright 2003-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_dep.py,v 1.30 2005/05/03 13:49:35 jstubbs Exp $
-cvs_id_string="$Id: portage_dep.py,v 1.30 2005/05/03 13:49:35 jstubbs Exp $"[5:-2]
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_dep.py,v 1.31 2005/05/04 03:17:33 jstubbs Exp $
+cvs_id_string="$Id: portage_dep.py,v 1.31 2005/05/04 03:17:33 jstubbs Exp $"[5:-2]
# DEPEND SYNTAX:
#
@@ -664,9 +664,9 @@ class GluePkg(portage_syntax.CPV):
def __init__(self, cpv, db, use, bdeps, rdeps):
portage_syntax.CPV.__init__(self, cpv)
self.db = db
- self.use = use.split()
- self.bdeps = portage_syntax.DependSpec(bdeps).resolve_conditions(self.use)
- self.rdeps = portage_syntax.DependSpec(rdeps).resolve_conditions(self.use)
+ self.use = use
+ self.bdeps = bdeps
+ self.rdeps = rdeps
def transform_dependspec(dependspec, preferences):
@@ -718,9 +718,19 @@ class TargetGraph(object):
# keys
self.graph = DependencyGraph()
- # key : ([Atom], [GLuePkg], [GluePkg])
+ # key : ([GLuePkg], [GluePkg], [Atom])
self.pkgrec = {}
+ self.unresolved = []
def add_package(self, pkg):
- self.pkgrec[pkg.key][0].append(pkg)
self.graph.add_node(pkg.key)
+ if not self.pkgrec.has_key(pkg.key):
+ self.pkgrec[pkg.key] = ([], [], [])
+ if self.pkgrec[pkg.key][0] or self.pkgrec[pkg.key][2]:
+ self.pkgrec[pkg.key][1].append(pkg)
+ self._validate(pkg.key)
+ else:
+ self.pkgrec[pkg.key][0].append(pkg)
+
+ def _validate(self, key):
+ pkgs = self[pkg.key]
diff --git a/pym/portage_syntax.py b/pym/portage_syntax.py
index a6bb27b..ee31f40 100644
--- a/pym/portage_syntax.py
+++ b/pym/portage_syntax.py
@@ -607,6 +607,14 @@ class DependSpec:
self.compact()
+ def remove_preferentials(self):
+ if self.preferential and self.elements:
+ self.elements = [self.elements[0]]
+ for element in self.elements:
+ if isinstance(element, DependSpec):
+ element.remove_preferentials()
+ self.compact()
+
def add_element(self, element):
if isinstance(element, self.element_class) or (isinstance(element, DependSpec) and element.element_class is self.element_class):
self.elements.append(element)