"use-rcs=yes in config; fatal', file=sys.stderr)
return False
+ merge_cmd = self.options.get("merge", "").split()
# config file freezing support
frozen_files = set(self.options.get("frozen-files", "").split())
merged = SCRATCH_DIR+"/"+os.path.basename(conf['current'])
print()
ret = os.system (self.options['merge'] % (merged, conf ['current'], newconf))
+ ret = os.WEXITSTATUS(ret)
+ if ret < 2:
+ ret = 0
if ret:
print("Failure running 'merge' command")
continue
world-candidate = False
files = %(ROOT)slib/modules
+# Binary packages that have a different build time from a currently
+# installed package of the exact same version.
+[rebuilt-binaries]
+class = portage.sets.dbapi.RebuiltBinaries
+world-candidate = False
+
# Installed packages for which the highest visible ebuild
# version is lower than the currently installed version.
[downgrade]
Redirect all build output to logs alone, and do not
display it on stdout.
.TP
+.BR "\-\-rebuilt\-binaries[=n]"
+Replace installed packages with binary packages that have
+been rebuilt. Rebuilds are detected by comparison of
+BUILD_TIME package metadata. This option is enabled
+automatically when using binary packages (see
+\fB\-\-usepkg\fR and \fB\-\-getbinpkg\fR).
+.TP
.BR "\-\-reinstall changed\-use"
Tells emerge to include installed packages where USE flags have
changed since installation. Unlike \fB\-\-newuse\fR, this option does
http://gcc.gnu.org/onlinedocs/gcc\-2.95.3/gcc_2.html
.TP
\fBCLEAN_DELAY\fR = \fIinteger\fR
-Determines how long the countdown delay will be after running `emerge clean`.
+Determines how long the countdown delay will be after running
+`emerge --unmerge`.
.br
Defaults to 5 seconds.
.TP
]["vartree"].dbapi._aux_cache_keys)
dbs.append((vardb, "installed", True, True, db_keys))
self._filtered_trees[myroot]["dbs"] = dbs
- if "--usepkg" in depgraph._frozen_config.myopts:
- depgraph._frozen_config._trees_orig[myroot
- ]["bintree"].populate(
- "--getbinpkg" in depgraph._frozen_config.myopts,
- "--getbinpkgonly" in depgraph._frozen_config.myopts)
class depgraph(object):
atom_set = InternalPackageSet(initial_atoms=(atom,))
existing_node = None
myeb = None
+ usepkg = "--usepkg" in self._frozen_config.myopts
+ rebuilt_binaries = usepkg and \
+ self._frozen_config.myopts.get('--rebuilt-binaries') != 'n'
usepkgonly = "--usepkgonly" in self._frozen_config.myopts
empty = "empty" in self._dynamic_config.myparams
selective = "selective" in self._dynamic_config.myparams
if pkg.cp == cp]
break
+ if existing_node is not None and \
+ existing_node in matched_packages:
+ return existing_node, existing_node
+
if len(matched_packages) > 1:
+ if rebuilt_binaries:
+ inst_pkg = None
+ built_pkg = None
+ for pkg in matched_packages:
+ if pkg.installed:
+ inst_pkg = pkg
+ elif pkg.built:
+ built_pkg = pkg
+ if built_pkg is not None and inst_pkg is not None:
+ if built_pkg >= inst_pkg and \
+ built_pkg.metadata['BUILD_TIME'] != \
+ inst_pkg.metadata['BUILD_TIME']:
+ return built_pkg, built_pkg
+
if avoid_update:
- if existing_node is not None:
- return existing_node, existing_node
for pkg in matched_packages:
if pkg.installed:
return pkg, existing_node
runtime_deps.update(atom for atom in atoms \
if not atom.blocker)
+ # Merge libc asap, in order to account for implicit
+ # dependencies. See bug #303567.
+ libc_pkg = self._dynamic_config.mydbapi[running_root].match_pkgs(
+ portage.const.LIBC_PACKAGE_ATOM)
+ if libc_pkg:
+ libc_pkg = libc_pkg[0]
+ if libc_pkg.operation == 'merge':
+ asap_nodes.append(libc_pkg)
+
def gather_deps(ignore_priority, mergeable_nodes,
selected_nodes, node):
"""
min_parent_deps = None
uninst_task = None
+
+ # FIXME: This loop can be extremely slow when
+ # there of lots of blockers to solve
+ # (especially the gather_deps part).
for task in myblocker_uninstalls.leaf_nodes():
# Do some sanity checks so that system or world packages
# don't get uninstalled inappropriately here (only really
# best possible choice, but the current algorithm
# is simple and should be near optimal for most
# common cases.
+ self._spinner_update()
mergeable_parent = False
parent_deps = set()
for parent in mygraph.parent_nodes(task):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
+ print(" "+green("--rebuilt-binaries") + "[=%s]" % turquoise("n"))
+ desc = "Replace installed packages with binary packages that have " + \
+ "been rebuilt. Rebuilds are detected by comparison of " + \
+ "BUILD_TIME package metadata. This option is enabled " + \
+ "automatically when using binary packages (see " + \
+ "--usepkg and --getbinpkg)."
+ for line in wrap(desc, desc_width):
+ print(desc_indent + line)
+ print()
print(" "+green("--reinstall ") + turquoise("changed-use"))
print(" Tells emerge to include installed packages where USE flags have")
print(" changed since installation. Unlike --newuse, this option does")
'--getbinpkgonly' : ('n',),
'--jobs' : valid_integers,
'--keep-going' : ('n',),
+ '--rebuilt-binaries' : ('n',),
'--root-deps' : ('rdeps',),
'--select' : ('n',),
'--selective' : ('n',),
"choices" : ("True", "n")
},
+ "--rebuilt-binaries": {
+ "help" : "replace installed packages with binary " + \
+ "packages that have been rebuilt",
+ "type" : "choice",
+ "choices" : ("True", "n")
+ },
+
"--root": {
"help" : "specify the target root filesystem for merging packages",
"action" : "store"
else:
myoptions.keep_going = None
+ if myoptions.rebuilt_binaries in ("True",):
+ # The depgraph will enable this by default unless 'n' is specified.
+ myoptions.rebuilt_binaries = None
+
if myoptions.root_deps == "True":
myoptions.root_deps = True
config_protect_check(trees)
check_procfs()
+ if "getbinpkg" in settings.features:
+ myopts["--getbinpkg"] = True
+
+ if "--getbinpkgonly" in myopts:
+ myopts["--getbinpkg"] = True
+
+ if "--getbinpkgonly" in myopts:
+ myopts["--usepkgonly"] = True
+
+ if "--getbinpkg" in myopts:
+ myopts["--usepkg"] = True
+
+ if "--usepkgonly" in myopts:
+ myopts["--usepkg"] = True
+
+ if "buildpkg" in settings.features or "--buildpkgonly" in myopts:
+ myopts["--buildpkg"] = True
+
+ if "--buildpkgonly" in myopts:
+ # --buildpkgonly will not merge anything, so
+ # it cancels all binary package options.
+ for opt in ("--getbinpkg", "--getbinpkgonly",
+ "--usepkg", "--usepkgonly"):
+ myopts.pop(opt, None)
+
for mytrees in trees.values():
mydb = mytrees["porttree"].dbapi
# Freeze the portdbapi for performance (memoize all xmatch results).
mydb.freeze()
+
+ if "--usepkg" in myopts:
+ # Populate the bintree with current --getbinpkg setting.
+ # This needs to happen before expand_set_arguments(), in case
+ # any sets use the bintree.
+ mytrees["bintree"].populate(
+ getbinpkgs="--getbinpkg" in myopts)
+
del mytrees, mydb
if "moo" in myfiles:
spinner.update = spinner.update_quiet
portage.util.noiselimit = -1
- # Always create packages if FEATURES=buildpkg
- # Imply --buildpkg if --buildpkgonly
- if ("buildpkg" in settings.features) or ("--buildpkgonly" in myopts):
- if "--buildpkg" not in myopts:
- myopts["--buildpkg"] = True
-
- # Always try and fetch binary packages if FEATURES=getbinpkg
- if ("getbinpkg" in settings.features):
- myopts["--getbinpkg"] = True
-
- if "--buildpkgonly" in myopts:
- # --buildpkgonly will not merge anything, so
- # it cancels all binary package options.
- for opt in ("--getbinpkg", "--getbinpkgonly",
- "--usepkg", "--usepkgonly"):
- myopts.pop(opt, None)
-
if "--fetch-all-uri" in myopts:
myopts["--fetchonly"] = True
if "--skipfirst" in myopts and "--resume" not in myopts:
myopts["--resume"] = True
- if ("--getbinpkgonly" in myopts) and not ("--usepkgonly" in myopts):
- myopts["--usepkgonly"] = True
-
- if ("--getbinpkgonly" in myopts) and not ("--getbinpkg" in myopts):
- myopts["--getbinpkg"] = True
-
- if ("--getbinpkg" in myopts) and not ("--usepkg" in myopts):
- myopts["--usepkg"] = True
-
- # Also allow -K to apply --usepkg/-k
- if ("--usepkgonly" in myopts) and not ("--usepkg" in myopts):
- myopts["--usepkg"] = True
-
# Allow -p to remove --ask
if "--pretend" in myopts:
myopts.pop("--ask", None)
REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
PORTAGE_PACKAGE_ATOM = "sys-apps/portage"
+LIBC_PACKAGE_ATOM = "virtual/libc"
INCREMENTALS = ("USE", "USE_EXPAND", "USE_EXPAND_HIDDEN",
"FEATURES", "ACCEPT_KEYWORDS",
"atoms to match all installed packages"
_filter = None
- def __init__(self, vdbapi):
+ def __init__(self, vdbapi, **kwargs):
super(EverythingSet, self).__init__()
self._db = vdbapi
return AgeSet(vardb=trees["vartree"].dbapi, mode=mode, age=age)
singleBuilder = classmethod(singleBuilder)
+
+class RebuiltBinaries(EverythingSet):
+ _operations = ('merge',)
+ _aux_keys = ('BUILD_TIME',)
+
+ def __init__(self, vardb, bindb=None):
+ super(RebuiltBinaries, self).__init__(vardb, bindb=bindb)
+ self._bindb = bindb
+
+ def _filter(self, atom):
+ cpv = self._db.match(atom)[0]
+ inst_build_time, = self._db.aux_get(cpv, self._aux_keys)
+ try:
+ bin_build_time, = self._bindb.aux_get(cpv, self._aux_keys)
+ except KeyError:
+ return False
+ return inst_build_time != bin_build_time
+
+ def singleBuilder(cls, options, settings, trees):
+ return RebuiltBinaries(trees["vartree"].dbapi,
+ bindb=trees["bintree"].dbapi)
+
+ singleBuilder = classmethod(singleBuilder)