self.pkg_node_map[mybigkey[2]] = jbigkey
self.digraph.addnode(jbigkey, myparent,
priority=priority)
-
+
+ if addme:
+ myslot = mydbapi.aux_get(mykey, ["SLOT"])[0]
+ self.mydbapi[myroot].cpv_inject(mykey, myslot=myslot)
+
""" This section determines whether we go deeper into dependencies or not.
We want to go deeper on a few occasions:
Installing package A, we need to make sure package A's deps are met.
bindb = self.trees[myroot]["bintree"].dbapi
pkgsettings = self.pkgsettings[myroot]
arg_atoms = []
+ def visible(mylist):
+ return portdb.gvisible(portdb.visible(mylist))
for x in myfiles:
ext = os.path.splitext(x)[1]
if ext==".tbz2":
myslots = set()
for cpv in vardb.match(myatom):
myslots.add(vardb.aux_get(cpv, ["SLOT"])[0])
+ if myslots:
+ best_pkgs = []
+ if "--usepkg" in self.myopts:
+ mymatches = bindb.match(myatom)
+ if "--usepkgonly" not in self.myopts:
+ mymatches = visible(mymatches)
+ best_pkg = portage.best(mymatches)
+ if best_pkg:
+ best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
+ best_pkgs.append(("binary", best_pkg, best_slot))
+ if "--usepkgonly" not in self.myopts:
+ best_pkg = portage.best(portdb.match(myatom))
+ if best_pkg:
+ best_slot = portdb.aux_get(best_pkg, ["SLOT"])[0]
+ best_pkgs.append(("ebuild", best_pkg, best_slot))
+ if best_pkgs:
+ best_pkg = portage.best([x[1] for x in best_pkgs])
+ best_pkgs = [x for x in best_pkgs if x[1] == best_pkg]
+ best_slot = best_pkgs[0][2]
+ myslots.add(best_slot)
if len(myslots) > 1:
for myslot in myslots:
myslot_atom = "%s:%s" % \
self.trees[self.target_root][
"porttree"].dbapi.match(myslot_atom):
available = True
- elif "--usepkg" in self.myopts and \
- self.trees[self.target_root][
- "bintree"].dbapi.match(myslot_atom):
- available = True
+ elif "--usepkg" in self.myopts:
+ mymatches = bindb.match(myslot_atom)
+ if "--usepkgonly" not in self.myopts:
+ mymatches = visible(mymatches)
+ if mymatches:
+ available = True
if available:
greedy_atoms.append((myarg, myslot_atom))
arg_atoms = greedy_atoms
mymerge = mycheck[1]
if myparent:
- # In order to get past circular dependencies (in
- # `emerge -e world`, for example), the parent must be allowed
- # to satisfy dependencies of it's children.
-
# The parent is added after it's own dep_check call so that it
# isn't allowed to satisfy a direct bootstrap dependency on itself
- # or an old-style virtual that it satisfies (unfortunately, this
- # only works for one level of deps, so it won't work for new-style
- # virtuals since they introduce an additional level of dependency
- # indirection).
+ # via an old-style virtual. This isn't a problem with new-style
+ # virtuals, which are preferenced in dep_zapdeps by looking only at
+ # the depstring, vdb, and available packages.
p_type, p_root, p_key, p_status = myparent.split()
if p_status == "merge":
- """ This fakedbapi data is used in dep_check calls to determine
- satisfied deps via dep_wordreduce"""
- myslot = self.trees[p_root][
- self.pkg_tree_map[p_type]].dbapi.aux_get(
- p_key, ["SLOT"])[0]
- self.mydbapi[p_root].cpv_inject(p_key, myslot=myslot)
-
# Update old-style virtuals if this package provides any.
# These are needed for dep_virtual calls inside dep_check.
self.pkgsettings[p_root].setinst(p_key,
correct merge order such that mutually blocking packages are never
installed simultaneously."""
- """ It's possible that some of the nodes haven't been added to the
- fakedb yet, so make sure they're all accounted for."""
- for node in self.digraph.all_nodes():
- node_split = node.split()
- mytype, myroot, mykey = node_split[0:3]
- if mytype in self.pkg_tree_map:
- if node_split[3] == "nomerge":
- continue
- mydb = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi
- myslot = mydb.aux_get(mykey, ["SLOT"])[0]
- self.mydbapi[myroot].cpv_inject(mykey, myslot=myslot)
-
for blocker in self.blocker_parents.keys():
mytype, myroot, mydep = blocker.split()
vardb = self.trees[myroot]["vartree"].dbapi
def xcreate(self,mode="system"):
vardb = self.trees[self.target_root]["vartree"].dbapi
+ portdb = self.trees[self.target_root]["porttree"].dbapi
+ bindb = self.trees[self.target_root]["bintree"].dbapi
+ def visible(mylist):
+ return portdb.gvisible(portdb.visible(mylist))
world_problems = False
if mode=="system":
mylist = getlist(self.settings, "system")
myslots = set()
for cpv in vardb.match(mykey):
myslots.add(vardb.aux_get(cpv, ["SLOT"])[0])
+ if myslots:
+ best_pkgs = []
+ if "--usepkg" in self.myopts:
+ mymatches = bindb.match(atom)
+ if "--usepkgonly" not in self.myopts:
+ mymatches = visible(mymatches)
+ best_pkg = portage.best(mymatches)
+ if best_pkg:
+ best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
+ best_pkgs.append(("binary", best_pkg, best_slot))
+ if "--usepkgonly" not in self.myopts:
+ best_pkg = portage.best(portdb.match(atom))
+ if best_pkg:
+ best_slot = portdb.aux_get(best_pkg, ["SLOT"])[0]
+ best_pkgs.append(("ebuild", best_pkg, best_slot))
+ if best_pkgs:
+ best_pkg = portage.best([x[1] for x in best_pkgs])
+ best_pkgs = [x for x in best_pkgs if x[1] == best_pkg]
+ best_slot = best_pkgs[0][2]
+ myslots.add(best_slot)
if len(myslots) > 1:
for myslot in myslots:
myslot_atom = "%s:%s" % (mykey, myslot)
self.trees[self.target_root][
"porttree"].dbapi.match(myslot_atom):
available = True
- elif "--usepkg" in self.myopts and \
- self.trees[self.target_root][
- "bintree"].dbapi.match(myslot_atom):
- available = True
+ elif "--usepkg" in self.myopts:
+ mymatches = bindb.match(myslot_atom)
+ if "--usepkgonly" not in self.myopts:
+ mymatches = visible(mymatches)
+ if mymatches:
+ available = True
if available:
newlist.append(myslot_atom)
mylist = newlist
tmp = re.sub(esc_seq + "^m]+m", "", mystr);
return len(tmp)
-def xtermTitle(mystr):
+def xtermTitle(mystr, raw=False):
if havecolor and dotitles and os.environ.has_key("TERM") and sys.stderr.isatty():
myt=os.environ["TERM"]
legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"]
for term in legal_terms:
if myt.startswith(term):
- sys.stderr.write("\x1b]0;"+str(mystr)+"\x07")
+ if not raw:
+ mystr = "\x1b]0;%s\x07" % mystr
+ sys.stderr.write(mystr)
sys.stderr.flush()
break
global default_xterm_title
if default_xterm_title is None:
prompt_command = os.getenv('PROMPT_COMMAND')
- if prompt_command is not None:
+ if prompt_command == "":
+ default_xterm_title = ""
+ elif prompt_command is not None:
default_xterm_title = commands.getoutput(prompt_command)
else:
pwd = os.getenv('PWD','')
home = os.getenv('HOME', '')
if home != '' and pwd.startswith(home):
pwd = '~' + pwd[len(home):]
- default_xterm_title = '%s@%s:%s' % (
+ default_xterm_title = '\x1b]0;%s@%s:%s\x07' % (
os.getenv('LOGNAME', ''), os.getenv('HOSTNAME', '').split('.', 1)[0], pwd)
- xtermTitle(default_xterm_title)
+ xtermTitle(default_xterm_title, raw=True)
def notitles():
"turn off title setting"