emerge. The cache is invalidated whenever it is detected that something
has changed that might alter the results of dep_check() calls:
1) the set of installed packages (including COUNTER) has changed
- 2) the old-style virtuals have changed
"""
# Number of uncached packages to trigger cache update, since
def __init__(self, myroot, vardb):
self._vardb = vardb
- self._virtuals = vardb.settings.getvirtuals()
self._cache_filename = os.path.join(myroot,
portage.CACHE_PATH, "vdb_blockers.pickle")
self._cache_version = "1"
if not cache_valid:
self._cache_data = {"version":self._cache_version}
self._cache_data["blockers"] = {}
- self._cache_data["virtuals"] = self._virtuals
self._modified.clear()
def flush(self):
{
version : "1",
"blockers" : {cpv1:(counter,(atom1, atom2...)), cpv2...},
- "virtuals" : vardb.settings.getvirtuals()
}
"""
if len(self._modified) >= self._cache_threshold and \
deps = []
for cat in categories:
- deps.append(insert_category_into_atom(
- atom_without_category, cat))
+ deps.append(Atom(insert_category_into_atom(
+ atom_without_category, cat)))
return deps
def _have_new_virt(self, root, atom_cp):
# 2) It takes away freedom from the resolver to choose other
# possible expansions when necessary.
if "/" in x:
- args.append(AtomArg(arg=x, atom=x,
+ args.append(AtomArg(arg=x, atom=Atom(x),
root_config=root_config))
continue
expanded_atoms = self._dep_expand(root_config, x)
installed_cp_set = set()
for atom in expanded_atoms:
- atom_cp = portage.dep_getkey(atom)
- if vardb.cp_list(atom_cp):
- installed_cp_set.add(atom_cp)
+ if vardb.cp_list(atom.cp):
+ installed_cp_set.add(atom.cp)
if len(installed_cp_set) > 1:
non_virtual_cps = set()
if len(expanded_atoms) > 1 and len(installed_cp_set) == 1:
installed_cp = iter(installed_cp_set).next()
expanded_atoms = [atom for atom in expanded_atoms \
- if portage.dep_getkey(atom) == installed_cp]
+ if atom.cp == installed_cp]
if len(expanded_atoms) > 1:
print()
if expanded_atoms:
atom = expanded_atoms[0]
else:
- null_atom = insert_category_into_atom(x, "null")
- null_cp = portage.dep_getkey(null_atom)
- cat, atom_pn = portage.catsplit(null_cp)
+ null_atom = Atom(insert_category_into_atom(x, "null"))
+ cat, atom_pn = portage.catsplit(null_atom.cp)
virts_p = root_config.settings.get_virts_p().get(atom_pn)
if virts_p:
# Allow the depgraph to choose which virtual.
- atom = insert_category_into_atom(x, "virtual")
+ atom = Atom(null_atom.replace('null/', 'virtual/', 1))
else:
- atom = insert_category_into_atom(x, "null")
+ null_atom
args.append(AtomArg(arg=x, atom=atom,
root_config=root_config))
if not slot:
# portage now masks packages with missing slot, but it's
# possible that one was installed by an older version
- atom = portage.cpv_getkey(cpv)
+ atom = Atom(portage.cpv_getkey(cpv))
else:
- atom = "%s:%s" % (portage.cpv_getkey(cpv), slot)
+ atom = Atom("%s:%s" % (portage.cpv_getkey(cpv), slot))
args.append(AtomArg(arg=atom, atom=atom,
root_config=root_config))
return selected_atoms
def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None):
- atom = portage.dep.Atom(atom)
atom_set = InternalPackageSet(initial_atoms=(atom,))
xinfo = '"%s"' % atom
if arg:
args.append(SetArg(arg=x, set=expanded_set,
root_config=root_config))
else:
- if not portage.isvalidatom(x):
+ try:
+ x = Atom(x)
+ except portage.exception.InvalidAtom:
continue
args.append(AtomArg(arg=x, atom=x,
root_config=root_config))
if expanded_atoms:
atom = expanded_atoms[0]
else:
- null_atom = insert_category_into_atom(atom, "null")
- null_cp = portage.dep_getkey(null_atom)
- cat, atom_pn = portage.catsplit(null_cp)
+ null_atom = Atom(insert_category_into_atom(atom, "null"))
+ cat, atom_pn = portage.catsplit(null_atom.cp)
virts_p = root_config.settings.get_virts_p().get(atom_pn)
if virts_p:
# Allow the resolver to choose which virtual.
- atom = insert_category_into_atom(atom, "virtual")
+ atom = Atom(null_atom.replace('null/', 'virtual/', 1))
else:
- atom = insert_category_into_atom(atom, "null")
+ atom = null_atom
return atom
def aux_get(self, cpv, wants):
try:
try:
from http.client import HTTPConnection as http_client_HTTPConnection
- from http.client import HTTPSConnection as http_client_HTTPConnection
- from http.client import BadStatusLine as http_client_HTTPConnection
- from http.client import ResponseNotReady as http_client_HTTPConnection
+ from http.client import HTTPSConnection as http_client_HTTPSConnection
+ from http.client import BadStatusLine as http_client_BadStatusLine
+ from http.client import ResponseNotReady as http_client_ResponseNotReady
except ImportError:
from httplib import HTTPConnection as http_client_HTTPConnection
- from httplib import HTTPSConnection as http_client_HTTPConnection
- from httplib import BadStatusLine as http_client_HTTPConnection
- from httplib import ResponseNotReady as http_client_HTTPConnection
+ from httplib import HTTPSConnection as http_client_HTTPSConnection
+ from httplib import BadStatusLine as http_client_BadStatusLine
+ from httplib import ResponseNotReady as http_client_ResponseNotReady
except ImportError as e:
sys.stderr.write(colorize("BAD","!!! CANNOT IMPORT HTTP.CLIENT: ")+str(e)+"\n")