return retval
def _execute(self):
- build_dir = EbuildBuildDir(pkg=self.pkg, settings=self.settings)
- build_dir.lock()
- build_dir.clean()
+ settings = self.settings
+ pkg = self.pkg
+ root_config = pkg.root_config
+ portdb = root_config.trees["porttree"].dbapi
+ ebuild_path = portdb.findname(pkg.cpv)
+ settings.setcpv(pkg)
+ debug = settings.get("PORTAGE_DEBUG") == "1"
+ use_cache = 1 # always true
+ portage.doebuild_environment(ebuild_path, "fetch",
+ root_config.root, settings, debug, use_cache, portdb)
portage.prepare_build_dirs(self.pkg.root, self.settings, 0)
- portdb = self.pkg.root_config.trees["porttree"].dbapi
- ebuild_path = portdb.findname(self.pkg.cpv)
- debug = self.settings.get("PORTAGE_DEBUG") == "1"
retval = portage.doebuild(ebuild_path, "fetch",
self.settings["ROOT"], self.settings, debug=debug,
mydbapi=portdb, tree="porttree")
portage.elog.elog_process(self.pkg.cpv, self.settings)
- build_dir.clean()
- build_dir.unlock()
return retval
class AsynchronousTask(SlotObject):
xinfo='"%s"' % arg
# Discard null/ from failed cpv_expand category expansion.
xinfo = xinfo.replace("null/", "")
- if myparent:
- xfrom = '(dependency required by '+ \
- green('"%s"' % myparent[2]) + \
- red(' [%s]' % myparent[0]) + ')'
masked_packages = []
missing_use = []
missing_licenses = []
show_mask_docs()
else:
print "\nemerge: there are no ebuilds to satisfy "+green(xinfo)+"."
- if myparent:
- print xfrom
+
+ # Show parent nodes and the argument that pulled them in.
+ node = myparent
+ msg = []
+ while node is not None:
+ msg.append('(dependency required by "%s" [%s])' % \
+ (colorize('INFORM', str(node.cpv)), node.type_name))
+ parent = None
+ for parent in self.digraph.parent_nodes(node):
+ if isinstance(parent, DependencyArg):
+ msg.append('(dependency required by "%s" [argument])' % \
+ (colorize('INFORM', str(parent))))
+ parent = None
+ break
+ node = parent
+ for line in msg:
+ print line
+
print
def _select_pkg_highest_available(self, root, atom, onlydeps=False):
not self._opts_no_restart.intersection(self.myopts) and \
pkg.root == self._running_root.root and \
portage.match_from_list(
- portage.const.PORTAGE_PACKAGE_ATOM, [pkg]):
-
- pn, ver, rev = pkg.pv_split
- if rev == "r0":
- myversion = ver
- else:
- myversion = "%s-%s" % (ver, rev)
-
- if myversion != portage.VERSION and "--quiet" not in self.myopts:
+ portage.const.PORTAGE_PACKAGE_ATOM, [pkg]) and \
+ not vardb.cpv_exists(pkg.cpv) and \
+ "--quiet" not in self.myopts:
if mylist_index < len(mylist) - 1:
p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,"))
p.append(colorize("WARN", " then resume the merge."))
d["porttree"].dbapi._aux_cache.clear()
d["bintree"].dbapi._aux_cache.clear()
d["bintree"].dbapi._clear_cache()
+ d["vartree"].dbapi.linkmap._clear_cache()
portage.dircache.clear()
gc.collect()
from portage.elog import elog_process
from portage.elog.filtering import filter_mergephases, filter_unmergephases
-import os, re, stat, errno, copy, subprocess
+import os, re, shutil, stat, errno, copy, subprocess
import logging
import shlex
from itertools import izip
self._root = self._dbapi.root
self._libs = {}
self._obj_properties = {}
- self._defpath = set(getlibpaths(self._root))
self._obj_key_cache = {}
+ self._defpath = set()
+ self._path_key_cache = {}
+
+ def _clear_cache(self):
+ self._libs.clear()
+ self._obj_properties.clear()
+ self._obj_key_cache.clear()
+ self._defpath.clear()
+ self._path_key_cache.clear()
+
+ def _path_key(self, path):
+ key = self._path_key_cache.get(path)
+ if key is None:
+ key = self._ObjectKey(path, self._root)
+ self._path_key_cache[path] = key
+ return key
class _ObjectKey(object):
def rebuild(self, exclude_pkgs=None, include_file=None):
root = self._root
- self._defpath = set(getlibpaths(root))
- libs = {}
- obj_key_cache = {}
- obj_properties = {}
+ self._clear_cache()
+ self._defpath.update(getlibpaths(self._root))
+ libs = self._libs
+ obj_key_cache = self._obj_key_cache
+ obj_properties = self._obj_properties
+
lines = []
for cpv in self._dbapi.cpv_all():
if exclude_pkgs is not None and cpv in exclude_pkgs:
obj = fields[1]
obj_key = self._ObjectKey(obj, root)
soname = fields[2]
- path = set([
- normalize_path(os.path.join(self._root, x.lstrip(os.path.sep)))
+ path = set([normalize_path(x) \
for x in filter(None, fields[3].replace(
"${ORIGIN}", os.path.dirname(obj)).replace(
"$ORIGIN", os.path.dirname(obj)).split(":"))])
obj_properties.setdefault(obj_key, \
(arch, needed, path, soname, set()))[4].add(obj)
- self._libs = libs
- self._obj_properties = obj_properties
- self._obj_key_cache = obj_key_cache
-
def listBrokenBinaries(self, debug=False):
"""
Find binaries and their needed sonames, which have no providers.
raise KeyError("%s (%s) not in object list" % (obj_key, obj))
arch, needed, path, _, _ = self._obj_properties[obj_key]
- path = path.union(self._defpath)
+ path_keys = set(self._path_key(x) for x in path.union(self._defpath))
for soname in needed:
rValue[soname] = set()
if soname not in self._libs or arch not in self._libs[soname]:
for provider_key in self._libs[soname][arch]["providers"]:
providers = self._obj_properties[provider_key][4]
for provider in providers:
- if os.path.join(self._root,
- os.path.dirname(provider).lstrip(os.path.sep)) in path:
+ if self._path_key(os.path.dirname(provider)) in path_keys:
rValue[soname].add(provider)
return rValue
if obj_key not in self._obj_properties:
raise KeyError("%s (%s) not in object list" % (obj_key, obj))
- # Determine the directory(ies) from the set of objects.
- objs_dirs = set(os.path.join(self._root,
- os.path.dirname(x).lstrip(os.sep)) for x in objs)
-
# If there is another version of this lib with the
# same soname and the master link points to that
# other version, this lib will be shadowed and won't
(master_st.st_dev, master_st.st_ino):
return set()
+ # Determine the directory(ies) from the set of objects.
+ objs_dir_keys = set(self._path_key(os.path.dirname(x)) for x in objs)
+ defpath_keys = set(self._path_key(x) for x in self._defpath)
+
arch, _, _, soname, _ = self._obj_properties[obj_key]
if soname in self._libs and arch in self._libs[soname]:
# For each potential consumer, add it to rValue if an object from the
for consumer_key in self._libs[soname][arch]["consumers"]:
_, _, path, _, consumer_objs = \
self._obj_properties[consumer_key]
- path = path.union(self._defpath)
- if objs_dirs.intersection(path):
+ path_keys = defpath_keys.union(self._path_key(x) for x in path)
+ if objs_dir_keys.intersection(path_keys):
rValue.update(consumer_objs)
return rValue
writemsg("portage.dblink.delete(): invalid dbdir: %s\n" % \
self.dbdir, noiselevel=-1)
return
- import shutil
+
shutil.rmtree(self.dbdir)
self.vartree.dbapi._remove(self)
del mylibs, mycontents, old_contents, liblist
# inject files that should be preserved into our image dir
- import shutil
preserve_paths = []
candidates_stack = list(candidates)
while candidates_stack:
if self.vartree.dbapi._categories is not None:
self.vartree.dbapi._categories = None
if self.myroot == "/" and \
- match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]):
+ match_from_list(PORTAGE_PACKAGE_ATOM, [self.mycpv]) and \
+ not self.vartree.dbapi.cpv_exists(self.mycpv):
settings = self.settings
base_path_orig = os.path.dirname(settings["PORTAGE_BIN_PATH"])
from tempfile import mkdtemp
- import shutil
+
# Make the temp directory inside PORTAGE_TMPDIR since, unlike
# /tmp, it can't be mounted with the "noexec" option.
base_path_tmp = mkdtemp("", "._portage_reinstall_.",
self._scheduler.dblinkEbuildPhase(
self, mydbapi, myebuild, "clean")
finally:
+ self.vartree.dbapi.linkmap._clear_cache()
self.unlockdb()
return retval
return " ".join(mydata)
def copyfile(self,fname):
- import shutil
shutil.copyfile(fname,self.dbdir+"/"+os.path.basename(fname))
def getfile(self,fname):