if self.target_root != "/":
self.pkgsettings["/"] = \
portage.config(clone=trees["/"]["vartree"].settings)
+ self.curval = 0
def merge(self, mylist, favorites, mtimedb):
failed_fetches = []
print "!!! Fetch for",y,"failed, continuing..."
print
failed_fetches.append(pkg_key)
+ self.curval += 1
continue
portage.doebuild_environment(y, "setup", myroot,
if "--fetchonly" in self.myopts or \
"--fetch-all-uri" in self.myopts:
+ self.curval += 1
continue
short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Merge Binary"
# in the event that portage is not allowed to exit normally
# due to power failure, SIGKILL, etc...
mtimedb.commit()
+ self.curval += 1
if "--pretend" not in self.myopts:
emergelog(xterm_titles, " *** Finished. Cleaning up...")
myopts, myaction, myfiles, spinner):
ldpath_mtimes = mtimedb["ldpath"]
favorites=[]
+ merge_count = 0
+ pretend = "--pretend" in myopts
+ fetchonly = "--fetchonly" in myopts or "--fetch-all-uri" in myopts
+ if pretend or fetchonly:
+ # make the mtimedb readonly
+ mtimedb.filename = None
if "--quiet" not in myopts and \
("--pretend" in myopts or "--ask" in myopts or \
"--tree" in myopts or "--verbose" in myopts):
del mydepgraph
retval = mergetask.merge(
mtimedb["resume"]["mergelist"], favorites, mtimedb)
- if retval != os.EX_OK:
- return retval
+ merge_count = mergetask.curval
else:
if "resume" in mtimedb and \
"mergelist" in mtimedb["resume"] and \
del mydepgraph
mergetask = MergeTask(settings, trees, myopts)
retval = mergetask.merge(pkglist, favorites, mtimedb)
- if retval != os.EX_OK:
- return retval
+ merge_count = mergetask.curval
+
+ if retval == os.EX_OK and not (pretend or fetchonly):
+ mtimedb.pop("resume", None)
+ if "yes" == settings.get("AUTOCLEAN"):
+ portage.writemsg_stdout(">>> Auto-cleaning packages...\n")
+ vartree = trees[settings["ROOT"]]["vartree"]
+ unmerge(settings, myopts, vartree, "clean", ["world"],
+ ldpath_mtimes, autoclean=1)
+ else:
+ portage.writemsg_stdout(colorize("WARN", "WARNING:")
+ + " AUTOCLEAN is disabled. This can cause serious"
+ + " problems due to overlapping packages.\n")
- if mtimedb.has_key("resume"):
- del mtimedb["resume"]
- if settings["AUTOCLEAN"] and "yes"==settings["AUTOCLEAN"]:
- portage.writemsg_stdout(">>> Auto-cleaning packages...\n")
- vartree = trees[settings["ROOT"]]["vartree"]
- unmerge(settings, myopts, vartree, "clean", ["world"],
- ldpath_mtimes, autoclean=1)
- else:
- portage.writemsg_stdout(colorize("WARN", "WARNING:")
- + " AUTOCLEAN is disabled. This can cause serious"
- + " problems due to overlapping packages.\n")
+ if merge_count and not (pretend or fetchonly):
+ post_emerge(settings, mtimedb, retval)
+ return retval
def multiple_actions(action1, action2):
sys.stderr.write("\n!!! Multiple actions requested... Please choose one only.\n")
validate_ebuild_environment(trees)
retval = action_build(settings, trees, mtimedb,
myopts, myaction, myfiles, spinner)
- if "--pretend" not in myopts:
- post_emerge(settings, mtimedb, retval)
return retval
if __name__ == "__main__":