replacement.
"""
graph_db = self._graph_trees[root]["porttree"].dbapi
- matches = graph_db.match(atom)
+ matches = graph_db.match_pkgs(atom)
if not matches:
return None, None
- cpv = matches[-1] # highest match
- slot_atom = "%s:%s" % (portage.cpv_getkey(cpv),
- graph_db.aux_get(cpv, ["SLOT"])[0])
- e_pkg = self._slot_pkg_map[root].get(slot_atom)
- if e_pkg:
- return e_pkg, e_pkg
- # Since this cpv exists in the graph_db,
- # we must have a cached Package instance.
- cache_key = ("installed", root, cpv, "nomerge")
- return (self._pkg_cache[cache_key], None)
+ pkg = matches[-1] # highest match
+ in_graph = self._slot_pkg_map[root].get(pkg.slot_atom)
+ return pkg, in_graph
def _complete_graph(self):
"""
args.append(AtomArg(arg=x, atom=x,
root_config=root_config))
- # Create the "args" package set from atoms and
- # packages given as arguments.
- args_set = self._sets["args"]
- for arg in args:
- if not isinstance(arg, (AtomArg, PackageArg)):
- continue
- myatom = arg.atom
- if myatom in args_set:
- continue
- args_set.add(myatom)
- self._set_atoms.update(chain(*self._sets.itervalues()))
- atom_arg_map = self._atom_arg_map
- for arg in args:
- for atom in arg.set:
- atom_key = (atom, arg.root_config.root)
- refs = atom_arg_map.get(atom_key)
- if refs is None:
- refs = []
- atom_arg_map[atom_key] = refs
- if arg not in refs:
- refs.append(arg)
+ self._set_args(args)
return args
class UnsatisfiedResumeDep(portage.exception.PortageException):
spawn_kwargs = {}
spawn_kwargs["env"] = settings.environ()
- if portage.data.secpass >= 2 and \
+ if 'usersync' in settings.features and \
+ portage.data.secpass >= 2 and \
(st.st_uid != os.getuid() and st.st_mode & 0700 or \
st.st_gid != os.getgid() and st.st_mode & 0070):
try:
"""
_env_blacklist = [
- "A", "AA", "CATEGORY", "EBUILD_PHASE", "EMERGE_FROM",
- "PF", "PKGUSE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
- "PORTAGE_REPO_NAME", "PORTAGE_USE", "ROOT", "EPREFIX", "EROOT"
+ "A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI",
+ "EBUILD_PHASE", "EMERGE_FROM", "HOMEPAGE", "INHERITED", "IUSE",
+ "KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE",
+ "PORTAGE_CONFIGROOT", "PORTAGE_IUSE", "PORTAGE_REPO_NAME",
+ "PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT",
+ "ROOT", "SLOT", "SRC_URI", "EPREFIX", "EROOT"
]
_environ_whitelist = []
else:
check_config_instance(mysettings)
env=mysettings.environ()
- keywords["opt_name"]="[%s]" % mysettings["PF"]
+ if mysettings.mycpv is not None:
+ keywords["opt_name"] = "[%s]" % mysettings.mycpv
+ else:
+ keywords["opt_name"] = "[%s/%s]" % \
+ (mysettings.get("CATEGORY",""), mysettings.get("PF",""))
fd_pipes = keywords.get("fd_pipes")
if fd_pipes is None:
if not can_fetch:
if fetched != 2:
- if fetched == 0:
+ try:
+ mysize = os.stat(myfile_path).st_size
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ del e
+ mysize = 0
+
+ if mysize == 0:
writemsg("!!! File %s isn't fetched but unable to get it.\n" % myfile,
noiselevel=-1)
- else:
+ elif size is None or size > mysize:
writemsg("!!! File %s isn't fully fetched, but unable to complete it\n" % myfile,
noiselevel=-1)
+ else:
+ writemsg(("!!! File %s is incorrect size, " + \
+ "but unable to retry.\n") % myfile, noiselevel=-1)
for var_name in ("FETCHCOMMAND", "RESUMECOMMAND"):
if not mysettings.get(var_name, None):
writemsg(("!!! %s is unset. It should " + \
for myfile in distfiles_map:
myhashes = dist_hashes.get(myfile)
if not myhashes:
- missing_files.append(myfile)
+ try:
+ st = os.stat(os.path.join(mysettings["DISTDIR"], myfile))
+ except OSError:
+ st = None
+ if st is None or st.st_size == 0:
+ missing_files.append(myfile)
continue
size = myhashes.get("size")
fetch_settings = config(clone=mysettings)
debug = mysettings.get("PORTAGE_DEBUG") == "1"
for myfile in missing_files:
- success = False
+ uris = set()
for cpv in distfiles_map[myfile]:
myebuild = os.path.join(mysettings["O"],
catsplit(cpv)[1] + ".ebuild")
doebuild_environment(myebuild, "fetch",
mysettings["ROOT"], fetch_settings,
debug, 1, myportdb)
- uri_map = myportdb.getFetchMap(cpv, mytree=mytree)
- myuris = {myfile:uri_map[myfile]}
- fetch_settings["A"] = myfile # for use by pkg_nofetch()
- if fetch(myuris, fetch_settings):
- success = True
- break
- if not success:
- writemsg(("!!! File %s doesn't exist, can't update " + \
+ uris.update(myportdb.getFetchMap(
+ cpv, mytree=mytree)[myfile])
+
+ fetch_settings["A"] = myfile # for use by pkg_nofetch()
+
+ try:
+ st = os.stat(os.path.join(
+ mysettings["DISTDIR"],myfile))
+ except OSError:
+ st = None
+
+ if not fetch({myfile : uris}, fetch_settings):
+ writemsg(("!!! Fetch failed for %s, can't update " + \
"Manifest\n") % myfile, noiselevel=-1)
+ if myfile in dist_hashes and \
+ st is not None and st.st_size > 0:
+ # stat result is obtained before calling fetch(),
+ # since fetch may rename the existing file if the
+ # digest does not match.
+ writemsg("!!! If you would like to " + \
+ "forcefully replace the existing " + \
+ "Manifest entry\n!!! for %s, use the " % \
+ myfile + "following command:\n" + \
+ "!!! " + colorize("INFORM",
+ "ebuild --force %s manifest" % \
+ os.path.basename(myebuild)) + "\n",
+ noiselevel=-1)
return 0
writemsg_stdout(">>> Creating Manifest for %s\n" % mysettings["O"])
try:
# for new-style virtuals. Repoman should enforce this.
dep_keys = ["RDEPEND", "DEPEND", "PDEPEND"]
portdb = trees[myroot]["porttree"].dbapi
- repoman = isinstance(mydbapi, portdbapi)
+ repoman = not mysettings.local_config
if kwargs["use_binaries"]:
portdb = trees[myroot]["bintree"].dbapi
myvirtuals = mysettings.getvirtuals()
newsplit.append(x)
continue
if not pkgs and len(mychoices) == 1:
- newsplit.append(x.replace(mykey, mychoices[0]))
+ newsplit.append(portage.dep.Atom(x.replace(mykey, mychoices[0])))
continue
if isblocker:
a = []
cpv, pv_split, db = y
depstring = " ".join(db.aux_get(cpv, dep_keys))
pkg_kwargs = kwargs.copy()
- if isinstance(db, portdbapi):
- # for repoman
+ if repoman:
pass
else:
# for emerge
if len(virtual_atoms) == 1:
# It wouldn't make sense to block all the components of a
# compound virtual, so only a single atom block is allowed.
- a.append("!" + virtual_atoms[0])
+ a.append(portage.dep.Atom("!" + virtual_atoms[0]))
else:
- mycheck[1].append("="+y[0]) # pull in the new-style virtual
+ # pull in the new-style virtual
+ mycheck[1].append(portage.dep.Atom("="+y[0]))
a.append(mycheck[1])
# Plain old-style virtuals. New-style virtuals are preferred.
for y in mychoices:
- a.append(x.replace(mykey, y))
+ a.append(portage.dep.Atom(x.replace(mykey, y, 1)))
if isblocker and not a:
# Probably a compound virtual. Pass the atom through unprocessed.
newsplit.append(x)