* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2016-04-18 7:36 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2016-04-18 7:36 UTC (permalink / raw
To: gentoo-commits
commit: 61210cd17364416da121e0daab57082f79b0b68d
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 18 07:36:24 2016 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 07:36:24 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=61210cd1
sys-apps/portage: add non-applying prefix-chaining patch, bug #509136
Package-Manager: portage-2.2.28-prefix
sys-apps/portage/Manifest | 1 -
.../files/portage-2.2.14-prefix-chaining.patch | 873 +++++++++++++++++++++
sys-apps/portage/metadata.xml | 26 +-
sys-apps/portage/portage-2.2.20.ebuild | 583 --------------
sys-apps/portage/portage-2.2.28.ebuild | 2 +
5 files changed, 892 insertions(+), 593 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 6043692..ec3802d 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,3 +1,2 @@
-DIST prefix-portage-2.2.20.tar.bz2 1205876 SHA256 8c32e08af042384e7793a4580cbde892a66ec9ea2ad3bae739b2a9e476ac10cc SHA512 e219ca4b0dcfc6f6a4d221ebfb7e951f6676b739609e8f2d6651ac120d250797eb6fa8bde16ee0fd373403d09a7fd1c59b7e9de7b001da83300492d953ccd1a2 WHIRLPOOL 4ec1fca787e587097088009950165a1117e425365583e6f6952cabc2587bea8c7d8bb88ed8a038be41ffb33cba1a374e99d2e01707a5749449d4a246a43be1b4
DIST prefix-portage-2.2.27.tar.bz2 1230727 SHA256 51bf3f427b23dfd1d050a2071895b5134cf7f515eb00612e0f57adf645a38299 SHA512 bb528ee059c7fc06702882eaa9aad33962ad2eff7e468aa51a8b185e8b3e4ba3eaf88b2ee0f61df9c38493f0f37028e471ba2cc766fa53086ad6b975ead9b332 WHIRLPOOL b0601462462d6dd322ffd9e806c92fd425483fc769a8c6b36c5874a4a28e21e250386ce16479e238577754ab4b194ce700bca7a0407dca919d59fd6ada87970c
DIST prefix-portage-2.2.28.tar.bz2 1187416 SHA256 e4bb6c08a65252cfb3faf777ff9bb6aab162174766202f811154c0bbe301b45e SHA512 ea0661783d421d204272b9a210745aa2040a18ea347299b3d768588e10ca8dd2e24b46975249bf30010bf565514aea640f4edb9db2ca064312c899304a8c1f42 WHIRLPOOL d2d3feab14c4b0dc706db9336e08637897d963d0cbd7e1995431701c8c1914f6f42f57917470a2c89cdc8596d2ed8183c80f3814eba7512b5216611595da38a1
diff --git a/sys-apps/portage/files/portage-2.2.14-prefix-chaining.patch b/sys-apps/portage/files/portage-2.2.14-prefix-chaining.patch
new file mode 100644
index 0000000..5c38795
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.2.14-prefix-chaining.patch
@@ -0,0 +1,873 @@
+diff -ru prefix-portage-2.2.14.orig/bin/install-qa-check.d/05prefix prefix-portage-2.2.14/bin/install-qa-check.d/05prefix
+--- prefix-portage-2.2.14.orig/bin/install-qa-check.d/05prefix 2014-09-28 19:31:20.000000000 +0200
++++ prefix-portage-2.2.14/bin/install-qa-check.d/05prefix 2015-06-17 10:08:15.074682823 +0200
+@@ -79,16 +79,42 @@
+ # unprefixed shebang, is the script directly in $PATH or an init
+ # script?
+ if [[ ":${PATH}:${EPREFIX}/etc/init.d:" == *":${fp}:"* ]] ; then
+- if [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then
++ all_epfs="$PORTAGE_READONLY_EPREFIXES:$EPREFIX:$EROOT:$ED"
++ save_IFS=$IFS
++ IFS=:
++ epfs=( $all_epfs )
++ IFS=$save_IFS
++
++ found=
++ for x in "${epfs[@]}"; do
++ [[ -z "${x}" ]] && continue
++ check="${x}${line[0]}"
++
++ # might already contain a prefix
++ if [[ "${line[0]}" == "${x}"* ]]; then
++ check="${line[0]}"
++ fi
++
++ if [[ -e ${check} ]]; then
++ found="${check}"
++ fi
++ done
++
++ if [[ -n ${found} ]] ; then
+ # is it unprefixed, but we can just fix it because a
+ # prefixed variant exists
+ eqawarn "prefixing shebang of ${fn#${D}}"
++
++ if [[ ${found} == "${ED}"* || ${found} == "${EROOT}"* ]]; then
++ found="${EPREFIX}${line[0]}"
++ fi
++
+ # statement is made idempotent on purpose, because
+ # symlinks may point to the same target, and hence the
+ # same real file may be sedded multiple times since we
+ # read the shebangs in one go upfront for performance
+ # reasons
+- sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${EPREFIX}"${line[0]}':' "${rf}"
++ sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${found}"':' "${rf}"
+ continue
+ else
+ # this is definitely wrong: script in $PATH and invalid shebang
+diff -ru prefix-portage-2.2.14.orig/bin/phase-helpers.sh prefix-portage-2.2.14/bin/phase-helpers.sh
+--- prefix-portage-2.2.14.orig/bin/phase-helpers.sh 2014-09-28 19:12:31.000000000 +0200
++++ prefix-portage-2.2.14/bin/phase-helpers.sh 2015-06-17 10:24:28.997164214 +0200
+@@ -758,6 +758,10 @@
+ "${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" has_version "${eroot}" "${atom}"
+ fi
+ local retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ ${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq has_version '${READONLY_EPREFIX%:*}' '${atom}'"
++ retval=$?
++ fi
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+@@ -817,6 +821,10 @@
+ "${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" best_version "${eroot}" "${atom}"
+ fi
+ local retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ ${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq best_version '${READONLY_EPREFIX%:*}' '${atom}'"
++ retval=$?
++ fi
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+@@ -846,6 +854,10 @@
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" master_repositories "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq master_repositories '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -877,6 +889,10 @@
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" get_repo_path "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq repository_path '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -907,6 +923,10 @@
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" available_eclasses "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq available_eclasses '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -937,6 +957,10 @@
+ else
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}")
+ fi
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq eclass_path '${READONLY_EPREFIX%:*}' '${repository}' '${eclass}'")
++ retval=$?
++ fi
+ retval=$?
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+@@ -968,6 +992,10 @@
+ else
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" license_path "${EROOT}" "${repository}" "${license}")
+ fi
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${READONLY_EPREFIX%:*}'/usr/lib/portage/bin/portageq license_path '${READONLY_EPREFIX%:*}' '${repository}' '${license}'")
++ retval=$?
++ fi
+ retval=$?
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+Only in prefix-portage-2.2.14/bin: phase-helpers.sh.orig
+diff -ru prefix-portage-2.2.14.orig/pym/_emerge/actions.py prefix-portage-2.2.14/pym/_emerge/actions.py
+--- prefix-portage-2.2.14.orig/pym/_emerge/actions.py 2014-10-02 20:48:26.000000000 +0200
++++ prefix-portage-2.2.14/pym/_emerge/actions.py 2015-06-17 10:24:28.997164214 +0200
+@@ -38,7 +38,7 @@
+ from portage import shutil
+ from portage import eapi_is_supported, _encodings, _unicode_decode
+ from portage.cache.cache_errors import CacheError
+-from portage.const import EPREFIX
++from portage.const import EPREFIX, BPREFIX
+ from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFAULT
+ from portage.const import SUPPORTED_BINPKG_FORMATS, TIMESTAMP_FORMAT
+ from portage.dbapi.dep_expand import dep_expand
+@@ -62,6 +62,7 @@
+ from portage.util._async.run_main_scheduler import run_main_scheduler
+ from portage.util._async.SchedulerInterface import SchedulerInterface
+ from portage.util._eventloop.global_event_loop import global_event_loop
++from portage.util._path import exists_raise_eaccess
+ from portage._global_updates import _global_updates
+
+ from _emerge.clear_caches import clear_caches
+@@ -2629,7 +2630,8 @@
+ out.eerror(line)
+ return exitcode
+ elif repo.sync_type == "cvs":
+- if not os.path.exists(EPREFIX + "/usr/bin/cvs"):
++ cvs_bin = portage.process.find_binary("cvs")
++ if cvs_bin is None:
+ print("!!! %s/usr/bin/cvs does not exist, so CVS support is disabled." % (EPREFIX))
+ print("!!! Type \"emerge %s\" to enable CVS support." % portage.const.CVS_PACKAGE_ATOM)
+ return os.EX_UNAVAILABLE
+@@ -2697,6 +2699,13 @@
+ writemsg_level(" %s spawn failed of %s\n" % (bad("*"), postsync,),
+ level=logging.ERROR, noiselevel=-1)
+
++ postsync = os.path.join(BPREFIX, portage.USER_CONFIG_PATH, "bin", "post_sync")
++ if os.access(postsync, os.X_OK):
++ retval = portage.process.spawn([postsync, dosyncuri], env=settings.environ())
++ if retval != os.EX_OK:
++ writemsg_level(" %s spawn failed of %s\n" % (bad("*"), postsync,),
++ level=logging.ERROR, noiselevel=-1)
++
+ return os.EX_OK
+
+ def action_uninstall(settings, trees, ldpath_mtimes,
+@@ -3413,6 +3422,9 @@
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
+ portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
++ portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
+ msg.append(" This usually means that '%s'" % \
+ (os.path.join(global_config_path, "sets/portage.conf"),))
+ msg.append(" is missing or corrupt.")
+Only in prefix-portage-2.2.14/pym/_emerge: actions.py.orig
+diff -ru prefix-portage-2.2.14.orig/pym/_emerge/depgraph.py prefix-portage-2.2.14/pym/_emerge/depgraph.py
+--- prefix-portage-2.2.14.orig/pym/_emerge/depgraph.py 2014-11-12 18:26:12.000000000 +0100
++++ prefix-portage-2.2.14/pym/_emerge/depgraph.py 2015-06-17 10:19:41.254082296 +0200
+@@ -2743,23 +2743,24 @@
+ edepend["HDEPEND"] = ""
+
+ deps = (
+- (depend_root, edepend["DEPEND"],
++ (depend_root, "DEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_depend_deps),
+ ignored=ignore_depend_deps)),
+- (self._frozen_config._running_root.root, edepend["HDEPEND"],
++ (self._frozen_config._running_root.root, "HDEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_hdepend_deps),
+ ignored=ignore_hdepend_deps)),
+- (myroot, edepend["RDEPEND"],
++ (myroot, "RDEPEND",
+ self._priority(runtime=True)),
+- (myroot, edepend["PDEPEND"],
++ (myroot, "PDEPEND",
+ self._priority(runtime_post=True))
+ )
+
+ debug = "--debug" in self._frozen_config.myopts
+
+- for dep_root, dep_string, dep_priority in deps:
++ for dep_root, dep_type, dep_priority in deps:
++ dep_string = edepend[dep_type]
+ if not dep_string:
+ continue
+ if debug:
+@@ -2797,7 +2798,7 @@
+
+ try:
+ dep_string = list(self._queue_disjunctive_deps(
+- pkg, dep_root, dep_priority, dep_string))
++ pkg, dep_root, dep_priority, dep_string, dep_type))
+ except portage.exception.InvalidDependString as e:
+ if pkg.installed:
+ self._dynamic_config._masked_installed.add(pkg)
+@@ -2812,14 +2813,14 @@
+
+ if not self._add_pkg_dep_string(
+ pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied):
++ allow_unsatisfied, dep_type):
+ return 0
+
+ self._dynamic_config._traversed_pkg_deps.add(pkg)
+ return 1
+
+ def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied):
++ allow_unsatisfied, dep_type=None):
+ _autounmask_backup = self._dynamic_config._autounmask
+ if dep_priority.optional or dep_priority.ignored:
+ # Temporarily disable autounmask for deps that
+@@ -2828,7 +2829,7 @@
+ try:
+ return self._wrapped_add_pkg_dep_string(
+ pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied)
++ allow_unsatisfied, dep_type)
+ finally:
+ self._dynamic_config._autounmask = _autounmask_backup
+
+@@ -2864,7 +2865,7 @@
+ not slot_operator_rebuild
+
+ def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
+- dep_string, allow_unsatisfied):
++ dep_string, allow_unsatisfied, dep_type=None):
+ if isinstance(pkg.depth, int):
+ depth = pkg.depth + 1
+ else:
+@@ -2888,7 +2889,7 @@
+ try:
+ selected_atoms = self._select_atoms(dep_root,
+ dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
+- strict=strict, priority=dep_priority)
++ strict=strict, priority=dep_priority, dep_type=dep_type)
+ except portage.exception.InvalidDependString:
+ if pkg.installed:
+ self._dynamic_config._masked_installed.add(pkg)
+@@ -3186,7 +3187,7 @@
+ child_pkgs.sort()
+ yield (atom, child_pkgs[-1])
+
+- def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct):
++ def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
+ """
+ Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
+ Yields non-disjunctive deps. Raises InvalidDependString when
+@@ -3195,33 +3196,33 @@
+ for x in dep_struct:
+ if isinstance(x, list):
+ if x and x[0] == "||":
+- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
++ self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
+ else:
+ for y in self._queue_disjunctive_deps(
+- pkg, dep_root, dep_priority, x):
++ pkg, dep_root, dep_priority, x, dep_type):
+ yield y
+ else:
+ # Note: Eventually this will check for PROPERTIES=virtual
+ # or whatever other metadata gets implemented for this
+ # purpose.
+ if x.cp.startswith('virtual/'):
+- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
++ self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
+ else:
+ yield x
+
+- def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct):
++ def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
+ self._dynamic_config._dep_disjunctive_stack.append(
+- (pkg, dep_root, dep_priority, dep_struct))
++ (pkg, dep_root, dep_priority, dep_struct, dep_type))
+
+ def _pop_disjunction(self, allow_unsatisfied):
+ """
+ Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to
+ populate self._dynamic_config._dep_stack.
+ """
+- pkg, dep_root, dep_priority, dep_struct = \
++ pkg, dep_root, dep_priority, dep_struct, dep_type = \
+ self._dynamic_config._dep_disjunctive_stack.pop()
+ if not self._add_pkg_dep_string(
+- pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied):
++ pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied, dep_type):
+ return 0
+ return 1
+
+@@ -4030,7 +4031,7 @@
+ **portage._native_kwargs(kwargs))
+
+ def _select_atoms_highest_available(self, root, depstring,
+- myuse=None, parent=None, strict=True, trees=None, priority=None):
++ myuse=None, parent=None, strict=True, trees=None, priority=None, dep_type=None):
+ """This will raise InvalidDependString if necessary. If trees is
+ None then self._dynamic_config._filtered_trees is used."""
+
+@@ -4053,6 +4054,13 @@
+ pkgsettings = self._frozen_config.pkgsettings[root]
+ if trees is None:
+ trees = self._dynamic_config._filtered_trees
++
++ # this one is needed to guarantee good readonly root
++ # resolution display in the merge list. required since
++ # parent (below) can be None
++ trees[root]["disp_parent"] = parent
++
++
+ mytrees = trees[root]
+ atom_graph = digraph()
+ if True:
+@@ -4081,7 +4089,7 @@
+
+ mycheck = portage.dep_check(depstring, None,
+ pkgsettings, myuse=myuse,
+- myroot=root, trees=trees)
++ myroot=root, trees=trees, dep_type=dep_type)
+ finally:
+ # restore state
+ self._dynamic_config._autounmask = _autounmask_backup
+@@ -4152,6 +4160,7 @@
+ continue
+ node_stack.append((child_node, node, child_atom))
+
++ trees[root].pop("disp_parent")
+ return selected_atoms
+
+ def _expand_virt_from_graph(self, root, atom):
+diff -ru prefix-portage-2.2.14.orig/pym/_emerge/resolver/output.py prefix-portage-2.2.14/pym/_emerge/resolver/output.py
+--- prefix-portage-2.2.14.orig/pym/_emerge/resolver/output.py 2014-05-06 21:32:08.000000000 +0200
++++ prefix-portage-2.2.14/pym/_emerge/resolver/output.py 2015-06-17 10:24:28.920497614 +0200
+@@ -22,11 +22,12 @@
+ from portage.package.ebuild.config import _get_feature_flags
+ from portage.package.ebuild._spawn_nofetch import spawn_nofetch
+ from portage.output import ( blue, colorize, create_color_func,
+- darkblue, darkgreen, green, nc_len, teal)
++ darkblue, darkgreen, green, nc_len, teal, yellow, turquoise)
+ bad = create_color_func("BAD")
+ from portage._sets.base import InternalPackageSet
+ from portage.util import writemsg_stdout
+ from portage.versions import best, cpv_getversion
++from portage.dep.dep_check import ro_selected
+
+ from _emerge.Blocker import Blocker
+ from _emerge.create_world_atom import create_world_atom
+@@ -556,6 +557,42 @@
+ writemsg_stdout("%s\n" % (pkg,), noiselevel=-1)
+ return
+
++ def print_readonly_prefix(self):
++ """Performs the actual output printing for the readonly prefix
++ information stuff
++ """
++ out = sys.stdout
++
++ # print readonly selected packages
++ if len(ro_selected) > 0:
++ out.write("\n%s\n\n" % (darkgreen("Packages resolved from readonly installations:")))
++
++ ro_mismatch_warning = False
++ ro_dupcheck = []
++ for x in ro_selected:
++ tmp_type = x["type"].replace("END","")
++ while len(tmp_type) < 4:
++ tmp_type += " "
++ if x["parent"] and str(x["atom"]) not in ro_dupcheck:
++ out.write("[%s %s] %s %s %s (%s by %s)" % (teal("readonly"),
++ green(tmp_type), green(str(x["matches"][0])), yellow("from"),
++ blue(x["ro_root"]), turquoise(str(x["atom"])), green(x["parent"].cpv)))
++
++ ro_dupcheck.append(str(x["atom"]))
++
++ if x["host_mismatch"]:
++ ro_mismatch_warning = True
++ out.write(" %s\n" % (red("**")))
++ else:
++ out.write("\n")
++
++ if ro_mismatch_warning:
++ out.write("\n%s:" % (red("**")))
++ out.write(yellow(" WARNING: packages marked with ** have been resolved as a\n"))
++ out.write(yellow(" runtime dependency, but the CHOST variable for the parent\n"))
++ out.write(yellow(" and dependency package don't match. This could cause link\n"))
++ out.write(yellow(" errors. It is recommended to use RDEPEND READONLY_EPREFIX's\n"))
++ out.write(yellow(" only with matching CHOST portage instances.\n"))
+
+ def print_verbose(self, show_repos):
+ """Prints the verbose output to std_out
+@@ -907,6 +944,7 @@
+ # now finally print out the messages
+ self.print_messages(show_repos)
+ self.print_blockers()
++ self.print_readonly_prefix()
+ if self.conf.verbosity == 3:
+ self.print_verbose(show_repos)
+ for pkg, pkg_info in self.restrict_fetch_list.items():
+diff -ru prefix-portage-2.2.14.orig/pym/portage/const.py prefix-portage-2.2.14/pym/portage/const.py
+--- prefix-portage-2.2.14.orig/pym/portage/const.py 2014-11-12 18:26:12.000000000 +0100
++++ prefix-portage-2.2.14/pym/portage/const.py 2015-06-17 10:24:28.963830910 +0200
+@@ -187,6 +187,7 @@
+ "notitles",
+ "parallel-fetch",
+ "parallel-install",
++ "prefix-chaining",
+ "prelink-checksums",
+ "preserve-libs",
+ "protect-owned",
+@@ -265,6 +266,11 @@
+ #EPREFIX = ""
+ # END PREFIX LOCAL
+
++BPREFIX = EPREFIX
++
++# --prefix commandline arg always rules, ends up in os.environ["EPREFIX"]
++if "EPREFIX" in os.environ:
++ os.environ["PORTAGE_OVERRIDE_EPREFIX"] = os.environ["EPREFIX"]
+ # pick up EPREFIX from the environment if set
+ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
+ EPREFIX = os.environ["PORTAGE_OVERRIDE_EPREFIX"]
+Only in prefix-portage-2.2.14/pym/portage: const.py.orig
+diff -ru prefix-portage-2.2.14.orig/pym/portage/dbapi/vartree.py prefix-portage-2.2.14/pym/portage/dbapi/vartree.py
+--- prefix-portage-2.2.14.orig/pym/portage/dbapi/vartree.py 2014-11-12 18:28:33.000000000 +0100
++++ prefix-portage-2.2.14/pym/portage/dbapi/vartree.py 2015-06-17 10:24:28.973830901 +0200
+@@ -184,8 +184,19 @@
+ self._counter_path = os.path.join(self._eroot,
+ CACHE_PATH, "counter")
+
+- self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
+- os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry"))
++ plibreg_path = os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry")
++
++ if vartree:
++ self._kill_eprefix = vartree._kill_eprefix
++ else:
++ self._kill_eprefix = False
++
++ if self._kill_eprefix:
++ self._aux_cache_filename = self._aux_cache_filename.replace(EPREFIX, "")
++ self._counter_path = self._counter_path.replace(EPREFIX, "")
++ plibreg_path = plibreg_path.replace(EPREFIX, "")
++
++ self._plib_registry = PreservedLibsRegistry(settings["ROOT"], plibreg_path)
+ self._linkmap = LinkageMap(self)
+ chost = self.settings.get('CHOST')
+ if not chost:
+@@ -215,6 +226,9 @@
+ # This is an optimized hotspot, so don't use unicode-wrapped
+ # os module and don't use os.path.join().
+ rValue = self._eroot + VDB_PATH + _os.sep + mykey
++ if self._kill_eprefix:
++ rValue = rValue.replace(EPREFIX, "")
++
+ if filename is not None:
+ # If filename is always relative, we can do just
+ # rValue += _os.sep + filename
+@@ -440,6 +454,9 @@
+ returnme = []
+ basepath = os.path.join(self._eroot, VDB_PATH) + os.path.sep
+
++ if self._kill_eprefix:
++ basepath = os.path.join(self.root, basepath.replace(EPREFIX, ""))
++
+ if use_cache:
+ from portage import listdir
+ else:
+@@ -530,11 +547,17 @@
+ del self.matchcache[mycat]
+ return list(self._iter_match(mydep,
+ self.cp_list(mydep.cp, use_cache=use_cache)))
++
++ _tmp_path = os.path.join(self._eroot, VDB_PATH, mycat)
++
++ if self._kill_eprefix:
++ _tmp_path = _tmp_path.replace(EPREFIX, "")
++
+ try:
+ if sys.hexversion >= 0x3030000:
+- curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime_ns
++ curmtime = os.stat(_tmp_path).st_mtime_ns
+ else:
+- curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime
++ curmtime = os.stat(_tmp_path).st_mtime
+ except (IOError, OSError):
+ curmtime=0
+
+@@ -1339,7 +1362,7 @@
+ class vartree(object):
+ "this tree will scan a var/db/pkg database located at root (passed to init)"
+ def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
+- settings=None):
++ settings=None, kill_eprefix=None):
+
+ if settings is None:
+ settings = portage.settings
+@@ -1357,6 +1380,7 @@
+ " constructor is unused",
+ DeprecationWarning, stacklevel=2)
+
++ self._kill_eprefix = kill_eprefix
+ self.settings = settings
+ self.dbapi = vardbapi(settings=settings, vartree=self)
+ self.populated = 1
+Only in prefix-portage-2.2.14/pym/portage/dbapi: vartree.py.orig
+diff -ru prefix-portage-2.2.14.orig/pym/portage/dep/dep_check.py prefix-portage-2.2.14/pym/portage/dep/dep_check.py
+--- prefix-portage-2.2.14.orig/pym/portage/dep/dep_check.py 2014-09-28 19:12:31.000000000 +0200
++++ prefix-portage-2.2.14/pym/portage/dep/dep_check.py 2015-06-17 10:24:28.973830901 +0200
+@@ -247,6 +247,95 @@
+ __slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
+ 'all_installed_slots')
+
++ro_trees={}
++ro_vartrees={}
++ro_selected=[]
++
++def dep_match_readonly_roots(settings, atom, dep_type, parent=None):
++ if len(ro_trees) < len(settings.readonly_prefixes):
++ # MDUFT: create additional vartrees for every readonly root here.
++ # the ro_vartrees instances are created below as they are needed to
++ # avoid reading vartrees of portage instances which aren't required
++ # while resolving this dependencies.
++ for type in ("DEPEND","RDEPEND", "PDEPEND"):
++ ro_trees[type] = []
++
++ for ro_root, ro_dep_types in settings.readonly_prefixes.items():
++ if type in ro_dep_types:
++ ro_trees[type].append(ro_root)
++
++ if len(ro_trees) == 0:
++ return []
++
++ matches = []
++
++ for ro_root in ro_trees[dep_type]:
++ if not ro_vartrees.has_key(ro_root):
++ # target_root=ro_root ok? or should it be the real target_root?
++ _tmp_settings = portage.config(config_root=ro_root, target_root=ro_root,
++ config_incrementals=portage.const.INCREMENTALS)
++
++ ro_vartrees[ro_root] = portage.vartree(root=ro_root,
++ categories=_tmp_settings.categories,
++ settings=_tmp_settings, kill_eprefix=True)
++
++ ro_matches = ro_vartrees[ro_root].dbapi.match(atom)
++
++ if ro_matches:
++ ro_host_mismatch = False
++ if dep_type is "RDEPEND":
++ # we need to assure binary compatability, so it needs to be
++ # the same CHOST! But how? for now i cannot do anything...
++ if parent and parent.metadata["CHOST"] != ro_vartrees[ro_root].settings.get("CHOST", ""):
++ # provocate a big fat warning in the list of external packages.
++ ro_host_mismatch = True
++ pass
++
++ matches.append({ "ro_root": ro_root, "atom": atom, "matches": ro_matches,
++ "type": dep_type, "parent": parent, "host_mismatch": ro_host_mismatch })
++
++ return matches
++
++def dep_wordreduce_readonly(reduced, unreduced, settings, dep_type, parent):
++ for mypos, token in enumerate(unreduced):
++ # recurse if it's a list.
++ if isinstance(reduced[mypos], list):
++ reduced[mypos] = dep_wordreduce_readonly(reduced[mypos],
++ unreduced[mypos], settings, dep_type, parent)
++
++ # do nothing if it's satisfied already.
++ elif not reduced[mypos]:
++ ro_matches = dep_match_readonly_roots(settings, unreduced[mypos], dep_type, parent)
++
++ if ro_matches:
++ # TODO: select a match if there are more than one?
++ # for now, the first match is taken...
++ ro_selected.append(ro_matches[0])
++ reduced[mypos] = True
++
++ return reduced
++
++# this may be better placed somewhere else, but i put it here for now, to
++# keep all functions in the patch on one big heap.
++def readonly_pathmatch_any(settings, path):
++ path = path.lstrip('/')
++ # first try locally, and match that if it exists.
++ if os.path.exists(os.path.join(EPREFIX,path)):
++ return os.path.join(EPREFIX,path)
++
++ # after that try all readonly roots where DEPEND is allowed. this makes
++ # sure that executing binaries is possible from there.
++ for ro_root, ro_deps in settings.readonly_roots.items():
++ if "DEPEND" in ro_deps:
++ print(" --- checking %s --- " % (os.path.join(ro_root,path)))
++ if os.path.exists(os.path.join(ro_root,path)):
++ return os.path.join(ro_root,path)
++ break
++
++ # as a fallback make the string the same as it was originally.
++ # even though this path doesn't exist.
++ return os.path.join(EPREFIX,path)
++
+ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
+ """
+ Takes an unreduced and reduced deplist and removes satisfied dependencies.
+@@ -567,7 +656,7 @@
+ assert(False) # This point should not be reachable
+
+ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+- use_cache=1, use_binaries=0, myroot=None, trees=None):
++ use_cache=1, use_binaries=0, myroot=None, trees=None, dep_type=None):
+ """
+ Takes a depend string, parses it, and selects atoms.
+ The myroot parameter is unused (use mysettings['EROOT'] instead).
+@@ -663,6 +752,14 @@
+ writemsg("mysplit: %s\n" % (mysplit), 1)
+ writemsg("mysplit2: %s\n" % (mysplit2), 1)
+
++ if dep_type is not None:
++ mysplit2=dep_wordreduce_readonly(unreduced=mysplit[:],
++ reduced=mysplit2, settings=mysettings,
++ dep_type=dep_type, parent=trees[myroot].get("disp_parent"))
++
++ writemsg("\n", 1)
++ writemsg("mysplit2 after readonly reduce: %s\n" % (mysplit2), 1)
++
+ selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
+ use_binaries=use_binaries, trees=trees)
+
+Only in prefix-portage-2.2.14/pym/portage/dep: dep_check.py.orig
+diff -ru prefix-portage-2.2.14.orig/pym/portage/package/ebuild/_config/LocationsManager.py prefix-portage-2.2.14/pym/portage/package/ebuild/_config/LocationsManager.py
+--- prefix-portage-2.2.14.orig/pym/portage/package/ebuild/_config/LocationsManager.py 2014-02-06 21:49:32.000000000 +0100
++++ prefix-portage-2.2.14/pym/portage/package/ebuild/_config/LocationsManager.py 2015-06-17 10:24:28.983830892 +0200
+@@ -285,6 +285,9 @@
+ if portage.const.EPREFIX:
+ self.global_config_path = os.path.join(portage.const.EPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(self.global_config_path) and portage.const.BPREFIX:
++ self.global_config_path = os.path.join(portage.const.BPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
+
+ def set_port_dirs(self, portdir, portdir_overlay):
+ self.portdir = portdir
+diff -ru prefix-portage-2.2.14.orig/pym/portage/package/ebuild/config.py prefix-portage-2.2.14/pym/portage/package/ebuild/config.py
+--- prefix-portage-2.2.14.orig/pym/portage/package/ebuild/config.py 2014-09-28 19:12:31.000000000 +0200
++++ prefix-portage-2.2.14/pym/portage/package/ebuild/config.py 2015-06-17 10:24:28.983830892 +0200
+@@ -298,6 +298,7 @@
+ self.features = features_set(self)
+ self.features._features = copy.deepcopy(clone.features._features)
+ self._features_overrides = copy.deepcopy(clone._features_overrides)
++ self.readonly_prefixes = copy.deepcopy(clone.readonly_prefixes)
+
+ #Strictly speaking _license_manager is not immutable. Users need to ensure that
+ #extract_global_changes() is called right after __init__ (if at all).
+@@ -894,6 +895,63 @@
+
+ self._validate_commands()
+
++ # expand READONLY_EPREFIX to a list of all readonly portage instances
++ # all the way down to the last one. beware that ATM a deeper instance
++ # in the chain can provide more than the toplevel! this means that
++ # if you only inherit DEPENDS from one instance, that instance may
++ # inherit RDEPENDs from another one, making the top-level instance
++ # inherit RDEPENDs from there too - even if the intermediate prefix
++ # does not do this.
++ self.readonly_prefixes = {}
++ ro_cfg_root = config_root
++ ro_widest_depset = set(['DEPEND', 'RDEPEND', 'PDEPEND'])
++
++ while ro_cfg_root:
++ ro_make_conf_paths = [
++ os.path.join(ro_cfg_root, 'etc', 'make.conf'),
++ os.path.join(ro_cfg_root, MAKE_CONF_FILE)
++ ]
++ try:
++ if os.path.samefile(*ro_make_conf_paths):
++ ro_make_conf_paths.pop()
++ except OSError:
++ pass
++
++ ro_cfg_root = None
++ for ro_make_conf in ro_make_conf_paths:
++ if not os.path.exists(ro_make_conf):
++ continue
++
++ ro_cfg = getconfig(ro_make_conf, tolerant=True, allow_sourcing=True)
++ if not ro_cfg.has_key("READONLY_EPREFIX"):
++ continue
++
++ if not ro_cfg["READONLY_EPREFIX"].find(":"):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s" % (ro_make_conf))
++
++ if ro_cfg_root is not None:
++ raise portage.exception.InvalidReadonlyERoot("ERROR: duplicate READONLY_EPREFIX in %s and %s" % tuple(ro_make_conf_paths))
++
++ (ro_cfg_root,ro_cfg_root_deps) = ro_cfg["READONLY_EPREFIX"].rsplit(":",1)
++
++ if not os.path.exists(ro_cfg_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s: %s does not exist!" % (ro_make_conf, ro_cfg_root))
++
++ if os.path.samefile(ro_cfg_root, config_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: cannot add this instance (%s) as READONLY_EPREFIX in %s." % (ro_cfg_root, ro_make_conf))
++
++ if self.readonly_prefixes.has_key(ro_cfg_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: circular READONLY_EPREFIX's in %s. %s already checked for %s" % (ro_make_conf, ro_cfg_root, self.readonly_prefixes[ro_cfg_root]))
++
++ # intersect the widest depset with the current one to strip down
++ # the allowed dependency resolution to not be wider than the
++ # next higher one. this way we can prevent for a given prefix
++ # to resolve RDEPENDs from a prefix with a different CHOST that
++ # is a few levels deeper in the chain.
++ ro_widest_depset = set(ro_cfg_root_deps.split(",")) & ro_widest_depset
++ self.readonly_prefixes[ro_cfg_root] = ro_widest_depset
++ pass
++
+ for k in self._case_insensitive_vars:
+ if k in self:
+ self[k] = self[k].lower()
+@@ -2671,6 +2729,10 @@
+ if not eapi_exports_merge_type(eapi):
+ mydict.pop("MERGE_TYPE", None)
+
++ # populate with PORTAGE_READONLY_EPREFIXES
++ if self.readonly_prefixes and len(self.readonly_prefixes) > 0:
++ mydict["PORTAGE_READONLY_EPREFIXES"] = ':'.join(self.readonly_prefixes)
++
+ # Prefix variables are supported beginning with EAPI 3, or when
+ # force-prefix is in FEATURES, since older EAPIs would otherwise be
+ # useless with prefix configurations. This brings compatibility with
+Only in prefix-portage-2.2.14/pym/portage/package/ebuild: config.py.orig
+diff -ru prefix-portage-2.2.14.orig/pym/portage/package/ebuild/doebuild.py prefix-portage-2.2.14/pym/portage/package/ebuild/doebuild.py
+--- prefix-portage-2.2.14.orig/pym/portage/package/ebuild/doebuild.py 2014-09-28 19:25:39.000000000 +0200
++++ prefix-portage-2.2.14/pym/portage/package/ebuild/doebuild.py 2015-06-17 10:23:25.703886164 +0200
+@@ -46,6 +46,7 @@
+ unmerge, _encodings, _os_merge, \
+ _shell_quote, _unicode_decode, _unicode_encode
+ from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \
++ GLOBAL_CONFIG_PATH, \
+ EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, PORTAGE_PYM_PACKAGES, EPREFIX, MACOSSANDBOX_PROFILE
+ from portage.data import portage_gid, portage_uid, secpass, \
+ uid, userpriv_groups
+@@ -66,7 +67,8 @@
+ from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
+ from portage.util import apply_recursive_permissions, \
+ apply_secpass_permissions, noiselimit, normalize_path, \
+- writemsg, writemsg_stdout, write_atomic
++ writemsg, writemsg_stdout, write_atomic, getconfig
++from portage.util._path import exists_raise_eaccess
+ from portage.util.lafilefixer import rewrite_lafile
+ from portage.versions import _pkgsplit
+ from _emerge.BinpkgEnvExtractor import BinpkgEnvExtractor
+@@ -212,8 +214,27 @@
+ path.append(os.path.join(portage_bin_path, "ebuild-helpers", "bsd"))
+
+ path.append(os.path.join(portage_bin_path, "ebuild-helpers"))
++
++ # PREFIX CHAINING: append default path for all prefixes involved
++ pfxs = [ eprefix ]
++ pfxs.extend(settings.readonly_prefixes)
++ for prefix in pfxs:
++ global_config_path = os.path.join(prefix, GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ make_globals_path = os.path.join(global_config_path, "make.globals")
++ if exists_raise_eaccess(make_globals_path):
++ expand_map = { "EPREFIX": prefix }
++ pxcfg = getconfig(make_globals_path, True, expand_map)
++ pxdefp = [x for x in pxcfg.get("DEFAULT_PATH", "").split(":") if x]
++ for x in pxdefp:
++ if x.startswith(prefix) and not x in path:
++ path.append(x)
++ else:
++ pxdefs = [prefix + "/usr/sbin", prefix + "/usr/bin", prefix + "/sbin", prefix + "/bin"]
++ path.extend(pxdefs)
++ # END PREFIX CHAINING
++
+ path.extend(prerootpath)
+- path.extend(defaultpath)
++ # path.extend(defaultpath) # PREFIX CHAINING appends the default path for involved prefixes above
+ path.extend(rootpath)
+ path.extend(extrapath)
+ # END PREFIX LOCAL
+diff -ru prefix-portage-2.2.14.orig/pym/portage/package/ebuild/fetch.py prefix-portage-2.2.14/pym/portage/package/ebuild/fetch.py
+--- prefix-portage-2.2.14.orig/pym/portage/package/ebuild/fetch.py 2014-04-22 21:50:06.000000000 +0200
++++ prefix-portage-2.2.14/pym/portage/package/ebuild/fetch.py 2015-06-17 10:24:28.983830892 +0200
+@@ -43,6 +43,7 @@
+ from portage.util import apply_recursive_permissions, \
+ apply_secpass_permissions, ensure_dirs, grabdict, shlex_split, \
+ varexpand, writemsg, writemsg_level, writemsg_stdout
++from portage.util._path import exists_raise_eaccess
+ from portage.process import spawn
+
+ _userpriv_spawn_kwargs = (
+@@ -869,6 +870,9 @@
+ global_config_path = GLOBAL_CONFIG_PATH
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
+
+ missing_file_param = False
+diff -ru prefix-portage-2.2.14.orig/pym/portage/_sets/__init__.py prefix-portage-2.2.14/pym/portage/_sets/__init__.py
+--- prefix-portage-2.2.14.orig/pym/portage/_sets/__init__.py 2014-01-06 10:44:16.000000000 +0100
++++ prefix-portage-2.2.14/pym/portage/_sets/__init__.py 2015-06-17 10:24:28.983830892 +0200
+@@ -28,6 +28,7 @@
+ from portage.exception import PackageSetNotFound
+ from portage.localization import _
+ from portage.util import writemsg_level
++from portage.util._path import exists_raise_eaccess
+
+ SETPREFIX = "@"
+
+@@ -299,6 +300,10 @@
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++
+ def _getfiles():
+ for path, dirs, files in os.walk(os.path.join(global_config_path, "sets")):
+ for f in files:
+diff -ru prefix-portage-2.2.14.orig/pym/portage/util/_dyn_libs/LinkageMapELF.py prefix-portage-2.2.14/pym/portage/util/_dyn_libs/LinkageMapELF.py
+--- prefix-portage-2.2.14.orig/pym/portage/util/_dyn_libs/LinkageMapELF.py 2013-05-04 18:36:19.000000000 +0200
++++ prefix-portage-2.2.14/pym/portage/util/_dyn_libs/LinkageMapELF.py 2015-06-17 10:24:28.987164223 +0200
+@@ -17,7 +17,7 @@
+ from portage.util import grabfile
+ from portage.util import normalize_path
+ from portage.util import writemsg_level
+-from portage.const import EPREFIX
++from portage.const import BPREFIX
+
+ class LinkageMapELF(object):
+
+@@ -235,7 +235,7 @@
+ continue
+ plibs.update((x, cpv) for x in items)
+ if plibs:
+- args = [EPREFIX + "/usr/bin/scanelf", "-qF", "%a;%F;%S;%r;%n"]
++ args = [BPREFIX + "/usr/bin/scanelf", "-qF", "%a;%F;%S;%r;%n"]
+ args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
+ for x in plibs)
+ try:
diff --git a/sys-apps/portage/metadata.xml b/sys-apps/portage/metadata.xml
index 34ef584..797178c 100644
--- a/sys-apps/portage/metadata.xml
+++ b/sys-apps/portage/metadata.xml
@@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
- <herd>prefix</herd>
- <maintainer><email>grobian@gentoo.org</email></maintainer>
-
- <use>
- <flag name="epydoc">Build html API documentation with epydoc.</flag>
- <flag name="ipc">Use inter-process communication between portage and running ebuilds.</flag>
- <flag name="less">Pull in sys-apps/less as default pager for etc-update.</flag>
- <flag name="prefix-chaining">mduft's experimental prefix chaining facilities</flag>
- </use>
+ <upstream>
+ <bugs-to>mailto:prefix@gentoo.org</bugs-to>
+ <changelog>https://gitweb.gentoo.org/proj/portage.git/plain/RELEASE-NOTES</changelog>
+ <doc>https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/Portage</doc>
+ </upstream>
+ <maintainer type="project">
+ <email>prefix@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="epydoc">Build html API documentation with epydoc.</flag>
+ <flag name="ipc">Use inter-process communication between portage and running ebuilds.</flag>
+ <flag name="pypy2_0">Use pypy-c2.0 as Python interpreter.</flag>
+ <flag name="python2">Use python2 as Python interpreter.</flag>
+ <flag name="python3">Use python3 as Python interpreter.</flag>
+ <flag name="xattr">Preserve extended attributes (filesystem-stored metadata) when installing files. Usually only required for hardened systems.</flag>
+ <flag name="prefix-chaining">mduft's experimental prefix chaining facilities</flag>
+ </use>
</pkgmetadata>
diff --git a/sys-apps/portage/portage-2.2.20.ebuild b/sys-apps/portage/portage-2.2.20.ebuild
deleted file mode 100644
index 537888c..0000000
--- a/sys-apps/portage/portage-2.2.20.ebuild
+++ /dev/null
@@ -1,583 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id: portage-2.2.01.16270.ebuild 58665 2010-09-05 19:54:38Z grobian $
-
-# Require EAPI 2 since we now require at least python-2.6 (for python 3
-# syntax support) which also requires EAPI 2.
-EAPI=3
-PYTHON_COMPAT=(
- pypy1_9 pypy2_0
- python3_1 python3_2 python3_3 python3_4 python3_5
- python2_6 python2_7
-)
-inherit eutils multilib
-
-DESCRIPTION="Prefix branch of the Portage Package Manager, used in Gentoo Prefix"
-HOMEPAGE="http://prefix.gentoo.org/"
-LICENSE="GPL-2"
-KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="0"
-IUSE="build doc epydoc +ipc linguas_ru pypy2_0 python2 python3 selinux xattr prefix-chaining"
-
-for _pyimpl in ${PYTHON_COMPAT[@]} ; do
- IUSE+=" python_targets_${_pyimpl}"
-done
-unset _pyimpl
-
-# Import of the io module in python-2.6 raises ImportError for the
-# thread module if threading is disabled.
-python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
- !pypy2_0? ( !python2? ( !python3? (
- || ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
- ) ) )
- pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
- python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
-python_dep="${python_dep_ssl//\[ssl\]}"
-python_dep="${python_dep//,ssl}"
-python_dep="${python_dep//ssl,}"
-
-python_dep="${python_dep}
- python_targets_pypy1_9? ( dev-python/pypy:1.9 )
- python_targets_pypy2_0? ( dev-python/pypy:2.0 )
- python_targets_python2_6? ( dev-lang/python:2.6 )
- python_targets_python2_7? ( dev-lang/python:2.7 )
- python_targets_python3_1? ( dev-lang/python:3.1 )
- python_targets_python3_2? ( dev-lang/python:3.2 )
- python_targets_python3_3? ( dev-lang/python:3.3 )
- python_targets_python3_4? ( dev-lang/python:3.4 )
-"
-
-# The pysqlite blocker is for bug #282760.
-# make-3.82 is for bug #455858
-DEPEND="${python_dep}
- >=sys-devel/make-3.82
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
-# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
-# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-# bash-4.1 necessary for redirect_alloc_fd, which fails on non-Linux if bash
-# doesn't have a builtin for finding a random filedescriptor
-RDEPEND="${python_dep}
- !build? ( >=sys-apps/sed-4.0.5
- || ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-4.1 ) )
- >=app-admin/eselect-1.2
- || ( ${python_dep_ssl} dev-python/python-mhash )
- )
- elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_uclibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- kernel_linux? ( >=app-misc/pax-utils-0.1.17 )
- kernel_SunOS? ( >=app-misc/pax-utils-0.1.17 )
- kernel_FreeBSD? ( >=app-misc/pax-utils-0.1.17 )
- kernel_Darwin? ( >=app-misc/pax-utils-0.1.18 )
- kernel_HPUX? ( !hppa-hpux? ( >=app-misc/pax-utils-0.1.19 ) )
- kernel_AIX? ( >=sys-apps/aix-miscutils-0.1.1634 )
- xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
- selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
- !<app-shells/bash-3.2_p17
- !prefix? ( !<app-admin/logrotate-3.8.0 )"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- userland_GNU? ( >=sys-apps/coreutils-6.4 )
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives http://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-PV_PL="2.1.2"
-PATCHVER_PL=""
-TARBALL_PV="${PV}"
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-PATCHVER=
-[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
-if [ -n "${PATCHVER}" ]; then
- SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
- $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
-fi
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-S_PL="${WORKDIR}"/${PN}-${PV_PL}
-
-compatible_python_is_selected() {
- [[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
-}
-
-current_python_has_xattr() {
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
- [[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
- "${PYTHON}" -c 'import xattr' 2>/dev/null
-}
-
-call_with_python_impl() {
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- env EPYTHON=${EPYTHON} "$@"
-}
-
-get_python_interpreter() {
- [ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
- local impl=$1 python
- case "${impl}" in
- python*)
- python=${impl/_/.}
- ;;
- pypy*)
- python=${impl/_/.}
- python=${python/pypy/pypy-c}
- ;;
- *)
- die "Unrecognized python target: ${impl}"
- esac
- echo ${python}
-}
-
-get_python_sitedir() {
- [ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
- local impl=$1
- local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
- [[ -d ${EROOT}${site_dir} ]] || \
- ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
- echo "${site_dir}"
-}
-
-python_compileall() {
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
- local d_image=${D}${d#/}
- [[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
- case "${EPYTHON}" in
- python*)
- "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
- # Note: Using -OO breaks emaint, since it requires __doc__,
- # and __doc__ is None when -OO is used.
- "${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
- ;;
- pypy*)
- "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
- ;;
- *)
- die "Unrecognized EPYTHON value: ${EPYTHON}"
- esac
-}
-
-pkg_setup() {
- if use python2 && use python3 ; then
- ewarn "Both python2 and python3 USE flags are enabled, but only one"
- ewarn "can be in the shebangs. Using python3."
- fi
- if use pypy2_0 && use python3 ; then
- ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
- ewarn "can be in the shebangs. Using python3."
- fi
- if use pypy2_0 && use python2 ; then
- ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
- ewarn "can be in the shebangs. Using python2"
- fi
- if ! use pypy2_0 && ! use python2 && ! use python3 && \
- ! compatible_python_is_selected ; then
- ewarn "Attempting to select a compatible default python interpreter"
- local x success=0
- for x in "${EPREFIX}"/usr/bin/python2.* ; do
- x=${x#${EPREFIX}/usr/bin/python2.}
- if [[ $x -ge 6 ]] 2>/dev/null ; then
- eselect python set python2.$x
- if compatible_python_is_selected ; then
- elog "Default python interpreter is now set to python-2.$x"
- success=1
- break
- fi
- fi
- done
- if [ $success != 1 ] ; then
- eerror "Unable to select a compatible default python interpreter!"
- die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
- fi
- fi
-
- # We use EPYTHON to designate the active python interpreter,
- # but we only export when needed, via call_with_python_impl.
- EPYTHON=python
- export -n EPYTHON
- if use python3; then
- EPYTHON=python3
- elif use python2; then
- EPYTHON=python2
- elif use pypy2_0; then
- EPYTHON=pypy-c2.0
- fi
-}
-
-src_prepare() {
- if [ -n "${PATCHVER}" ] ; then
- if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
- rm "$S/bin/ebuild-helpers/portageq" \
- || die "failed to remove portageq helper symlink"
- fi
- epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
- fi
-
- use prefix-chaining && epatch "${FILESDIR}"/${PN}-2.2.00.15801-prefix-chaining.patch
- epatch "${FILESDIR}"/${PN}-2.2.8-ebuildshell.patch # 155161
- epatch "${FILESDIR}"/${PN}-2.2.10.1-brokentty-more-platforms.patch # now upstream
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i pym/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- local set_shebang=
- if use python3; then
- set_shebang=python3
- elif use python2; then
- set_shebang=python2
- elif use pypy2_0; then
- set_shebang=pypy-c2.0
- fi
- if [[ -n ${set_shebang} ]] ; then
- einfo "Converting shebangs for ${set_shebang}..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!${EPREFIX}/usr/bin/python"* ]] ; then
- sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f -print0)
- fi
-
- # "native" Prefix still uses configure
- if use !prefix && [[ -n ${EPREFIX} ]] ; then
- einfo "Setting portage.const.EPREFIX ..."
- sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
- -e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
- -e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
- -e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
- -e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
- -e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
- -i pym/portage/const.py || \
- die "Failed to patch portage.const.EPREFIX"
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f -print0)
-
- einfo "Adding FEATURES=force-prefix to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.${ARCH}".diff ]; then
- patch make.conf "make.conf.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-src_configure() {
- if use prefix ; then
- local extrapath="/usr/bin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # lazy check, but works for now
- if [[ ${PORTAGE_ROOT_USER} == "root" ]] ; then
- # we need this for e.g. mtree on FreeBSD (and Darwin) which is in
- # /usr/sbin
- extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- fi
-
- econf \
- --with-portage-user="${PORTAGE_USER:-portage}" \
- --with-portage-group="${PORTAGE_GROUP:-portage}" \
- --with-root-user="${PORTAGE_ROOT_USER}" \
- --with-offset-prefix="${EPREFIX}" \
- --with-extra-path="${extrapath}" \
- || die "econf failed"
- else
- default
- fi
-}
-
-src_compile() {
- if use prefix ; then
- emake || die "emake failed"
- fi
-
- if use doc; then
- call_with_python_impl \
- emake docbook || die
- fi
-
- if use epydoc; then
- einfo "Generating api docs"
- call_with_python_impl \
- emake epydoc || die
- fi
-}
-
-src_test() {
- # make files executable, in case they were created by patch
- find bin -type f | xargs chmod +x
- call_with_python_impl \
- emake test || die
-}
-
-src_install() {
- local portage_base="/usr/lib/portage"
-
- emake DESTDIR="${D}" install || die "make install failed."
- dodir /usr/lib/portage/bin
-
- if use userland_GNU; then
- rm "${ED}"${portage_base}/bin/ebuild-helpers/bsd/sed || die "Failed to remove sed wrapper"
- fi
-
- use doc && dohtml -r "${S}"/doc/*
- use epydoc && dohtml -r "${WORKDIR}"/api
- dodir /etc/portage
- keepdir /etc/portage
-
- # Use dodoc for compression, since the Makefile doesn't do that.
- dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
-
- # Allow external portage API consumers to import portage python modules
- # (this used to be done with PYTHONPATH setting in /etc/env.d).
- # For each of PYTHON_TARGETS, install a tree of *.py symlinks in
- # site-packages, and compile with the corresponding interpreter.
- local impl files mod_dir dest_mod_dir python relative_path x
- for impl in "${PYTHON_COMPAT[@]}" ; do
- use "python_targets_${impl}" || continue
- if use build && [[ ${ROOT} == / &&
- ! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
- # Tolerate --nodeps at beginning of stage1 for catalyst
- ewarn "skipping python_targets_${impl}, interpreter not found"
- continue
- fi
- while read -r mod_dir ; do
- cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
- files=$(echo *.py)
- if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
- # __pycache__ directories contain no py files
- continue
- fi
- dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
- dodir "${dest_mod_dir}" || die
- relative_path=../../../lib/portage/pym/${mod_dir}
- x=/${mod_dir}
- while [ -n "${x}" ] ; do
- relative_path=../${relative_path}
- x=${x%/*}
- done
- for x in ${files} ; do
- dosym "${relative_path}/${x}" \
- "${dest_mod_dir}/${x}" || die
- done
- done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
- cd "${S}" || die
- EPYTHON=$(get_python_interpreter ${impl}) \
- python_compileall "$(get_python_sitedir ${impl})"
- done
-
- # Compile /usr/lib/portage/pym with the active interpreter, since portage
- # internal commands force this directory to the beginning of sys.path.
- python_compileall /usr/lib/portage/pym
-}
-
-pkg_preinst() {
- if [[ $ROOT == / ]] ; then
- # Run some minimal tests as a sanity check.
- local test_runner=$(find "$ED" -name runTests)
- if [[ -n $test_runner && -x $test_runner ]] ; then
- einfo "Running preinst sanity tests..."
- "$test_runner" || die "preinst sanity tests failed"
- fi
- fi
-
- if use xattr && ! current_python_has_xattr ; then
- ewarn "For optimal performance in xattr handling, install"
- ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
- ewarn "enable USE=python3 for $CATEGORY/$PN."
- fi
-
- has_version "<=${CATEGORY}/${PN}-2.2.00.13346"
- EAPIPREFIX_UPGRADE=$?
-
- if has_version "<${CATEGORY}/${PN}-2.2.7-r1" ; then
- REPOS_CONF_UPGRADE=true
- REPOS_CONF_SYNC=
- type -P portageq >/dev/null 2>&1 && \
- REPOS_CONF_SYNC=$("$(type -P portageq)" envvar SYNC)
- fi
-}
-
-new_config_protect() {
- # Generate a ._cfg file even if the target file
- # does not exist, ensuring that the user will
- # notice the config change.
- local basename=${1##*/}
- local dirname=${1%/*}
- local i=0
- while true ; do
- local filename=$(
- echo -n "${dirname}/._cfg"
- printf "%04d" ${i}
- echo -n "_${basename}"
- )
- [[ -e ${filename} ]] || break
- (( i++ ))
- done
- echo "${filename}"
-}
-
-pkg_postinst() {
-
- if [[ -n ${REPOS_CONF_UPGRADE} ]] ; then
- einfo "Generating repos.conf"
- local repo_name=
- [[ -f ${PORTDIR}/profiles/repo_name ]] && \
- repo_name=$(< "${PORTDIR}/profiles/repo_name")
- if [[ -z ${REPOS_CONF_SYNC} ]] ; then
- REPOS_CONF_SYNC=$(grep "^sync-uri =" "${EROOT:-${ROOT}}usr/share/portage/config/repos.conf")
- REPOS_CONF_SYNC=${REPOS_CONF_SYNC##* }
- fi
- local sync_type=
- [[ ${REPOS_CONF_SYNC} == git://* ]] && sync_type=git
-
- if [[ ${REPOS_CONF_SYNC} == cvs://* ]]; then
- sync_type=cvs
- REPOS_CONF_SYNC=${REPOS_CONF_SYNC#cvs://}
- fi
-
- cat <<-EOF > "${T}/repos.conf"
- [DEFAULT]
- main-repo = ${repo_name:-gentoo}
-
- [${repo_name:-gentoo}]
- location = ${PORTDIR:-${EPREFIX}/usr/portage}
- sync-type = ${sync_type:-rsync}
- sync-uri = ${REPOS_CONF_SYNC}
- EOF
-
- [[ ${sync_type} == cvs ]] && echo "sync-cvs-repo = $(<"${PORTDIR}/CVS/Repository")" >> "${T}/repos.conf"
-
- local dest=${EROOT:-${ROOT}}etc/portage/repos.conf
- if [[ ! -f ${dest} ]] && mkdir -p "${dest}" 2>/dev/null ; then
- dest=${EROOT:-${ROOT}}etc/portage/repos.conf/${repo_name:-gentoo}.conf
- fi
- # Don't install the config update if the desired repos.conf directory
- # and config file exist, since users may accept it blindly and break
- # their config (bug #478726).
- [[ -e ${EROOT:-${ROOT}}etc/portage/repos.conf/${repo_name:-gentoo}.conf ]] || \
- mv "${T}/repos.conf" "$(new_config_protect "${dest}")"
-
- if [[ ${PORTDIR} == ${EPREFIX}/usr/portage ]] ; then
- einfo "Generating make.conf PORTDIR setting for backward compatibility"
- for dest in "${EROOT:-${ROOT}}etc/make.conf" "${EROOT:-${ROOT}}etc/portage/make.conf" ; do
- [[ -e ${dest} ]] && break
- done
- [[ -d ${dest} ]] && dest=${dest}/portdir.conf
- rm -rf "${T}/make.conf"
- [[ -f ${dest} ]] && cat "${dest}" > "${T}/make.conf"
- cat <<-EOF >> "${T}/make.conf"
-
- # Set PORTDIR for backward compatibility with various tools:
- # gentoo-bashcomp - bug #478444
- # euse - bug #474574
- # euses and ufed - bug #478318
- PORTDIR="${EPREFIX}/usr/portage"
- EOF
- mkdir -p "${dest%/*}"
- mv "${T}/make.conf" "$(new_config_protect "${dest}")"
- fi
- fi
-
- pushd "${EROOT}var/db/pkg" > /dev/null
- local didwork=
- [[ ! -e "${EROOT}"var/lib/portage/preserved_libs_registry ]] && for cpv in */*/NEEDED ; do
- if [[ ${CHOST} == *-darwin* && ! -f ${cpv}.MACHO.3 ]] ; then
- while read line; do
- scanmacho -BF "%a;%F;%S;%n" ${line% *} >> "${cpv}".MACHO.3
- done < "${cpv}"
- [[ -z ${didwork} ]] \
- && didwork=yes \
- || didwork=already
- elif [[ ${CHOST} != *-darwin* && ${CHOST} != *-interix* && ! -f ${cpv}.ELF.2 ]] ; then
- while read line; do
- filename=${line% *}
- needed=${line#* }
- newline=$(scanelf -BF "%a;%F;%S;$needed;%r" $filename)
- echo "${newline:3}" >> "${cpv}".ELF.2
- done < "${cpv}"
- [[ -z ${didwork} ]] \
- && didwork=yes \
- || didwork=already
- fi
- [[ ${didwork} == yes ]] && \
- einfo "converting NEEDED files to new syntax, please wait"
- done
- popd > /dev/null
-
- if [[ ${EAPIPREFIX_UPGRADE} == 0 ]] ; then
- local eapi
- einfo 'removing EAPI="prefix" legacy from your vdb, please wait'
- pushd "${EROOT}var/db/pkg" > /dev/null
- for cpv in */* ; do
- [[ ${cpv##*/} == "-MERGING-"* ]] && continue
- # remove "prefix" from EAPI file
- eapi=$(<"${cpv}"/EAPI)
- eapi=${eapi/prefix/}
- eapi=${eapi# }
- eapi=${eapi:-0}
- echo ${eapi} > "${cpv}"/EAPI
- # remove "prefix" from EAPI in stored environment
- bzcat "${cpv}"/environment.bz2 \
- | sed -e "s/EAPI=\([\"']\)prefix [0-9][\"']/EAPI=\1${eapi}\1/" \
- | bzip2 -9 > "${cpv}"/environment2.bz2 \
- && mv -f "${cpv}"/environment{2,}.bz2
- # remove "prefix" from the stored ebuild
- sed -i -e "s/^EAPI=.*$/EAPI=${eapi}/" "${cpv}/${cpv##*/}.ebuild"
- done
- popd > /dev/null
- fi
-}
diff --git a/sys-apps/portage/portage-2.2.28.ebuild b/sys-apps/portage/portage-2.2.28.ebuild
index dc0bdab..9b9b151 100644
--- a/sys-apps/portage/portage-2.2.28.ebuild
+++ b/sys-apps/portage/portage-2.2.28.ebuild
@@ -93,6 +93,8 @@ python_prepare_all() {
distutils-r1_python_prepare_all
epatch "${FILESDIR}"/${PN}-2.2.8-ebuildshell.patch # 155161
+ use prefix-chaining &&
+ epatch "${FILESDIR}"/${PN}-2.2.14-prefix-chaining.patch
# solved in git already, remove at next version
sed -i -e "s/version = '2.2.27'/version = '2.2.27-prefix'/" \
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2016-05-02 11:15 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2016-05-02 11:15 UTC (permalink / raw
To: gentoo-commits
commit: 9df60459337bfbe3f3fe7bb2b48ef18c076284af
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Mon May 2 09:15:21 2016 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon May 2 11:14:56 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=9df60459
+portage-2.2.28-r2: bump ebuildshell patch bug#155161 comment#32
Package-Manager: portage-2.2.28-prefix
.../portage/files/portage-2.2.28-ebuildshell.patch | 92 +++++++++++++---------
...e-2.2.28-r1.ebuild => portage-2.2.28-r2.ebuild} | 0
2 files changed, 53 insertions(+), 39 deletions(-)
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
index 7e7e71d..afd2f39 100644
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
+++ b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
@@ -1,19 +1,19 @@
-From 096a74009cea9c79bcc2729d18a3cbcb99783aeb Mon Sep 17 00:00:00 2001
+From c93cb045630db71f8fbc0e0b67960a28764a6852 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Date: Wed, 6 Nov 2013 12:40:05 +0100
Subject: [PATCH] Add ebuildshell feature, bug#155161.
---
- bin/ebuild.sh | 102 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 65 ++++++++++++++++------
+ bin/ebuild.sh | 131 ++++++++++++++++++++++++++++++++++-
+ bin/filter-bash-environment.py | 50 ++++++++-----
bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 +++
+ man/make.conf.5 | 6 ++
pym/_emerge/AbstractEbuildProcess.py | 1 +
pym/portage/const.py | 1 +
- 6 files changed, 159 insertions(+), 18 deletions(-)
+ 6 files changed, 173 insertions(+), 18 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f1586b2..06c90df 100755
+index f1586b2..cb487c0 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -130,7 +130,7 @@ __qa_source() {
@@ -25,7 +25,7 @@ index f1586b2..06c90df 100755
retval=$?
set +e
[[ $shopts != $(shopt) ]] &&
-@@ -537,6 +537,106 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
+@@ -537,6 +537,135 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
unset BIN_PATH BIN BODY FUNC_SRC
fi
@@ -74,14 +74,31 @@ index f1586b2..06c90df 100755
+ type $1
+ echo "WANTED: \$@"
+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the user's real one
++ # use bash history, but not the 'user's real one
+ HISTFILE=~/.bash_history
-+ # for copy&paste function body lines containing: local
-+ alias local=declare
+ # for copy&paste function body lines containing: !
+ set +H
++ # Support the 'local' keyword outside any shell function
++ # for copy&paste of function body lines: Remember these
++ # "local" variable names for filtering from return-env.
++ __ebuildshell_local_vars=
++ __ebuildshell_local() {
++ local __ebuildshell_local_attr=
++ while [[ \${1} == -* ]]; do
++ __ebuildshell_local_attr+=" \${1}"
++ shift
++ done
++ __ebuildshell_local_vars+=" \${1%%=*} "
++ # Need to declare into the global shell namespace,
++ # as we are in some shell function here apparently.
++ declare -g \${__ebuildshell_local_attr} "\$@"
++ }
++ # within some function, BASH_LINENO is set, and we use real 'local'
++ alias local='\$( (( \${#BASH_LINENO} > 0 )) && echo local || echo __ebuildshell_local)'
+ # at exit, dump the current environment
+ trap "
++ unalias local
++ unset -f __ebuildshell_local
+ rm -f '${__ebuildshell_tmpf}.return-'*
+ (
+ (
@@ -93,13 +110,14 @@ index f1586b2..06c90df 100755
+ (
+ # We may have more readonly variables now, but we
+ # need to filter variables that are readonly already.
-+ 2>"${__ebuildshell_tmpf}.return-rovars" \
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \
++ 2>'${__ebuildshell_tmpf}.return-rovars' \\
++ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ --export-into-global-scope \
-+ '${__ebuildshell_bash_i_vars} ${__ebuildshell_ro_ebuild_vars}' \\
++ --report-readonly-variables \\
++ --preserve-readonly-attribute \\
++ '${__ebuildshell_bash_i_vars}
++ ${__ebuildshell_ro_ebuild_vars}
++ '\" \${__ebuildshell_local_vars}\" \\
+ || die 'filter-bash-environment.py failed'
+ )
+ ) > '${__ebuildshell_tmpf}.return-env'
@@ -120,12 +138,23 @@ index f1586b2..06c90df 100755
+ # The environment- and exit-status handling after leaving the ebuildshell
+ # prompt is expected to be identical as without the ebuildshell prompt.
+ local __ebuildshell_status=$?
++
++ # Defining a variable without using the the local keyword makes this
++ # variable visible to the 'global' shell namespace. But 'declare -p'
++ # does not show the -g flag, so we need to add that one for all
++ # variables that have been visible to the EXIT trap above.
++ local __ebuildshell_orig_expand_aliases=$(shopt -p expand_aliases)
++ alias declare='declare -g'
++ shopt -s expand_aliases
+ source "${__ebuildshell_tmpf}.return-env"
++ unalias declare
++ ${__ebuildshell_orig_expand_aliases}
+ # Portage does whitelist readonly variables. If an ebuild defines
+ # more readonly variables, their readonly attribute is removed.
+ # If we ever want to preserve additional readonly variables across
+ # phases, their names are in "${__ebuildshell_tmpf}.return-rovars".
+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
++
+ return ${__ebuildshell_status}
+}
+
@@ -133,20 +162,19 @@ index f1586b2..06c90df 100755
export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
trap 'exit 1' SIGTERM
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index a4cdc54..a710e93 100755
+index a4cdc54..5ed2584 100755
--- a/bin/filter-bash-environment.py
+++ b/bin/filter-bash-environment.py
-@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
+@@ -14,7 +14,7 @@ func_end_re = re.compile(r'^\}$')
var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
close_quote_re = re.compile(r'(\\"|"|\')\s*$')
-readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+')
+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+export_re = re.compile(r'^declare\s+-(\S*x\S*)\s+')
# declare without assignment
var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-@@ -29,7 +30,7 @@ def have_end_quote(quote, line):
+@@ -29,7 +29,7 @@ def have_end_quote(quote, line):
return close_quote_match is not None and \
close_quote_match.group(1) == quote
@@ -155,7 +183,7 @@ index a4cdc54..a710e93 100755
readonly_match = readonly_re.match(line)
if readonly_match is not None:
declare_opts = ''
-@@ -37,14 +38,29 @@ def filter_declare_readonly_opt(line):
+@@ -37,14 +37,19 @@ def filter_declare_readonly_opt(line):
group = readonly_match.group(i)
if group is not None:
declare_opts += group
@@ -175,41 +203,29 @@ index a4cdc54..a710e93 100755
return line
-def filter_bash_environment(pattern, file_in, file_out):
-+def add_global_export_opt(line, options):
-+ export_match = export_re.match(line)
-+ if export_match is not None:
-+ declare_opts = export_match.group(1)
-+ if 'g' not in declare_opts and '--export-into-global-scope' in options:
-+ declare_opts += 'g'
-+ line = 'declare -%s %s' % \
-+ (declare_opts, line[export_match.end():])
-+ return line
-+
+def filter_bash_environment(pattern, file_in, file_out, options):
# Filter out any instances of the \1 character from variable values
# since this character multiplies each time that the environment
# is saved (strange bash behavior). This can eventually result in
-@@ -77,7 +93,8 @@ def filter_bash_environment(pattern, file_in, file_out):
+@@ -77,7 +82,7 @@ def filter_bash_environment(pattern, file_in, file_out):
multi_line_quote = quote
multi_line_quote_filter = filter_this
if not filter_this:
- line = filter_declare_readonly_opt(line)
+ line = filter_declare_readonly_opt(line, options)
-+ line = add_global_export_opt(line, options)
file_out.write(line.replace("\1", ""))
continue
else:
-@@ -87,7 +104,8 @@ def filter_bash_environment(pattern, file_in, file_out):
+@@ -87,7 +92,7 @@ def filter_bash_environment(pattern, file_in, file_out):
filter_this = pattern.match(declare_match.group(2)) \
is not None
if not filter_this:
- line = filter_declare_readonly_opt(line)
+ line = filter_declare_readonly_opt(line, options)
-+ line = add_global_export_opt(line, options)
file_out.write(line)
continue
-@@ -124,13 +142,28 @@ if __name__ == "__main__":
+@@ -124,13 +129,26 @@ if __name__ == "__main__":
"while leaving bash function definitions and here-documents " + \
"intact. The PATTERN is a space separated list of variable names" + \
" and it supports python regular expression syntax."
@@ -227,8 +243,6 @@ index a4cdc54..a710e93 100755
+ "Write names of readonly variables to stderr.",
+ '--preserve-readonly-attribute':
+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--export-into-global-scope':
-+ "Add the '-g' flag to 'declare -x'.",
+ }
+ options = {}
+ for arg in sys.argv[1:]:
@@ -245,7 +259,7 @@ index a4cdc54..a710e93 100755
if len(args) != 1:
sys.stderr.write(usage + "\n")
-@@ -154,5 +187,5 @@ if __name__ == "__main__":
+@@ -154,5 +172,5 @@ if __name__ == "__main__":
var_pattern = "^(%s)$" % "|".join(var_pattern)
filter_bash_environment(
diff --git a/sys-apps/portage/portage-2.2.28-r1.ebuild b/sys-apps/portage/portage-2.2.28-r2.ebuild
similarity index 100%
rename from sys-apps/portage/portage-2.2.28-r1.ebuild
rename to sys-apps/portage/portage-2.2.28-r2.ebuild
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2016-05-03 15:33 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2016-05-03 15:33 UTC (permalink / raw
To: gentoo-commits
commit: 4fcd3c6826ab0f73d202305307d9c9d80a85fe05
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Tue May 3 15:31:35 2016 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue May 3 15:33:07 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=4fcd3c68
+portage-2.2.28-r3: bump ebuildshell patch bug#155161 comment#34
Package-Manager: portage-2.2.28-prefix
.../portage/files/portage-2.2.28-ebuildshell.patch | 113 +++++++++++----------
...e-2.2.28-r2.ebuild => portage-2.2.28-r3.ebuild} | 0
2 files changed, 60 insertions(+), 53 deletions(-)
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
index afd2f39..69373f6 100644
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
+++ b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
@@ -1,19 +1,19 @@
-From c93cb045630db71f8fbc0e0b67960a28764a6852 Mon Sep 17 00:00:00 2001
+From 3ae829681363c032c9863d4e5a41a762af89f93e Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Date: Wed, 6 Nov 2013 12:40:05 +0100
Subject: [PATCH] Add ebuildshell feature, bug#155161.
---
- bin/ebuild.sh | 131 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 50 ++++++++-----
+ bin/ebuild.sh | 123 ++++++++++++++++++++++++++++++++++-
+ bin/filter-bash-environment.py | 57 +++++++++++-----
bin/save-ebuild-env.sh | 2 +-
man/make.conf.5 | 6 ++
pym/_emerge/AbstractEbuildProcess.py | 1 +
pym/portage/const.py | 1 +
- 6 files changed, 173 insertions(+), 18 deletions(-)
+ 6 files changed, 172 insertions(+), 18 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f1586b2..cb487c0 100755
+index f1586b2..8231a98 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -130,7 +130,7 @@ __qa_source() {
@@ -25,7 +25,7 @@ index f1586b2..cb487c0 100755
retval=$?
set +e
[[ $shopts != $(shopt) ]] &&
-@@ -537,6 +537,135 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
+@@ -537,6 +537,127 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
unset BIN_PATH BIN BODY FUNC_SRC
fi
@@ -39,8 +39,8 @@ index f1586b2..cb487c0 100755
+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO
-+ PIPESTATUS PPID PWD RANDOM SECONDS SHELLOPTS UID"
++ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
++ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
@@ -76,56 +76,50 @@ index f1586b2..cb487c0 100755
+ echo "or use: \"\\\$@\""
+ # use bash history, but not the 'user's real one
+ HISTFILE=~/.bash_history
-+ # for copy&paste function body lines containing: !
++ # but do not use history-expansion with '!',
++ # for copy&paste of function body lines containing: !
+ set +H
-+ # Support the 'local' keyword outside any shell function
-+ # for copy&paste of function body lines: Remember these
-+ # "local" variable names for filtering from return-env.
-+ __ebuildshell_local_vars=
-+ __ebuildshell_local() {
-+ local __ebuildshell_local_attr=
-+ while [[ \${1} == -* ]]; do
-+ __ebuildshell_local_attr+=" \${1}"
-+ shift
-+ done
-+ __ebuildshell_local_vars+=" \${1%%=*} "
-+ # Need to declare into the global shell namespace,
-+ # as we are in some shell function here apparently.
-+ declare -g \${__ebuildshell_local_attr} "\$@"
-+ }
-+ # within some function, BASH_LINENO is set, and we use real 'local'
-+ alias local='\$( (( \${#BASH_LINENO} > 0 )) && echo local || echo __ebuildshell_local)'
++ # For copy&paste of function body lines, we want the 'local'
++ # keyword available at the shell prompt as well. So we alias
++ # the 'local' keyword to 'declare -t', to identify local
++ # variables by their trace attribute.
++ alias local='declare -t'
++ shopt -s expand_aliases
++ # this is a debugging shell already
++ shopt -u extdebug
++ trap - DEBUG
+ # at exit, dump the current environment
+ trap "
+ unalias local
-+ unset -f __ebuildshell_local
++ unset -f __call-ebuildshell
+ rm -f '${__ebuildshell_tmpf}.return-'*
+ (
+ (
++ # declare -p does not tell the -g flag,
++ # so we add it by aliasing declare.
++ echo \"alias declare='declare -g'\"
+ declare -p
++ echo \"unalias declare\"
+ declare -fp
-+ shopt -p | grep -v 'extdebug$'
++ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
+ ) |
+ (
-+ # We may have more readonly variables now, but we
++ # We may have more readonly variables now, yet we
+ # need to filter variables that are readonly already.
+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
+ --report-readonly-variables \\
+ --preserve-readonly-attribute \\
-+ '${__ebuildshell_bash_i_vars}
-+ ${__ebuildshell_ro_ebuild_vars}
-+ '\" \${__ebuildshell_local_vars}\" \\
++ --filter-traced-variables \\
++ '${__ebuildshell_bash_i_vars} \
++ ${__ebuildshell_ro_ebuild_vars}' \\
+ || die 'filter-bash-environment.py failed'
+ )
+ ) > '${__ebuildshell_tmpf}.return-env'
+ " EXIT
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # can do some cleanup already
++ # can do some cleanup right now
+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
+ EOE
+ ) > "${__ebuildshell_tmpf}.ebuild-env"
@@ -139,16 +133,14 @@ index f1586b2..cb487c0 100755
+ # prompt is expected to be identical as without the ebuildshell prompt.
+ local __ebuildshell_status=$?
+
-+ # Defining a variable without using the the local keyword makes this
-+ # variable visible to the 'global' shell namespace. But 'declare -p'
-+ # does not show the -g flag, so we need to add that one for all
-+ # variables that have been visible to the EXIT trap above.
-+ local __ebuildshell_orig_expand_aliases=$(shopt -p expand_aliases)
-+ alias declare='declare -g'
-+ shopt -s expand_aliases
++ # We might be in a recursive ebuildshell, but do not want
++ # any aliases being active while sourcing the return-env.
++ local __ebuildshell_orig_aliases=$(alias)
++ unalias -a
+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias declare
-+ ${__ebuildshell_orig_expand_aliases}
++ unalias -a
++ eval "${__ebuildshell_orig_aliases}"
++
+ # Portage does whitelist readonly variables. If an ebuild defines
+ # more readonly variables, their readonly attribute is removed.
+ # If we ever want to preserve additional readonly variables across
@@ -162,19 +154,20 @@ index f1586b2..cb487c0 100755
export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
trap 'exit 1' SIGTERM
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index a4cdc54..5ed2584 100755
+index a4cdc54..1c4ad58 100755
--- a/bin/filter-bash-environment.py
+++ b/bin/filter-bash-environment.py
-@@ -14,7 +14,7 @@ func_end_re = re.compile(r'^\}$')
+@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
close_quote_re = re.compile(r'(\\"|"|\')\s*$')
-readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+')
+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
++trace_re = re.compile(r'^declare\s+-\S*t\S*\s+')
# declare without assignment
var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-@@ -29,7 +29,7 @@ def have_end_quote(quote, line):
+@@ -29,7 +30,7 @@ def have_end_quote(quote, line):
return close_quote_match is not None and \
close_quote_match.group(1) == quote
@@ -183,7 +176,7 @@ index a4cdc54..5ed2584 100755
readonly_match = readonly_re.match(line)
if readonly_match is not None:
declare_opts = ''
-@@ -37,14 +37,19 @@ def filter_declare_readonly_opt(line):
+@@ -37,14 +38,19 @@ def filter_declare_readonly_opt(line):
group = readonly_match.group(i)
if group is not None:
declare_opts += group
@@ -207,7 +200,16 @@ index a4cdc54..5ed2584 100755
# Filter out any instances of the \1 character from variable values
# since this character multiplies each time that the environment
# is saved (strange bash behavior). This can eventually result in
-@@ -77,7 +82,7 @@ def filter_bash_environment(pattern, file_in, file_out):
+@@ -68,6 +74,8 @@ def filter_bash_environment(pattern, file_in, file_out):
+ quote = var_assign_match.group(3)
+ filter_this = pattern.match(var_assign_match.group(2)) \
+ is not None
++ if not filter_this and '--filter-traced-variables' in options:
++ filter_this = trace_re.match(line) is not None
+ # Exclude the start quote when searching for the end quote,
+ # to ensure that the start quote is not misidentified as the
+ # end quote (happens if there is a newline immediately after
+@@ -77,7 +85,7 @@ def filter_bash_environment(pattern, file_in, file_out):
multi_line_quote = quote
multi_line_quote_filter = filter_this
if not filter_this:
@@ -216,16 +218,19 @@ index a4cdc54..5ed2584 100755
file_out.write(line.replace("\1", ""))
continue
else:
-@@ -87,7 +92,7 @@ def filter_bash_environment(pattern, file_in, file_out):
+@@ -86,8 +94,10 @@ def filter_bash_environment(pattern, file_in, file_out):
+ # declare without assignment
filter_this = pattern.match(declare_match.group(2)) \
is not None
++ if not filter_this and '--filter-traced-variables' in options:
++ filter_this = trace_re.match(line) is not None
if not filter_this:
- line = filter_declare_readonly_opt(line)
+ line = filter_declare_readonly_opt(line, options)
file_out.write(line)
continue
-@@ -124,13 +129,26 @@ if __name__ == "__main__":
+@@ -124,13 +134,28 @@ if __name__ == "__main__":
"while leaving bash function definitions and here-documents " + \
"intact. The PATTERN is a space separated list of variable names" + \
" and it supports python regular expression syntax."
@@ -243,6 +248,8 @@ index a4cdc54..5ed2584 100755
+ "Write names of readonly variables to stderr.",
+ '--preserve-readonly-attribute':
+ "Preserve the '-r' flag in 'declare -r'.",
++ '--filter-traced-variables':
++ "Filter out variables declared with '-t' attribute."
+ }
+ options = {}
+ for arg in sys.argv[1:]:
@@ -259,7 +266,7 @@ index a4cdc54..5ed2584 100755
if len(args) != 1:
sys.stderr.write(usage + "\n")
-@@ -154,5 +172,5 @@ if __name__ == "__main__":
+@@ -154,5 +179,5 @@ if __name__ == "__main__":
var_pattern = "^(%s)$" % "|".join(var_pattern)
filter_bash_environment(
diff --git a/sys-apps/portage/portage-2.2.28-r2.ebuild b/sys-apps/portage/portage-2.2.28-r3.ebuild
similarity index 100%
rename from sys-apps/portage/portage-2.2.28-r2.ebuild
rename to sys-apps/portage/portage-2.2.28-r3.ebuild
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2016-05-13 11:39 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2016-05-13 11:39 UTC (permalink / raw
To: gentoo-commits
commit: 5fc496c38e3464658a258557d31849ebd9598109
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Fri May 13 11:38:53 2016 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Fri May 13 11:39:24 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5fc496c3
+sys-apps/portage-2.2.28-r4: bump ebuildshell patch to bug#155161 comment#36
Package-Manager: portage-2.2.28-prefix
.../portage/files/portage-2.2.28-ebuildshell.patch | 50 +++++++++++++++-------
...e-2.2.28-r3.ebuild => portage-2.2.28-r4.ebuild} | 0
2 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
index 69373f6..4674506 100644
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
+++ b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
@@ -1,19 +1,19 @@
-From 3ae829681363c032c9863d4e5a41a762af89f93e Mon Sep 17 00:00:00 2001
+From 5e3167845640624f328969355db2e7f16cad2c83 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Date: Wed, 6 Nov 2013 12:40:05 +0100
Subject: [PATCH] Add ebuildshell feature, bug#155161.
---
- bin/ebuild.sh | 123 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 57 +++++++++++-----
+ bin/ebuild.sh | 143 ++++++++++++++++++++++++++++++++++-
+ bin/filter-bash-environment.py | 57 ++++++++++----
bin/save-ebuild-env.sh | 2 +-
man/make.conf.5 | 6 ++
pym/_emerge/AbstractEbuildProcess.py | 1 +
pym/portage/const.py | 1 +
- 6 files changed, 172 insertions(+), 18 deletions(-)
+ 6 files changed, 192 insertions(+), 18 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f1586b2..8231a98 100755
+index f1586b2..d42ffd4 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -130,7 +130,7 @@ __qa_source() {
@@ -25,7 +25,7 @@ index f1586b2..8231a98 100755
retval=$?
set +e
[[ $shopts != $(shopt) ]] &&
-@@ -537,6 +537,127 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
+@@ -537,6 +537,147 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
unset BIN_PATH BIN BODY FUNC_SRC
fi
@@ -46,6 +46,19 @@ index f1586b2..8231a98 100755
+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
+ (
++ cat <<-EOE
++ # local variables of functions using recursive ebuildshell are
++ # visible to the EXIT trap of that recursive ebuildshell. To
++ # keep them local, we have to filter them from that recursive
++ # ebuildshell's return-env. As 'declare -p' is unable to tell
++ # local-ity of variables, we abuse the trace attribute for local
++ # variables to filter them from the return-env. So we need the
++ # local alias active before declaring any functions.
++ # On a sidehand, this allows for copy&paste of function body
++ # lines including the local keyword.
++ alias local='declare -t'
++ shopt -s expand_aliases
++ EOE
+ (
+ declare -p
+ declare -fp
@@ -62,6 +75,17 @@ index f1586b2..8231a98 100755
+ "${__ebuildshell_bash_i_vars}" \
+ || die "filter-bash-environment.py failed"
+ )
++ # 'declare -g' is available since bash-4.2,
++ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
++ if (( ${BASH_VERSINFO[0]} > 4 )) ||
++ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
++ then
++ __ebuildshell_bash42_true=
++ __ebuildshell_bash42_false='#bash-4.2#'
++ else
++ __ebuildshell_bash42_true='#bash-4.2#'
++ __ebuildshell_bash42_false=
++ fi
+ # The already readonly variables, without bash maintained ones:
+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
+ cat <<-EOE
@@ -72,6 +96,7 @@ index f1586b2..8231a98 100755
+ # be informative about what to do
+ PS1="EBUILD ${PN} $1 \$ "
+ type $1
++ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
+ echo "WANTED: \$@"
+ echo "or use: \"\\\$@\""
+ # use bash history, but not the 'user's real one
@@ -79,12 +104,6 @@ index f1586b2..8231a98 100755
+ # but do not use history-expansion with '!',
+ # for copy&paste of function body lines containing: !
+ set +H
-+ # For copy&paste of function body lines, we want the 'local'
-+ # keyword available at the shell prompt as well. So we alias
-+ # the 'local' keyword to 'declare -t', to identify local
-+ # variables by their trace attribute.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
+ # this is a debugging shell already
+ shopt -u extdebug
+ trap - DEBUG
@@ -97,16 +116,17 @@ index f1586b2..8231a98 100755
+ (
+ # declare -p does not tell the -g flag,
+ # so we add it by aliasing declare.
-+ echo \"alias declare='declare -g'\"
++ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
+ declare -p
-+ echo \"unalias declare\"
++ ${__ebuildshell_bash42_true}echo \"unalias declare\"
+ declare -fp
+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
+ ) |
+ (
+ # We may have more readonly variables now, yet we
-+ # need to filter variables that are readonly already.
++ # need to filter variables that were readonly before.
++ # And filter local variables by their trace attribute.
+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
diff --git a/sys-apps/portage/portage-2.2.28-r3.ebuild b/sys-apps/portage/portage-2.2.28-r4.ebuild
similarity index 100%
rename from sys-apps/portage/portage-2.2.28-r3.ebuild
rename to sys-apps/portage/portage-2.2.28-r4.ebuild
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2017-09-18 14:08 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2017-09-18 14:08 UTC (permalink / raw
To: gentoo-commits
commit: 4b7e34b956d910b3723354b9351d21d8f010788f
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 18 14:08:44 2017 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Sep 18 14:08:44 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=4b7e34b9
sys-apps/portage: bump prefix-chaining.patch
Package-Manager: Portage-2.3.8-prefix, Repoman-2.3.3
.../files/portage-2.3.8-prefix-chaining.patch | 927 +++++++++++++++++++++
sys-apps/portage/portage-2.3.8.ebuild | 2 +-
2 files changed, 928 insertions(+), 1 deletion(-)
diff --git a/sys-apps/portage/files/portage-2.3.8-prefix-chaining.patch b/sys-apps/portage/files/portage-2.3.8-prefix-chaining.patch
new file mode 100644
index 0000000000..036d022191
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.3.8-prefix-chaining.patch
@@ -0,0 +1,927 @@
+From 448d210bb312ed0930763376d5182ebfbed1abd8 Mon Sep 17 00:00:00 2001
+From: Michael Haubenwallner <haubi@gentoo.org>
+Date: Thu, 23 Mar 2017 13:52:32 +0100
+Subject: [PATCH] add prefix-chaining support
+
+---
+ bin/install-qa-check.d/05prefix | 30 ++++++-
+ bin/phase-helpers.sh | 28 ++++++
+ pym/_emerge/actions.py | 6 +-
+ pym/_emerge/depgraph.py | 51 ++++++-----
+ pym/_emerge/resolver/output.py | 40 ++++++++-
+ pym/portage/_sets/__init__.py | 5 ++
+ pym/portage/const.py | 6 ++
+ pym/portage/dbapi/vartree.py | 34 ++++++--
+ pym/portage/dep/dep_check.py | 99 +++++++++++++++++++++-
+ .../package/ebuild/_config/LocationsManager.py | 3 +
+ pym/portage/package/ebuild/config.py | 62 ++++++++++++++
+ pym/portage/package/ebuild/doebuild.py | 24 +++++-
+ pym/portage/package/ebuild/fetch.py | 4 +
+ pym/portage/sync/controller.py | 27 +++---
+ pym/portage/util/_dyn_libs/LinkageMapELF.py | 4 +-
+ 15 files changed, 376 insertions(+), 47 deletions(-)
+
+diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
+index 32561e2..0c11473 100644
+--- a/bin/install-qa-check.d/05prefix
++++ b/bin/install-qa-check.d/05prefix
+@@ -79,16 +79,42 @@ install_qa_check_prefix() {
+ # unprefixed shebang, is the script directly in $PATH or an init
+ # script?
+ if [[ ":${PATH}:${EPREFIX}/etc/init.d:" == *":${fp}:"* ]] ; then
+- if [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then
++ all_epfs="$PORTAGE_READONLY_EPREFIXES:$EPREFIX:$EROOT:$ED"
++ save_IFS=$IFS
++ IFS=:
++ epfs=( $all_epfs )
++ IFS=$save_IFS
++
++ found=
++ for x in "${epfs[@]}"; do
++ [[ -z "${x}" ]] && continue
++ check="${x}${line[0]}"
++
++ # might already contain a prefix
++ if [[ "${line[0]}" == "${x}"* ]]; then
++ check="${line[0]}"
++ fi
++
++ if [[ -e ${check} ]]; then
++ found="${check}"
++ fi
++ done
++
++ if [[ -n ${found} ]] ; then
+ # is it unprefixed, but we can just fix it because a
+ # prefixed variant exists
+ eqawarn "prefixing shebang of ${fn#${D}}"
++
++ if [[ ${found} == "${ED}"* || ${found} == "${EROOT}"* ]]; then
++ found="${EPREFIX}${line[0]}"
++ fi
++
+ # statement is made idempotent on purpose, because
+ # symlinks may point to the same target, and hence the
+ # same real file may be sedded multiple times since we
+ # read the shebangs in one go upfront for performance
+ # reasons
+- sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${EPREFIX}"${line[0]}':' "${rf}"
++ sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${found}"':' "${rf}"
+ continue
+ else
+ # this is definitely wrong: script in $PATH and invalid shebang
+diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
+index b28fd92..dcfd263 100644
+--- a/bin/phase-helpers.sh
++++ b/bin/phase-helpers.sh
+@@ -867,6 +867,10 @@ has_version() {
+ "${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" has_version "${eroot}" "${atom}"
+ fi
+ local retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ ${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' has_version '${READONLY_EPREFIX%:*}' '${atom}'"
++ retval=$?
++ fi
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+@@ -926,6 +930,10 @@ best_version() {
+ "${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" best_version "${eroot}" "${atom}"
+ fi
+ local retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ ${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' best_version '${READONLY_EPREFIX%:*}' '${atom}'"
++ retval=$?
++ fi
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+@@ -1166,6 +1174,10 @@ if ___eapi_has_master_repositories; then
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" master_repositories "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' master_repositories '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -1197,6 +1209,10 @@ if ___eapi_has_repository_path; then
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" get_repo_path "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' repository_path '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -1227,6 +1243,10 @@ if ___eapi_has_available_eclasses; then
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" available_eclasses "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' available_eclasses '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -1257,6 +1277,10 @@ if ___eapi_has_eclass_path; then
+ else
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}")
+ fi
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' eclass_path '${READONLY_EPREFIX%:*}' '${repository}' '${eclass}'")
++ retval=$?
++ fi
+ retval=$?
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+@@ -1288,6 +1312,10 @@ if ___eapi_has_license_path; then
+ else
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" license_path "${EROOT}" "${repository}" "${license}")
+ fi
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' license_path '${READONLY_EPREFIX%:*}' '${repository}' '${license}'")
++ retval=$?
++ fi
+ retval=$?
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
+index 1d37d0e..2b185ef 100644
+--- a/pym/_emerge/actions.py
++++ b/pym/_emerge/actions.py
+@@ -39,7 +39,7 @@ from portage import os
+ from portage import shutil
+ from portage import eapi_is_supported, _encodings, _unicode_decode
+ from portage.cache.cache_errors import CacheError
+-from portage.const import EPREFIX
++from portage.const import EPREFIX, BPREFIX
+ from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFAULT
+ from portage.const import SUPPORTED_BINPKG_FORMATS, TIMESTAMP_FORMAT
+ from portage.dbapi.dep_expand import dep_expand
+@@ -65,6 +65,7 @@ from portage.util.SlotObject import SlotObject
+ from portage.util._async.run_main_scheduler import run_main_scheduler
+ from portage.util._async.SchedulerInterface import SchedulerInterface
+ from portage.util._eventloop.global_event_loop import global_event_loop
++from portage.util._path import exists_raise_eaccess
+ from portage._global_updates import _global_updates
+ from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
+ from portage.localization import _
+@@ -2659,6 +2660,9 @@ def missing_sets_warning(root_config, missing_sets):
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
+ portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
++ portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
+ msg.append(" This usually means that '%s'" % \
+ (os.path.join(global_config_path, "sets/portage.conf"),))
+ msg.append(" is missing or corrupt.")
+diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
+index 76f1370..8f681d6 100644
+--- a/pym/_emerge/depgraph.py
++++ b/pym/_emerge/depgraph.py
+@@ -3180,23 +3180,24 @@ class depgraph(object):
+ edepend["HDEPEND"] = ""
+
+ deps = (
+- (depend_root, edepend["DEPEND"],
++ (depend_root, "DEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_depend_deps),
+ ignored=ignore_depend_deps)),
+- (self._frozen_config._running_root.root, edepend["HDEPEND"],
++ (self._frozen_config._running_root.root, "HDEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_hdepend_deps),
+ ignored=ignore_hdepend_deps)),
+- (myroot, edepend["RDEPEND"],
++ (myroot, "RDEPEND",
+ self._priority(runtime=True)),
+- (myroot, edepend["PDEPEND"],
++ (myroot, "PDEPEND",
+ self._priority(runtime_post=True))
+ )
+
+ debug = "--debug" in self._frozen_config.myopts
+
+- for dep_root, dep_string, dep_priority in deps:
++ for dep_root, dep_type, dep_priority in deps:
++ dep_string = edepend[dep_type]
+ if not dep_string:
+ continue
+ if debug:
+@@ -3234,7 +3235,7 @@ class depgraph(object):
+
+ try:
+ dep_string = list(self._queue_disjunctive_deps(
+- pkg, dep_root, dep_priority, dep_string))
++ pkg, dep_root, dep_priority, dep_string, dep_type))
+ except portage.exception.InvalidDependString as e:
+ if pkg.installed:
+ self._dynamic_config._masked_installed.add(pkg)
+@@ -3249,14 +3250,14 @@ class depgraph(object):
+
+ if not self._add_pkg_dep_string(
+ pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied):
++ allow_unsatisfied, dep_type):
+ return 0
+
+ self._dynamic_config._traversed_pkg_deps.add(pkg)
+ return 1
+
+ def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied):
++ allow_unsatisfied, dep_type=None):
+ _autounmask_backup = self._dynamic_config._autounmask
+ if dep_priority.optional or dep_priority.ignored:
+ # Temporarily disable autounmask for deps that
+@@ -3265,7 +3266,7 @@ class depgraph(object):
+ try:
+ return self._wrapped_add_pkg_dep_string(
+ pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied)
++ allow_unsatisfied, dep_type)
+ finally:
+ self._dynamic_config._autounmask = _autounmask_backup
+
+@@ -3301,7 +3302,7 @@ class depgraph(object):
+ not slot_operator_rebuild
+
+ def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
+- dep_string, allow_unsatisfied):
++ dep_string, allow_unsatisfied, dep_type=None):
+ if isinstance(pkg.depth, int):
+ depth = pkg.depth + 1
+ else:
+@@ -3325,7 +3326,7 @@ class depgraph(object):
+ try:
+ selected_atoms = self._select_atoms(dep_root,
+ dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
+- strict=strict, priority=dep_priority)
++ strict=strict, priority=dep_priority, dep_type=dep_type)
+ except portage.exception.InvalidDependString:
+ if pkg.installed:
+ self._dynamic_config._masked_installed.add(pkg)
+@@ -3623,7 +3624,7 @@ class depgraph(object):
+ child_pkgs.sort()
+ yield (atom, child_pkgs[-1])
+
+- def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct):
++ def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
+ """
+ Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
+ Yields non-disjunctive deps. Raises InvalidDependString when
+@@ -3632,33 +3633,33 @@ class depgraph(object):
+ for x in dep_struct:
+ if isinstance(x, list):
+ if x and x[0] == "||":
+- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
++ self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
+ else:
+ for y in self._queue_disjunctive_deps(
+- pkg, dep_root, dep_priority, x):
++ pkg, dep_root, dep_priority, x, dep_type):
+ yield y
+ else:
+ # Note: Eventually this will check for PROPERTIES=virtual
+ # or whatever other metadata gets implemented for this
+ # purpose.
+ if x.cp.startswith('virtual/'):
+- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
++ self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
+ else:
+ yield x
+
+- def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct):
++ def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
+ self._dynamic_config._dep_disjunctive_stack.append(
+- (pkg, dep_root, dep_priority, dep_struct))
++ (pkg, dep_root, dep_priority, dep_struct, dep_type))
+
+ def _pop_disjunction(self, allow_unsatisfied):
+ """
+ Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to
+ populate self._dynamic_config._dep_stack.
+ """
+- pkg, dep_root, dep_priority, dep_struct = \
++ pkg, dep_root, dep_priority, dep_struct, dep_type = \
+ self._dynamic_config._dep_disjunctive_stack.pop()
+ if not self._add_pkg_dep_string(
+- pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied):
++ pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied, dep_type):
+ return 0
+ return 1
+
+@@ -4511,7 +4512,7 @@ class depgraph(object):
+ return self._select_atoms_highest_available(*pargs, **kwargs)
+
+ def _select_atoms_highest_available(self, root, depstring,
+- myuse=None, parent=None, strict=True, trees=None, priority=None):
++ myuse=None, parent=None, strict=True, trees=None, priority=None, dep_type=None):
+ """This will raise InvalidDependString if necessary. If trees is
+ None then self._dynamic_config._filtered_trees is used."""
+
+@@ -4534,6 +4535,13 @@ class depgraph(object):
+ pkgsettings = self._frozen_config.pkgsettings[root]
+ if trees is None:
+ trees = self._dynamic_config._filtered_trees
++
++ # this one is needed to guarantee good readonly root
++ # resolution display in the merge list. required since
++ # parent (below) can be None
++ trees[root]["disp_parent"] = parent
++
++
+ mytrees = trees[root]
+ atom_graph = digraph()
+ if True:
+@@ -4565,7 +4573,7 @@ class depgraph(object):
+
+ mycheck = portage.dep_check(depstring, None,
+ pkgsettings, myuse=myuse,
+- myroot=root, trees=trees)
++ myroot=root, trees=trees, dep_type=dep_type)
+ finally:
+ # restore state
+ self._dynamic_config._autounmask = _autounmask_backup
+@@ -4641,6 +4649,7 @@ class depgraph(object):
+ continue
+ node_stack.append((child_node, node, child_atom))
+
++ trees[root].pop("disp_parent")
+ return selected_atoms
+
+ def _expand_virt_from_graph(self, root, atom):
+diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
+index e993ce1..32a942c 100644
+--- a/pym/_emerge/resolver/output.py
++++ b/pym/_emerge/resolver/output.py
+@@ -22,11 +22,12 @@ from portage.localization import localized_size
+ from portage.package.ebuild.config import _get_feature_flags
+ from portage.package.ebuild._spawn_nofetch import spawn_nofetch
+ from portage.output import ( blue, colorize, create_color_func,
+- darkblue, darkgreen, green, nc_len, teal)
++ darkblue, darkgreen, green, nc_len, teal, yellow, turquoise)
+ bad = create_color_func("BAD")
+ from portage._sets.base import InternalPackageSet
+ from portage.util import writemsg_stdout
+ from portage.versions import best, cpv_getversion
++from portage.dep.dep_check import ro_selected
+
+ from _emerge.Blocker import Blocker
+ from _emerge.create_world_atom import create_world_atom
+@@ -563,6 +564,42 @@ class Display(object):
+ writemsg_stdout("%s\n" % (pkg,), noiselevel=-1)
+ return
+
++ def print_readonly_prefix(self):
++ """Performs the actual output printing for the readonly prefix
++ information stuff
++ """
++ out = sys.stdout
++
++ # print readonly selected packages
++ if len(ro_selected) > 0:
++ out.write("\n%s\n\n" % (darkgreen("Packages resolved from readonly installations:")))
++
++ ro_mismatch_warning = False
++ ro_dupcheck = []
++ for x in ro_selected:
++ tmp_type = x["type"].replace("END","")
++ while len(tmp_type) < 4:
++ tmp_type += " "
++ if x["parent"] and str(x["atom"]) not in ro_dupcheck:
++ out.write("[%s %s] %s %s %s (%s by %s)" % (teal("readonly"),
++ green(tmp_type), green(str(x["matches"][0])), yellow("from"),
++ blue(x["ro_root"]), turquoise(str(x["atom"])), green(x["parent"].cpv)))
++
++ ro_dupcheck.append(str(x["atom"]))
++
++ if x["host_mismatch"]:
++ ro_mismatch_warning = True
++ out.write(" %s\n" % (red("**")))
++ else:
++ out.write("\n")
++
++ if ro_mismatch_warning:
++ out.write("\n%s:" % (red("**")))
++ out.write(yellow(" WARNING: packages marked with ** have been resolved as a\n"))
++ out.write(yellow(" runtime dependency, but the CHOST variable for the parent\n"))
++ out.write(yellow(" and dependency package don't match. This could cause link\n"))
++ out.write(yellow(" errors. It is recommended to use RDEPEND READONLY_EPREFIX's\n"))
++ out.write(yellow(" only with matching CHOST portage instances.\n"))
+
+ def print_verbose(self, show_repos):
+ """Prints the verbose output to std_out
+@@ -913,6 +950,7 @@ class Display(object):
+ show_repos = self.quiet_repo_display and repoadd_set and repoadd_set != set(["0"])
+
+ # now finally print out the messages
++ self.print_readonly_prefix()
+ self.print_messages(show_repos)
+ self.print_blockers()
+ if self.conf.verbosity == 3:
+diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py
+index 2c9bf97..6a27842 100644
+--- a/pym/portage/_sets/__init__.py
++++ b/pym/portage/_sets/__init__.py
+@@ -21,6 +21,7 @@ from portage.const import _ENABLE_SET_CONFIG
+ from portage.exception import PackageSetNotFound
+ from portage.localization import _
+ from portage.util import writemsg_level
++from portage.util._path import exists_raise_eaccess
+ from portage.util.configparser import (SafeConfigParser,
+ NoOptionError, ParsingError, read_configs)
+
+@@ -281,6 +282,10 @@ def load_default_config(settings, trees):
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++
+ vcs_dirs = [_unicode_encode(x, encoding=_encodings['fs']) for x in VCS_DIRS]
+ def _getfiles():
+ for path, dirs, files in os.walk(os.path.join(global_config_path, "sets")):
+diff --git a/pym/portage/const.py b/pym/portage/const.py
+index a0ad1f9..4f14bc8 100644
+--- a/pym/portage/const.py
++++ b/pym/portage/const.py
+@@ -189,6 +189,7 @@ SUPPORTED_FEATURES = frozenset([
+ "notitles",
+ "parallel-fetch",
+ "parallel-install",
++ "prefix-chaining",
+ "prelink-checksums",
+ "preserve-libs",
+ "protect-owned",
+@@ -266,6 +267,11 @@ MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
+ #EPREFIX = ""
+ # END PREFIX LOCAL
+
++BPREFIX = EPREFIX
++
++# --prefix commandline arg always rules, ends up in os.environ["EPREFIX"]
++if "EPREFIX" in os.environ:
++ os.environ["PORTAGE_OVERRIDE_EPREFIX"] = os.environ["EPREFIX"]
+ # pick up EPREFIX from the environment if set
+ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
+ EPREFIX = os.environ["PORTAGE_OVERRIDE_EPREFIX"]
+diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
+index 0006bc5..2ea5f16 100644
+--- a/pym/portage/dbapi/vartree.py
++++ b/pym/portage/dbapi/vartree.py
+@@ -194,8 +194,19 @@ class vardbapi(dbapi):
+ self._counter_path = os.path.join(self._eroot,
+ CACHE_PATH, "counter")
+
+- self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
+- os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry"))
++ plibreg_path = os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry")
++
++ if vartree:
++ self._kill_eprefix = vartree._kill_eprefix
++ else:
++ self._kill_eprefix = False
++
++ if self._kill_eprefix:
++ self._aux_cache_filename = self._aux_cache_filename.replace(EPREFIX, "")
++ self._counter_path = self._counter_path.replace(EPREFIX, "")
++ plibreg_path = plibreg_path.replace(EPREFIX, "")
++
++ self._plib_registry = PreservedLibsRegistry(settings["ROOT"], plibreg_path)
+ self._linkmap = LinkageMap(self)
+ chost = self.settings.get('CHOST')
+ if not chost:
+@@ -236,6 +247,9 @@ class vardbapi(dbapi):
+ # This is an optimized hotspot, so don't use unicode-wrapped
+ # os module and don't use os.path.join().
+ rValue = self._eroot + VDB_PATH + _os.sep + mykey
++ if self._kill_eprefix:
++ rValue = rValue.replace(EPREFIX, "")
++
+ if filename is not None:
+ # If filename is always relative, we can do just
+ # rValue += _os.sep + filename
+@@ -499,6 +513,9 @@ class vardbapi(dbapi):
+ returnme = []
+ basepath = os.path.join(self._eroot, VDB_PATH) + os.path.sep
+
++ if self._kill_eprefix:
++ basepath = os.path.join(self.root, basepath.replace(EPREFIX, ""))
++
+ if use_cache:
+ from portage import listdir
+ else:
+@@ -595,11 +612,17 @@ class vardbapi(dbapi):
+ del self.matchcache[mycat]
+ return list(self._iter_match(mydep,
+ self.cp_list(mydep.cp, use_cache=use_cache)))
++
++ _tmp_path = os.path.join(self._eroot, VDB_PATH, mycat)
++
++ if self._kill_eprefix:
++ _tmp_path = _tmp_path.replace(EPREFIX, "")
++
+ try:
+ if sys.hexversion >= 0x3030000:
+- curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime_ns
++ curmtime = os.stat(_tmp_path).st_mtime_ns
+ else:
+- curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime
++ curmtime = os.stat(_tmp_path).st_mtime
+ except (IOError, OSError):
+ curmtime=0
+
+@@ -1410,7 +1433,7 @@ class vardbapi(dbapi):
+ class vartree(object):
+ "this tree will scan a var/db/pkg database located at root (passed to init)"
+ def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
+- settings=None):
++ settings=None, kill_eprefix=None):
+
+ if settings is None:
+ settings = portage.settings
+@@ -1428,6 +1451,7 @@ class vartree(object):
+ " constructor is unused",
+ DeprecationWarning, stacklevel=2)
+
++ self._kill_eprefix = kill_eprefix
+ self.settings = settings
+ self.dbapi = vardbapi(settings=settings, vartree=self)
+ self.populated = 1
+diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
+index 35caecc..f0dca8a 100644
+--- a/pym/portage/dep/dep_check.py
++++ b/pym/portage/dep/dep_check.py
+@@ -255,6 +255,95 @@ class _dep_choice(SlotObject):
+ __slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
+ 'all_installed_slots')
+
++ro_trees={}
++ro_vartrees={}
++ro_selected=[]
++
++def dep_match_readonly_roots(settings, atom, dep_type, parent=None):
++ if len(ro_trees) < len(settings.readonly_prefixes):
++ # MDUFT: create additional vartrees for every readonly root here.
++ # the ro_vartrees instances are created below as they are needed to
++ # avoid reading vartrees of portage instances which aren't required
++ # while resolving this dependencies.
++ for type in ("DEPEND","RDEPEND", "PDEPEND"):
++ ro_trees[type] = []
++
++ for ro_root, ro_dep_types in settings.readonly_prefixes.items():
++ if type in ro_dep_types:
++ ro_trees[type].append(ro_root)
++
++ if len(ro_trees) == 0:
++ return []
++
++ matches = []
++
++ for ro_root in ro_trees[dep_type]:
++ if not ro_root in ro_vartrees:
++ # target_root=ro_root ok? or should it be the real target_root?
++ _tmp_settings = portage.config(config_root=ro_root, target_root=ro_root,
++ config_incrementals=portage.const.INCREMENTALS)
++
++ ro_vartrees[ro_root] = portage.vartree(root=ro_root,
++ categories=_tmp_settings.categories,
++ settings=_tmp_settings, kill_eprefix=True)
++
++ ro_matches = ro_vartrees[ro_root].dbapi.match(atom)
++
++ if ro_matches:
++ ro_host_mismatch = False
++ if dep_type is "RDEPEND":
++ # we need to assure binary compatability, so it needs to be
++ # the same CHOST! But how? for now i cannot do anything...
++ if parent and parent.metadata["CHOST"] != ro_vartrees[ro_root].settings.get("CHOST", ""):
++ # provocate a big fat warning in the list of external packages.
++ ro_host_mismatch = True
++ pass
++
++ matches.append({ "ro_root": ro_root, "atom": atom, "matches": ro_matches,
++ "type": dep_type, "parent": parent, "host_mismatch": ro_host_mismatch })
++
++ return matches
++
++def dep_wordreduce_readonly(reduced, unreduced, settings, dep_type, parent):
++ for mypos, token in enumerate(unreduced):
++ # recurse if it's a list.
++ if isinstance(reduced[mypos], list):
++ reduced[mypos] = dep_wordreduce_readonly(reduced[mypos],
++ unreduced[mypos], settings, dep_type, parent)
++
++ # do nothing if it's satisfied already.
++ elif not reduced[mypos]:
++ ro_matches = dep_match_readonly_roots(settings, unreduced[mypos], dep_type, parent)
++
++ if ro_matches:
++ # TODO: select a match if there are more than one?
++ # for now, the first match is taken...
++ ro_selected.append(ro_matches[0])
++ reduced[mypos] = True
++
++ return reduced
++
++# this may be better placed somewhere else, but i put it here for now, to
++# keep all functions in the patch on one big heap.
++def readonly_pathmatch_any(settings, path):
++ path = path.lstrip('/')
++ # first try locally, and match that if it exists.
++ if os.path.exists(os.path.join(EPREFIX,path)):
++ return os.path.join(EPREFIX,path)
++
++ # after that try all readonly roots where DEPEND is allowed. this makes
++ # sure that executing binaries is possible from there.
++ for ro_root, ro_deps in settings.readonly_roots.items():
++ if "DEPEND" in ro_deps:
++ print(" --- checking %s --- " % (os.path.join(ro_root,path)))
++ if os.path.exists(os.path.join(ro_root,path)):
++ return os.path.join(ro_root,path)
++ break
++
++ # as a fallback make the string the same as it was originally.
++ # even though this path doesn't exist.
++ return os.path.join(EPREFIX,path)
++
+ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
+ """
+ Takes an unreduced and reduced deplist and removes satisfied dependencies.
+@@ -643,7 +732,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
+ assert(False) # This point should not be reachable
+
+ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+- use_cache=1, use_binaries=0, myroot=None, trees=None):
++ use_cache=1, use_binaries=0, myroot=None, trees=None, dep_type=None):
+ """
+ Takes a depend string, parses it, and selects atoms.
+ The myroot parameter is unused (use mysettings['EROOT'] instead).
+@@ -741,6 +830,14 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+ writemsg("mysplit: %s\n" % (mysplit), 1)
+ writemsg("mysplit2: %s\n" % (mysplit2), 1)
+
++ if dep_type is not None:
++ mysplit2=dep_wordreduce_readonly(unreduced=mysplit[:],
++ reduced=mysplit2, settings=mysettings,
++ dep_type=dep_type, parent=trees[myroot].get("disp_parent"))
++
++ writemsg("\n", 1)
++ writemsg("mysplit2 after readonly reduce: %s\n" % (mysplit2), 1)
++
+ selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
+ use_binaries=use_binaries, trees=trees)
+
+diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
+index 55b8c08..32e969e 100644
+--- a/pym/portage/package/ebuild/_config/LocationsManager.py
++++ b/pym/portage/package/ebuild/_config/LocationsManager.py
+@@ -307,6 +307,9 @@ class LocationsManager(object):
+ if portage.const.EPREFIX:
+ self.global_config_path = os.path.join(portage.const.EPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(self.global_config_path) and portage.const.BPREFIX:
++ self.global_config_path = os.path.join(portage.const.BPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
+
+ def set_port_dirs(self, portdir, portdir_overlay):
+ self.portdir = portdir
+diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
+index b5fb42e..8cac700 100644
+--- a/pym/portage/package/ebuild/config.py
++++ b/pym/portage/package/ebuild/config.py
+@@ -306,6 +306,7 @@ class config(object):
+ self.features = features_set(self)
+ self.features._features = copy.deepcopy(clone.features._features)
+ self._features_overrides = copy.deepcopy(clone._features_overrides)
++ self.readonly_prefixes = copy.deepcopy(clone.readonly_prefixes)
+
+ #Strictly speaking _license_manager is not immutable. Users need to ensure that
+ #extract_global_changes() is called right after __init__ (if at all).
+@@ -945,6 +946,63 @@ class config(object):
+
+ self._validate_commands()
+
++ # expand READONLY_EPREFIX to a list of all readonly portage instances
++ # all the way down to the last one. beware that ATM a deeper instance
++ # in the chain can provide more than the toplevel! this means that
++ # if you only inherit DEPENDS from one instance, that instance may
++ # inherit RDEPENDs from another one, making the top-level instance
++ # inherit RDEPENDs from there too - even if the intermediate prefix
++ # does not do this.
++ self.readonly_prefixes = {}
++ ro_cfg_root = config_root
++ ro_widest_depset = set(['DEPEND', 'RDEPEND', 'PDEPEND'])
++
++ while ro_cfg_root:
++ ro_make_conf_paths = [
++ os.path.join(ro_cfg_root, 'etc', 'make.conf'),
++ os.path.join(ro_cfg_root, MAKE_CONF_FILE)
++ ]
++ try:
++ if os.path.samefile(*ro_make_conf_paths):
++ ro_make_conf_paths.pop()
++ except OSError:
++ pass
++
++ ro_cfg_root = None
++ for ro_make_conf in ro_make_conf_paths:
++ if not os.path.exists(ro_make_conf):
++ continue
++
++ ro_cfg = getconfig(ro_make_conf, tolerant=True, allow_sourcing=True)
++ if not "READONLY_EPREFIX" in ro_cfg:
++ continue
++
++ if not ro_cfg["READONLY_EPREFIX"].find(":"):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s" % (ro_make_conf))
++
++ if ro_cfg_root is not None:
++ raise portage.exception.InvalidReadonlyERoot("ERROR: duplicate READONLY_EPREFIX in %s and %s" % tuple(ro_make_conf_paths))
++
++ (ro_cfg_root,ro_cfg_root_deps) = ro_cfg["READONLY_EPREFIX"].rsplit(":",1)
++
++ if not os.path.exists(ro_cfg_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s: %s does not exist!" % (ro_make_conf, ro_cfg_root))
++
++ if os.path.samefile(ro_cfg_root, config_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: cannot add this instance (%s) as READONLY_EPREFIX in %s." % (ro_cfg_root, ro_make_conf))
++
++ if ro_cfg_root in self.readonly_prefixes:
++ raise portage.exception.InvalidReadonlyERoot("ERROR: circular READONLY_EPREFIX's in %s. %s already checked for %s" % (ro_make_conf, ro_cfg_root, self.readonly_prefixes[ro_cfg_root]))
++
++ # intersect the widest depset with the current one to strip down
++ # the allowed dependency resolution to not be wider than the
++ # next higher one. this way we can prevent for a given prefix
++ # to resolve RDEPENDs from a prefix with a different CHOST that
++ # is a few levels deeper in the chain.
++ ro_widest_depset = set(ro_cfg_root_deps.split(",")) & ro_widest_depset
++ self.readonly_prefixes[ro_cfg_root] = ro_widest_depset
++ pass
++
+ for k in self._case_insensitive_vars:
+ if k in self:
+ self[k] = self[k].lower()
+@@ -2805,6 +2863,10 @@ class config(object):
+ if not eapi_exports_merge_type(eapi):
+ mydict.pop("MERGE_TYPE", None)
+
++ # populate with PORTAGE_READONLY_EPREFIXES
++ if self.readonly_prefixes and len(self.readonly_prefixes) > 0:
++ mydict["PORTAGE_READONLY_EPREFIXES"] = ':'.join(self.readonly_prefixes)
++
+ # Prefix variables are supported beginning with EAPI 3, or when
+ # force-prefix is in FEATURES, since older EAPIs would otherwise be
+ # useless with prefix configurations. This brings compatibility with
+diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
+index c6d6133..f914091 100644
+--- a/pym/portage/package/ebuild/doebuild.py
++++ b/pym/portage/package/ebuild/doebuild.py
+@@ -51,6 +51,7 @@ from portage import bsd_chflags, \
+ unmerge, _encodings, _os_merge, \
+ _shell_quote, _unicode_decode, _unicode_encode
+ from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \
++ GLOBAL_CONFIG_PATH, \
+ EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, PORTAGE_PYM_PACKAGES, EPREFIX, MACOSSANDBOX_PROFILE
+ from portage.data import portage_gid, portage_uid, secpass, \
+ uid, userpriv_groups
+@@ -72,6 +73,7 @@ from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
+ from portage.process import find_binary
+ from portage.util import ( apply_recursive_permissions,
+ apply_secpass_permissions,
++ getconfig,
+ noiselimit,
+ shlex_split,
+ varexpand,
+@@ -79,6 +81,7 @@ from portage.util import ( apply_recursive_permissions,
+ writemsg_stdout,
+ write_atomic
+ )
++from portage.util._path import exists_raise_eaccess
+ from portage.util.cpuinfo import get_cpu_count
+ from portage.util.lafilefixer import rewrite_lafile
+ from portage.util.compression_probe import _compressors
+@@ -241,8 +244,27 @@ def _doebuild_path(settings, eapi=None):
+
+ for x in portage_bin_path:
+ path.append(os.path.join(x, "ebuild-helpers"))
++
++ # PREFIX CHAINING: append default path for all prefixes involved
++ pfxs = [ eprefix ]
++ pfxs.extend(settings.readonly_prefixes)
++ for prefix in pfxs:
++ global_config_path = os.path.join(prefix, GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ make_globals_path = os.path.join(global_config_path, "make.globals")
++ if exists_raise_eaccess(make_globals_path):
++ expand_map = { "EPREFIX": prefix }
++ pxcfg = getconfig(make_globals_path, True, expand_map)
++ pxdefp = [x for x in pxcfg.get("DEFAULT_PATH", "").split(":") if x]
++ for x in pxdefp:
++ if x.startswith(prefix) and not x in path:
++ path.append(x)
++ else:
++ pxdefs = [prefix + "/usr/sbin", prefix + "/usr/bin", prefix + "/sbin", prefix + "/bin"]
++ path.extend(pxdefs)
++ # END PREFIX CHAINING
++
+ path.extend(prerootpath)
+- path.extend(defaultpath)
++ # path.extend(defaultpath) # PREFIX CHAINING appends the default path for involved prefixes above
+ path.extend(rootpath)
+ path.extend(extrapath)
+ # END PREFIX LOCAL
+diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
+index 265d0c9..2ec6ff4 100644
+--- a/pym/portage/package/ebuild/fetch.py
++++ b/pym/portage/package/ebuild/fetch.py
+@@ -43,6 +43,7 @@ from portage.output import colorize, EOutput
+ from portage.util import apply_recursive_permissions, \
+ apply_secpass_permissions, ensure_dirs, grabdict, shlex_split, \
+ varexpand, writemsg, writemsg_level, writemsg_stdout
++from portage.util._path import exists_raise_eaccess
+ from portage.process import spawn
+
+ _userpriv_spawn_kwargs = (
+@@ -874,6 +875,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
+ global_config_path = GLOBAL_CONFIG_PATH
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
+
+ missing_file_param = False
+diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
+index 3bccf6f..cacd637 100644
+--- a/pym/portage/sync/controller.py
++++ b/pym/portage/sync/controller.py
+@@ -94,19 +94,20 @@ class SyncManager(object):
+ self.module_controller = portage.sync.module_controller
+ self.module_names = self.module_controller.module_names
+ self.hooks = {}
+- for _dir in ["repo.postsync.d", "postsync.d"]:
+- postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+- portage.USER_CONFIG_PATH, _dir)
+- hooks = OrderedDict()
+- for filepath in util._recursive_file_list(postsync_dir):
+- name = filepath.split(postsync_dir)[1].lstrip(os.sep)
+- if os.access(filepath, os.X_OK):
+- hooks[filepath] = name
+- else:
+- writemsg_level(" %s %s hook: '%s' is not executable\n"
+- % (warn("*"), _dir, _unicode_decode(name),),
+- level=logging.WARN, noiselevel=2)
+- self.hooks[_dir] = hooks
++ for _confroot in [self.settings["PORTAGE_CONFIGROOT"], portage.const.BPREFIX]:
++ for _dir in ["repo.postsync.d", "postsync.d"]:
++ postsync_dir = os.path.join(_confroot,
++ portage.USER_CONFIG_PATH, _dir)
++ hooks = OrderedDict()
++ for filepath in util._recursive_file_list(postsync_dir):
++ name = filepath.split(postsync_dir)[1].lstrip(os.sep)
++ if os.access(filepath, os.X_OK):
++ hooks[filepath] = name
++ else:
++ writemsg_level(" %s %s hook: '%s' is not executable\n"
++ % (warn("*"), _dir, _unicode_decode(name),),
++ level=logging.WARN, noiselevel=2)
++ self.hooks[_dir] = hooks
+
+ def __getattr__(self, name):
+ if name == 'async':
+diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
+index a063621..968fbd3 100644
+--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
++++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
+@@ -12,7 +12,7 @@ from portage import _os_merge
+ from portage import _unicode_decode
+ from portage import _unicode_encode
+ from portage.cache.mappings import slot_dict_class
+-from portage.const import EPREFIX
++from portage.const import BPREFIX
+ from portage.dep.soname.multilib_category import compute_multilib_category
+ from portage.exception import CommandNotFound, InvalidData
+ from portage.localization import _
+@@ -268,7 +268,7 @@ class LinkageMapELF(object):
+ continue
+ plibs.update((x, cpv) for x in items)
+ if plibs:
+- args = [os.path.join(EPREFIX or "/", "usr/bin/scanelf"), "-qF", "%a;%F;%S;%r;%n"]
++ args = [os.path.join(BPREFIX or "/", "usr/bin/scanelf"), "-qF", "%a;%F;%S;%r;%n"]
+ args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
+ for x in plibs)
+ try:
+--
+2.10.2
+
diff --git a/sys-apps/portage/portage-2.3.8.ebuild b/sys-apps/portage/portage-2.3.8.ebuild
index 60f0e15afe..07490db2e3 100644
--- a/sys-apps/portage/portage-2.3.8.ebuild
+++ b/sys-apps/portage/portage-2.3.8.ebuild
@@ -91,7 +91,7 @@ python_prepare_all() {
epatch "${FILESDIR}"/${PN}-2.2.28-ebuildshell-r1.patch # 155161
use prefix-chaining &&
- epatch "${FILESDIR}"/${PN}-2.3.5-prefix-chaining.patch
+ epatch "${FILESDIR}"/${PN}-2.3.8-prefix-chaining.patch
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2017-09-29 8:19 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2017-09-29 8:19 UTC (permalink / raw
To: gentoo-commits
commit: d9f6cf75e9fc38cb9f4cd7158e9ae19d39585332
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 26 14:05:54 2017 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Sep 26 14:05:54 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d9f6cf75
sys-apps/portage: bump ebuildshell patch
The change actually is for FEATURES=userpriv in main Gentoo Linux.
Package-Manager: Portage-2.3.10-prefix, Repoman-2.3.3
.../files/portage-2.2.01.18213-ebuildshell.patch | 105 --------------
.../files/portage-2.2.01.18980-ebuildshell.patch | 103 --------------
.../files/portage-2.2.01.19247-ebuildshell.patch | 105 --------------
.../files/portage-2.2.01.19981-ebuildshell.patch | 105 --------------
.../files/portage-2.2.01.20020-ebuildshell.patch | 137 ------------------
.../files/portage-2.2.01.20239-ebuildshell.patch | 148 -------------------
.../portage/files/portage-2.2.7-ebuildshell.patch | 158 ---------------------
.../portage/files/portage-2.2.8-ebuildshell.patch | 157 --------------------
...hell.patch => portage-2.3.10-ebuildshell.patch} | 37 ++---
sys-apps/portage/portage-2.3.10.ebuild | 2 +-
10 files changed, 21 insertions(+), 1036 deletions(-)
diff --git a/sys-apps/portage/files/portage-2.2.01.18213-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.01.18213-ebuildshell.patch
deleted file mode 100644
index 59e98af020..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.18213-ebuildshell.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-http://bugs.gentoo.org/show_bug.cgi?id=155161
-
---- portage/bin/ebuild.sh.orig 2010-12-15 11:12:12.466527126 +0100
-+++ portage/bin/ebuild.sh 2010-12-15 11:11:04.757062756 +0100
-@@ -59,7 +59,7 @@
- qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -1765,7 +1765,7 @@
- filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -1774,8 +1774,10 @@
- SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
- SANDBOX_LOG SANDBOX_ON"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! hasq --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-@@ -1805,7 +1807,11 @@
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! hasq --allow-extra-vars $* ; then
-+ if hasq --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! hasq --allow-extra-vars $* &&
-+ ! hasq --filter-for-subshell $* ; then
- filtered_vars="
- ${filtered_vars}
- ${PORTAGE_SAVED_READONLY_VARS}
-@@ -1936,6 +1942,56 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+call-ebuildshell() {
-+ if ! hasq ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ ) > ${T}/ebuildshell-environment
-+ chown portage:portage "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown portage:portage "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
diff --git a/sys-apps/portage/files/portage-2.2.01.18980-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.01.18980-ebuildshell.patch
deleted file mode 100644
index b8911f26a0..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.18980-ebuildshell.patch
+++ /dev/null
@@ -1,103 +0,0 @@
---- prefix-portage-2.2.01.18980/bin/ebuild.sh
-+++ prefix-portage-2.2.01.18980/bin/ebuild.sh
-@@ -59,7 +59,7 @@
- qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -1824,7 +1824,7 @@
- filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -1833,8 +1833,10 @@
- SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
- SANDBOX_LOG SANDBOX_ON"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-@@ -1864,7 +1866,11 @@
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- filtered_vars="
- ${filtered_vars}
- ${PORTAGE_SAVED_READONLY_VARS}
-@@ -1995,6 +2001,56 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
diff --git a/sys-apps/portage/files/portage-2.2.01.19247-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.01.19247-ebuildshell.patch
deleted file mode 100644
index 8392b12c82..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.19247-ebuildshell.patch
+++ /dev/null
@@ -1,105 +0,0 @@
---- bin/ebuild.sh.orig 2011-09-16 15:43:36 +0200
-+++ bin/ebuild.sh 2011-09-16 15:51:06 +0200
-@@ -95,7 +95,7 @@
- qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -466,6 +466,56 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
---- bin/phase-functions.sh.orig 2011-09-16 15:45:37 +0200
-+++ bin/phase-functions.sh 2011-09-16 15:50:10 +0200
-@@ -81,7 +81,7 @@
- filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -90,8 +90,10 @@
- SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
- SANDBOX_LOG SANDBOX_ON"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-@@ -121,7 +123,11 @@
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- filtered_vars="
- ${filtered_vars}
- ${PORTAGE_SAVED_READONLY_VARS}
diff --git a/sys-apps/portage/files/portage-2.2.01.19981-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.01.19981-ebuildshell.patch
deleted file mode 100644
index 63c9d54372..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.19981-ebuildshell.patch
+++ /dev/null
@@ -1,105 +0,0 @@
---- bin/ebuild.sh.orig 2011-09-16 15:43:36 +0200
-+++ bin/ebuild.sh 2011-09-16 15:51:06 +0200
-@@ -95,7 +95,7 @@
- qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -466,6 +466,56 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
---- bin/phase-functions.sh.orig 2011-09-16 15:45:37 +0200
-+++ bin/phase-functions.sh 2011-09-16 15:50:10 +0200
-@@ -81,7 +81,7 @@
- filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -90,8 +90,10 @@
- SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
- SANDBOX_LOG SANDBOX_ON"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-@@ -121,7 +123,11 @@
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- filtered_vars="
- ${filtered_vars}
- ${PORTAGE_SAVED_READONLY_VARS}
diff --git a/sys-apps/portage/files/portage-2.2.01.20020-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.01.20020-ebuildshell.patch
deleted file mode 100644
index 03eaa24893..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.20020-ebuildshell.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-# HG changeset patch
-# User Fabian Groffen <grobian@gentoo.org>
-# Date 1324637719 -3600
-# Node ID d70f677c2c1293d45e51a7f0e3b97b5e2b2900e7
-# Parent e7a44acf78b8678781b5d24a90d96d1a53601b41
-https://bugs.gentoo.org/155161
-
-FEATURES=ebuildshell emerge xxxxx
-
-results in an interactive shell for each function portage calls from the
-ebuild, where all functionality is available as in the ebuild
-(src_unpack, epatch, etc.). This allows for convenient debugging of
-ebuild issues.
-
-diff -r e7a44acf78b8 -r d70f677c2c12 bin/ebuild.sh
---- a/bin/ebuild.sh Fri Dec 23 11:24:27 2011 +0100
-+++ b/bin/ebuild.sh Fri Dec 23 11:55:19 2011 +0100
-@@ -82,7 +82,7 @@
- qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -453,6 +453,56 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
-diff -r e7a44acf78b8 -r d70f677c2c12 bin/phase-functions.sh
---- a/bin/phase-functions.sh Fri Dec 23 11:24:27 2011 +0100
-+++ b/bin/phase-functions.sh Fri Dec 23 11:55:19 2011 +0100
-@@ -84,7 +84,7 @@
- filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -95,8 +95,10 @@
- # Untrusted due to possible application of package renames to binpkgs
- local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-@@ -126,7 +128,11 @@
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- if [ "${EMERGE_FROM}" = binary ] ; then
- # preserve additional variables from build time,
- # while excluding untrusted variables
-diff -r e7a44acf78b8 -r d70f677c2c12 man/make.conf.5
---- a/man/make.conf.5 Fri Dec 23 11:24:27 2011 +0100
-+++ b/man/make.conf.5 Fri Dec 23 11:55:19 2011 +0100
-@@ -287,6 +287,12 @@
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `exit 1` to terminate the merge.
-+.TP
- .B fakeroot
- Enable fakeroot for the install and package phases when a non-root user runs
- the \fBebuild\fR(1) command.
diff --git a/sys-apps/portage/files/portage-2.2.01.20239-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.01.20239-ebuildshell.patch
deleted file mode 100644
index 9ccc1e5b18..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.20239-ebuildshell.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-# HG changeset patch
-# User Michael Haubenwallner <haubi@gentoo.org>
-# Date 1330634734 -3600
-# Node ID 6780ee2ddb337bbd8b4b2681615de7e78e6fb8c1
-# Parent 04da3d4d44af4fd2096316f8e1bbb7a998011040
-https://bugs.gentoo.org/155161
-
-FEATURES=ebuildshell emerge xxxxx
-
-results in an interactive shell for each function portage calls from the
-ebuild, where all functionality is available as in the ebuild
-(src_unpack, epatch, etc.). This allows for convenient debugging of
-ebuild issues.
-
-diff -r 04da3d4d44af -r 6780ee2ddb33 bin/ebuild.sh
---- a/bin/ebuild.sh Thu Mar 01 21:31:12 2012 +0100
-+++ b/bin/ebuild.sh Thu Mar 01 21:45:34 2012 +0100
-@@ -82,7 +82,7 @@
- qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -453,6 +453,56 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
-diff -r 04da3d4d44af -r 6780ee2ddb33 bin/phase-functions.sh
---- a/bin/phase-functions.sh Thu Mar 01 21:31:12 2012 +0100
-+++ b/bin/phase-functions.sh Thu Mar 01 21:45:34 2012 +0100
-@@ -84,7 +84,7 @@
- filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -95,8 +95,10 @@
- # Untrusted due to possible application of package renames to binpkgs
- local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-@@ -126,7 +128,11 @@
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- if [ "${EMERGE_FROM}" = binary ] ; then
- # preserve additional variables from build time,
- # while excluding untrusted variables
-diff -r 04da3d4d44af -r 6780ee2ddb33 man/make.conf.5
---- a/man/make.conf.5 Thu Mar 01 21:31:12 2012 +0100
-+++ b/man/make.conf.5 Thu Mar 01 21:45:34 2012 +0100
-@@ -297,6 +297,12 @@
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `exit 1` to terminate the merge.
-+.TP
- .B fakeroot
- Enable fakeroot for the install and package phases when a non-root user runs
- the \fBebuild\fR(1) command.
-diff -r 04da3d4d44af -r 6780ee2ddb33 pym/_emerge/AbstractEbuildProcess.py
---- a/pym/_emerge/AbstractEbuildProcess.py Thu Mar 01 21:31:12 2012 +0100
-+++ b/pym/_emerge/AbstractEbuildProcess.py Thu Mar 01 21:45:34 2012 +0100
-@@ -97,6 +97,7 @@
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
diff --git a/sys-apps/portage/files/portage-2.2.7-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.7-ebuildshell.patch
deleted file mode 100644
index 5c8cec81f7..0000000000
--- a/sys-apps/portage/files/portage-2.2.7-ebuildshell.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index 35f4b91..8e702d0 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -90,7 +90,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -467,6 +467,58 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | __filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p | grep -v extdebug$"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | __filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ echo "shopt -u extdebug"
-+ echo "trap - DEBUG"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=$BASHPID
- trap 'exit 1' SIGTERM
-diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
-index 711b721..5f3a8a2 100644
---- a/bin/phase-functions.sh
-+++ b/bin/phase-functions.sh
-@@ -87,7 +87,7 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
- __filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -98,12 +98,14 @@ __filter_readonly_variables() {
- # Untrusted due to possible application of package renames to binpkgs
- local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-- if ___eapi_has_prefix_variables; then
-+ if ___eapi_has_prefix_variables && ! has --filter-for-subshell $* ; then
- filtered_vars+=" ED EPREFIX EROOT"
- fi
-
-@@ -123,7 +125,11 @@ __filter_readonly_variables() {
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- if [ "${EMERGE_FROM}" = binary ] ; then
- # preserve additional variables from build time,
- # while excluding untrusted variables
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index ab9b44e..45903e3 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -345,6 +345,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `exit 1` to terminate the merge.
-+.TP
- .B fakeroot
- Enable fakeroot for the install and package phases when a non-root user runs
- the \fBebuild\fR(1) command.
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 31127f4..73031d0 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -136,6 +136,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 214ede4..725a7d0 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -100,7 +100,7 @@ SUPPORTED_FEATURES = frozenset([
- "collision-protect", "compress-build-logs", "compressdebug",
- "compress-index", "config-protect-if-modified",
- "digest", "distcc", "distcc-pump", "distlocks",
-- "downgrade-backup", "ebuild-locks", "fakeroot",
-+ "downgrade-backup", "ebuildshell", "ebuild-locks", "fakeroot",
- "fail-clean", "force-mirror", "force-prefix", "getbinpkg",
- "installsources", "ipc-sandbox",
- "keeptemp", "keepwork", "fixlafiles", "lmirror",
diff --git a/sys-apps/portage/files/portage-2.2.8-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.8-ebuildshell.patch
deleted file mode 100644
index 82219eb7f9..0000000000
--- a/sys-apps/portage/files/portage-2.2.8-ebuildshell.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index 35f4b91..8e702d0 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -90,7 +90,7 @@
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -467,6 +467,58 @@
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ (
-+ umask 002
-+ (
-+ (
-+ set
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ export
-+ fi
-+ ) | __filter_readonly_variables --filter-for-subshell
-+ echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
-+ echo "export PS1='EBUILD ${PN} $1 \$ '"
-+ echo 'unset ENV'
-+ echo "type $1"
-+ echo "echo WANTED: $@"
-+ echo "trap '"
-+ echo "umask 002"
-+ echo "("
-+ echo " set"
-+ echo " declare -p"
-+ echo " declare -fp"
-+ echo " shopt -p | grep -v extdebug$"
-+ if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
-+ echo " export"
-+ fi
-+ echo -n ")"
-+ echo -n " | __filter_readonly_variables --filter-metadata"
-+ echo " > ${T}/ebuildshell-environment-outcome' 0"
-+ echo "shopt -u extdebug"
-+ echo "trap - DEBUG"
-+ ) > ${T}/ebuildshell-environment
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment" &>/dev/null
-+ )
-+
-+ rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
-+
-+ unset BASH_ENV
-+ env -i ${BASH} --rcfile "${T}/ebuildshell-environment" -i || die
-+
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
-+ source "${T}/ebuildshell-environment-outcome" &>/dev/null
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
-index 711b721..5f3a8a2 100644
---- a/bin/phase-functions.sh
-+++ b/bin/phase-functions.sh
-@@ -87,7 +87,7 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
- __filter_readonly_variables() {
- local x filtered_vars
- local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
-- FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
-+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
- local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
- HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
- OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
-@@ -98,12 +98,14 @@ __filter_readonly_variables() {
- # Untrusted due to possible application of package renames to binpkgs
- local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
- local misc_garbage_vars="_portage_filter_opts"
-- filtered_vars="$readonly_bash_vars $bash_misc_vars
-- $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ filtered_vars="$readonly_bash_vars"
-+ if ! has --filter-for-subshell $* ; then
-+ filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
-+ fi
-
- # Don't filter/interfere with prefix variables unless they are
- # supported by the current EAPI.
-- if ___eapi_has_prefix_variables; then
-+ if ___eapi_has_prefix_variables && ! has --filter-for-subshell $* ; then
- filtered_vars+=" ED EPREFIX EROOT"
- fi
-
-@@ -123,7 +125,11 @@ __filter_readonly_variables() {
- LC_CTYPE LC_MESSAGES LC_MONETARY
- LC_NUMERIC LC_PAPER LC_TIME"
- fi
-- if ! has --allow-extra-vars $* ; then
-+ if has --filter-metadata $* ; then
-+ filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
-+ fi
-+ if ! has --allow-extra-vars $* &&
-+ ! has --filter-for-subshell $* ; then
- if [ "${EMERGE_FROM}" = binary ] ; then
- # preserve additional variables from build time,
- # while excluding untrusted variables
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index ab9b44e..45903e3 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -346,6 +346,12 @@
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `exit 1` to terminate the merge.
-+.TP
- .B fakeroot
- Enable fakeroot for the install and package phases when a non-root user runs
- the \fBebuild\fR(1) command.
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 31127f4..73031d0 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -136,6 +136,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 214ede4..725a7d0 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -139,6 +139,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
similarity index 92%
rename from sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
rename to sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
index 4674506d98..d0381a0696 100644
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
+++ b/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
@@ -1,22 +1,22 @@
-From 5e3167845640624f328969355db2e7f16cad2c83 Mon Sep 17 00:00:00 2001
+From 05a16e4c910f7dc053358d8519c6708d3a4b14ca Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Date: Wed, 6 Nov 2013 12:40:05 +0100
Subject: [PATCH] Add ebuildshell feature, bug#155161.
---
- bin/ebuild.sh | 143 ++++++++++++++++++++++++++++++++++-
+ bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
bin/filter-bash-environment.py | 57 ++++++++++----
bin/save-ebuild-env.sh | 2 +-
man/make.conf.5 | 6 ++
pym/_emerge/AbstractEbuildProcess.py | 1 +
pym/portage/const.py | 1 +
- 6 files changed, 192 insertions(+), 18 deletions(-)
+ 6 files changed, 195 insertions(+), 18 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f1586b2..d42ffd4 100755
+index a60a24d..b592372 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
-@@ -130,7 +130,7 @@ __qa_source() {
+@@ -121,7 +121,7 @@ __qa_source() {
__qa_call() {
local shopts=$(shopt) OLDIFS="$IFS"
local retval
@@ -25,7 +25,7 @@ index f1586b2..d42ffd4 100755
retval=$?
set +e
[[ $shopts != $(shopt) ]] &&
-@@ -537,6 +537,147 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
+@@ -533,6 +533,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
unset BIN_PATH BIN BODY FUNC_SRC
fi
@@ -146,6 +146,7 @@ index f1586b2..d42ffd4 100755
+
+ # pre-fill the history with "$@"
+ echo '"$@"' >> ~/.bash_history
++ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
+
+ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
+
@@ -161,10 +162,12 @@ index f1586b2..d42ffd4 100755
+ unalias -a
+ eval "${__ebuildshell_orig_aliases}"
+
-+ # Portage does whitelist readonly variables. If an ebuild defines
-+ # more readonly variables, their readonly attribute is removed.
-+ # If we ever want to preserve additional readonly variables across
-+ # phases, their names are in "${__ebuildshell_tmpf}.return-rovars".
++ # Portage has a whitelist of readonly variables: If an ebuild defines
++ # additional readonly variables, their readonly attribute is removed
++ # across ebuild phases. If we ever want to preserve the readonly
++ # attribute of additional ebuild-defined variables across phases,
++ # when returning from the ebuildshell their names are in
++ # "${__ebuildshell_tmpf}.return-rovars"
+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
+
+ return ${__ebuildshell_status}
@@ -174,7 +177,7 @@ index f1586b2..d42ffd4 100755
export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
trap 'exit 1' SIGTERM
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index a4cdc54..1c4ad58 100755
+index 029e491..0ddda7c 100755
--- a/bin/filter-bash-environment.py
+++ b/bin/filter-bash-environment.py
@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
@@ -294,7 +297,7 @@ index a4cdc54..1c4ad58 100755
+ re.compile(var_pattern), file_in, file_out, options)
file_out.flush()
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index ddef1fd..7264ced 100644
+index 4c6ca3f..bbb5780 100755
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -53,7 +53,7 @@ __save_ebuild_env() {
@@ -307,10 +310,10 @@ index ddef1fd..7264ced 100644
use usev useq has_version portageq \
best_version use_with use_enable register_die_hook \
diff --git a/man/make.conf.5 b/man/make.conf.5
-index 26bbf06..865ede9 100644
+index 653e8bc..2bb8e71 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
-@@ -382,6 +382,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
+@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
Use locks to ensure that unsandboxed ebuild phases never execute
concurrently. Also see \fIparallel\-install\fR.
.TP
@@ -336,10 +339,10 @@ index 8bd30a6..4ff78b4 100644
"interactive" not in self.settings.get("PROPERTIES", "").split():
null_fd = os.open('/dev/null', os.O_RDONLY)
diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 814d7f4..d84f9bf 100644
+index 172c5b1..a0ad1f9 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
-@@ -142,6 +142,7 @@ SUPPORTED_FEATURES = frozenset([
+@@ -160,6 +160,7 @@ SUPPORTED_FEATURES = frozenset([
"distlocks",
"downgrade-backup",
"ebuild-locks",
@@ -348,5 +351,5 @@ index 814d7f4..d84f9bf 100644
"fakeroot",
"fixlafiles",
--
-2.7.3
+2.10.2
diff --git a/sys-apps/portage/portage-2.3.10.ebuild b/sys-apps/portage/portage-2.3.10.ebuild
index 07490db2e3..9471ca7f8d 100644
--- a/sys-apps/portage/portage-2.3.10.ebuild
+++ b/sys-apps/portage/portage-2.3.10.ebuild
@@ -89,7 +89,7 @@ pkg_setup() {
python_prepare_all() {
distutils-r1_python_prepare_all
- epatch "${FILESDIR}"/${PN}-2.2.28-ebuildshell-r1.patch # 155161
+ epatch "${FILESDIR}"/${PN}-2.3.10-ebuildshell.patch # 155161
use prefix-chaining &&
epatch "${FILESDIR}"/${PN}-2.3.8-prefix-chaining.patch
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2017-12-29 13:06 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2017-12-29 13:06 UTC (permalink / raw
To: gentoo-commits
commit: 2790e4405fc6cbeb3e5e6e138f357d09cbc4b46f
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 29 13:06:43 2017 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Dec 29 13:06:43 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=2790e440
sys-apps/portage: add/update patch for prefix-chaining, bug #642456
Closes: https://bugs.gentoo.org/642456
Package-Manager: Portage-2.3.18-prefix, Repoman-2.3.6
.../portage-2.2.00.15801-prefix-chaining.patch | 693 ---------------------
.../portage-2.2.01.18826-aix-preservelibs.patch | 32 -
.../portage-2.2.01.19247-aix-preserve-libs.patch | 163 -----
...portage-2.2.10.1-brokentty-more-platforms.patch | 35 --
.../portage-2.2.10.1-case-insensitive-fs.patch | 375 -----------
...ortage-2.2.7-macho-relative-install_names.patch | 68 --
sys-apps/portage/files/portage-2.2.7-sandbox.patch | 21 -
.../files/portage-2.2.7-shebang-fixes.patch | 153 -----
....patch => portage-2.3.18-prefix-chaining.patch} | 182 +++---
.../files/portage-2.3.4-mj-safe-econf.patch | 39 --
sys-apps/portage/portage-2.3.18.ebuild | 2 +-
11 files changed, 80 insertions(+), 1683 deletions(-)
diff --git a/sys-apps/portage/files/portage-2.2.00.15801-prefix-chaining.patch b/sys-apps/portage/files/portage-2.2.00.15801-prefix-chaining.patch
deleted file mode 100644
index 01e5934448..0000000000
--- a/sys-apps/portage/files/portage-2.2.00.15801-prefix-chaining.patch
+++ /dev/null
@@ -1,693 +0,0 @@
-diff -ru prefix-portage-2.2.00.15801.orig/bin/ebuild.sh prefix-portage-2.2.00.15801/bin/ebuild.sh
---- prefix-portage-2.2.00.15801.orig/bin/ebuild.sh 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/bin/ebuild.sh 2010-03-11 10:38:21 +0100
-@@ -123,6 +123,83 @@
- # Unset some variables that break things.
- unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
-
-+if [[ -n "${PORTAGE_READONLY_EPREFIXES}" ]]; then
-+ new_PATH=${PATH}
-+
-+ prefixes="${PORTAGE_READONLY_EPREFIXES}:${EPREFIX}"
-+
-+ # build up a PATH for the current environment. the path has to
-+ # contain all the paths the start with $EPREFIX _first_, and
-+ # after that, all the others. We have to re-order the new_PATH,
-+ # so that EPREFIX paths move to the front. after that, the paths
-+ # of all parent prefixes are added, and finally, after that, the
-+ # paths not containing any prefix are added.
-+
-+ save_IFS=$IFS
-+ IFS=':'
-+ pth_pfx=
-+ pth_nopfx=
-+ for pth in ${new_PATH}; do
-+ IFS=$save_IFS
-+ if [[ "${pth#${EPREFIX}}" == "${pth}" ]]; then
-+ [[ ":${pth_nopfx}:" == *":${pth}:"* ]] && continue
-+ if [[ -z "${pth_nopfx}" ]]; then
-+ pth_nopfx="${pth}"
-+ else
-+ pth_nopfx="${pth_nopfx}:${pth}"
-+ fi
-+ else
-+ [[ ":${pth_pfx}:" == *":${pth}:"* ]] && continue
-+ if [[ -z "${pth_pfx}" ]]; then
-+ pth_pfx="${pth}"
-+ else
-+ pth_pfx="${pth_pfx}:${pth}"
-+ fi
-+ fi
-+ done
-+ IFS=$save_IFS
-+
-+ new_PATH=
-+
-+ save_IFS=$IFS
-+ IFS=':'
-+ for eroot in ${prefixes}; do
-+ IFS=$save_IFS
-+ if [[ -f ${eroot}/usr/share/portage/config/make.globals ]]; then
-+ # ok, there is a portage instance installed in this prefix,
-+ # so we can ask (politely) for the DEFAULT_PATH of it :)
-+
-+ defpath="$(. ${eroot}/etc/make.globals && echo $DEFAULT_PATH)"
-+ okpath=
-+ save_IFS2=$IFS
-+ IFS=':'
-+ for p in $defpath; do
-+ IFS=$save_IFS2
-+ # we have that one already...
-+ [[ ":${new_PATH}:" == *":$p:"* ]] && continue
-+ # we skip paths, that are outside our prefix ...
-+ [[ "${p#${eroot}}" == "${p}" ]] && continue
-+ if [[ -z "${okpath}" ]]; then
-+ okpath="${p}"
-+ else
-+ okpath="${okpath}:${p}"
-+ fi
-+ done
-+ IFS=$save_IFS2
-+
-+ new_PATH="${okpath}:${new_PATH}"
-+ else
-+ # no portage installed in this prefix. this means we have to
-+ # somehow fiddle together a sane path for that prefix for at
-+ # least the standard things to work.
-+ new_PATH="${eroot}/usr/bin:${eroot}/usr/sbin:${eroot}/bin:${eroot}/sbin:${new_PATH}"
-+ fi
-+ done
-+ IFS=$save_IFS
-+
-+ export PATH=${pth_pfx}:$new_PATH:${pth_nopfx}
-+fi
-+
- source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null
-
- [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
-@@ -1988,7 +2065,11 @@
-
- #PATH=$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
- # PREFIX: same notes apply as at the top of this file
-- PATH="$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}"
-+ #PATH="$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}${DEFAULT_PATH}${ROOTPATH:+:}$ROOTPATH${EXTRA_PATH:+:}${EXTRA_PATH}"
-+ # PREFIX (with CHAINING!): why the heck not simply pre-pend the paths? hell,
-+ # this shot down prefix-chaining, and made me search a while...
-+ # PATH has been set up at the top of the file already.
-+ PATH="${ebuild_helpers_path}:${PATH}"
- unset _ebuild_helpers_path
-
- if hasq distcc $FEATURES ; then
-diff -ru prefix-portage-2.2.00.15801.orig/pym/_emerge/actions.py prefix-portage-2.2.00.15801/pym/_emerge/actions.py
---- prefix-portage-2.2.00.15801.orig/pym/_emerge/actions.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/_emerge/actions.py 2010-03-11 10:38:21 +0100
-@@ -1783,8 +1783,9 @@
- "control (contains %s).\n!!! Aborting rsync sync.\n") % \
- (myportdir, vcs_dir), level=logging.ERROR, noiselevel=-1)
- return 1
-- if not os.path.exists(EPREFIX + "/usr/bin/rsync"):
-- print("!!! " + EPREFIX + "/usr/bin/rsync does not exist, so rsync support is disabled.")
-+ rsync_bin = portage.readonly_pathmatch_any(settings, "/usr/bin/rsync")
-+ if not os.path.exists(rsync_bin):
-+ print("!!! rsync binary does not exist, so rsync support is disabled.")
- print("!!! Type \"emerge net-misc/rsync\" to enable rsync support.")
- sys.exit(1)
- mytimeout=180
-@@ -1957,7 +1958,7 @@
- if mytimestamp != 0 and "--quiet" not in myopts:
- print(">>> Checking server timestamp ...")
-
-- rsynccommand = [EPREFIX + "/usr/bin/rsync"] + rsync_opts + extra_rsync_opts
-+ rsynccommand = [rsync_bin] + rsync_opts + extra_rsync_opts
-
- if "--debug" in myopts:
- print(rsynccommand)
-@@ -2108,8 +2109,9 @@
- out.eerror(line)
- sys.exit(exitcode)
- elif syncuri[:6]=="cvs://":
-- if not os.path.exists(EPREFIX + "/usr/bin/cvs"):
-- print("!!! " + EPREFIX + "/usr/bin/cvs does not exist, so CVS support is disabled.")
-+ cvs_bin = portage.readonly_pathmatch_any(settings, "/usr/bin/cvs")
-+ if not os.path.exists(cvs_bin):
-+ print("!!! cvs binary does not exist, so CVS support is disabled.")
- print("!!! Type \"emerge dev-util/cvs\" to enable CVS support.")
- sys.exit(1)
- cvsroot=syncuri[6:]
-@@ -2128,7 +2130,7 @@
- "!!! existing '%s' directory; exiting.\n" % myportdir)
- sys.exit(1)
- del e
-- if portage.spawn("cd "+cvsdir+"; cvs -z0 -d "+cvsroot+" co -P gentoo-x86",settings,free=1):
-+ if portage.spawn("cd "+cvsdir+"; "+cvs_bin+" -z0 -d "+cvsroot+" co -P gentoo-x86",settings,free=1):
- print("!!! cvs checkout error; exiting.")
- sys.exit(1)
- os.rename(os.path.join(cvsdir, "gentoo-x86"), myportdir)
-@@ -2136,15 +2138,16 @@
- #cvs update
- print(">>> Starting cvs update with "+syncuri+"...")
- retval = portage.process.spawn_bash(
-- "cd %s; cvs -z0 -q update -dP" % \
-- (portage._shell_quote(myportdir),), **spawn_kwargs)
-+ "cd %s; %s -z0 -q update -dP" % \
-+ (portage._shell_quote(myportdir),cvs_bin), **spawn_kwargs)
- if retval != os.EX_OK:
- sys.exit(retval)
- dosyncuri = syncuri
- elif syncuri[:11]=="svn+http://" or syncuri[:6]=="svn://" or syncuri[:12]=="svn+https://":
- # Gentoo Prefix hardcoded SVN support
-- if not os.path.exists(EPREFIX + "/usr/bin/svn"):
-- print("!!! " + EPREFIX + "/usr/bin/svn does not exist, so SVN support is disabled.")
-+ svn_bin = portage.readonly_pathmatch_any(settings, "/usr/bin/svn")
-+ if not os.path.exists(svn_bin):
-+ print("!!! svn binary does not exist, so SVN support is disabled.")
- print("!!! Type \"emerge dev-util/subversion\" to enable SVN support.")
- sys.exit(1)
- svndir=os.path.dirname(myportdir)
-@@ -2171,7 +2174,7 @@
- else:
- #svn update
- print(">>> Starting svn update...")
-- retval = portage.spawn("cd '%s'; svn update" % myportdir, \
-+ retval = portage.spawn("cd '%s'; %s update" % (myportdir,svn_bin), \
- settings, free=1)
- if retval != os.EX_OK:
- sys.exit(retval)
-diff -ru prefix-portage-2.2.00.15801.orig/pym/_emerge/depgraph.py prefix-portage-2.2.00.15801/pym/_emerge/depgraph.py
---- prefix-portage-2.2.00.15801.orig/pym/_emerge/depgraph.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/_emerge/depgraph.py 2010-03-11 10:39:49 +0100
-@@ -17,6 +17,7 @@
- from portage.dbapi import dbapi
- from portage.dbapi.dep_expand import dep_expand
- from portage.dep import Atom
-+from portage.dep.dep_check import ro_selected
- from portage.output import bold, blue, colorize, create_color_func, darkblue, \
- darkgreen, green, nc_len, red, teal, turquoise, yellow
- bad = create_color_func("BAD")
-@@ -1143,14 +1144,14 @@
- edepend["DEPEND"] = ""
-
- deps = (
-- (bdeps_root, edepend["DEPEND"],
-+ (bdeps_root, "DEPEND",
- self._priority(buildtime=(not bdeps_optional),
- optional=bdeps_optional),
- pkg.built),
-- (myroot, edepend["RDEPEND"],
-+ (myroot, "RDEPEND",
- self._priority(runtime=True),
- False),
-- (myroot, edepend["PDEPEND"],
-+ (myroot, "PDEPEND",
- self._priority(runtime_post=True),
- False)
- )
-@@ -1161,7 +1162,8 @@
- if not strict:
- portage.dep._dep_check_strict = False
-
-- for dep_root, dep_string, dep_priority, ignore_blockers in deps:
-+ for dep_root, dep_type, dep_priority, ignore_blockers in deps:
-+ dep_string = edepend[dep_type]
- if not dep_string:
- continue
- if debug:
-@@ -1180,7 +1182,7 @@
- uselist=pkg.use.enabled))
-
- dep_string = list(self._queue_disjunctive_deps(
-- pkg, dep_root, dep_priority, dep_string))
-+ pkg, dep_root, dep_priority, dep_string, dep_type))
-
- except portage.exception.InvalidDependString as e:
- if pkg.installed:
-@@ -1196,7 +1198,7 @@
-
- if not self._add_pkg_dep_string(
- pkg, dep_root, dep_priority, dep_string,
-- allow_unsatisfied, ignore_blockers=ignore_blockers):
-+ allow_unsatisfied, ignore_blockers=ignore_blockers, dep_type=dep_type):
- return 0
-
- except portage.exception.AmbiguousPackageName as e:
-@@ -1224,7 +1226,7 @@
- return 1
-
- def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
-- allow_unsatisfied, ignore_blockers=False):
-+ allow_unsatisfied, ignore_blockers=False, dep_type=None):
- depth = pkg.depth + 1
- debug = "--debug" in self._frozen_config.myopts
- strict = pkg.type_name != "installed"
-@@ -1240,7 +1242,7 @@
- try:
- selected_atoms = self._select_atoms(dep_root,
- dep_string, myuse=pkg.use.enabled, parent=pkg,
-- strict=strict, priority=dep_priority)
-+ strict=strict, priority=dep_priority, dep_type=dep_type)
- except portage.exception.InvalidDependString as e:
- show_invalid_depstring_notice(pkg, dep_string, str(e))
- del e
-@@ -1395,7 +1397,7 @@
- child_pkgs = atom_pkg_graph.child_nodes(atom)
- yield (atom, child_pkgs[0])
-
-- def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct):
-+ def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
- """
- Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
- Yields non-disjunctive deps. Raises InvalidDependString when
-@@ -1406,11 +1408,11 @@
- x = dep_struct[i]
- if isinstance(x, list):
- for y in self._queue_disjunctive_deps(
-- pkg, dep_root, dep_priority, x):
-+ pkg, dep_root, dep_priority, x, dep_type):
- yield y
- elif x == "||":
- self._queue_disjunction(pkg, dep_root, dep_priority,
-- [ x, dep_struct[ i + 1 ] ] )
-+ [ x, dep_struct[ i + 1 ] ] , dep_type)
- i += 1
- else:
- try:
-@@ -1425,25 +1427,25 @@
- # purpose.
- if x.cp.startswith('virtual/'):
- self._queue_disjunction( pkg, dep_root,
-- dep_priority, [ str(x) ] )
-+ dep_priority, [ str(x) ] , dep_type)
- else:
- yield str(x)
- i += 1
-
-- def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct):
-+ def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
- self._dynamic_config._dep_disjunctive_stack.append(
-- (pkg, dep_root, dep_priority, dep_struct))
-+ (pkg, dep_root, dep_priority, dep_struct, dep_type))
-
- def _pop_disjunction(self, allow_unsatisfied):
- """
- Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to
- populate self._dynamic_config._dep_stack.
- """
-- pkg, dep_root, dep_priority, dep_struct = \
-+ pkg, dep_root, dep_priority, dep_struct, dep_type = \
- self._dynamic_config._dep_disjunctive_stack.pop()
- dep_string = portage.dep.paren_enclose(dep_struct)
- if not self._add_pkg_dep_string(
-- pkg, dep_root, dep_priority, dep_string, allow_unsatisfied):
-+ pkg, dep_root, dep_priority, dep_string, allow_unsatisfied, dep_type):
- return 0
- return 1
-
-@@ -2063,12 +2065,18 @@
- return self._select_atoms_highest_available(*pargs, **kwargs)
-
- def _select_atoms_highest_available(self, root, depstring,
-- myuse=None, parent=None, strict=True, trees=None, priority=None):
-+ myuse=None, parent=None, strict=True, trees=None, priority=None, dep_type=None):
- """This will raise InvalidDependString if necessary. If trees is
- None then self._dynamic_config._filtered_trees is used."""
- pkgsettings = self._frozen_config.pkgsettings[root]
- if trees is None:
- trees = self._dynamic_config._filtered_trees
-+
-+ # this one is needed to guarantee good readonly root
-+ # resolution display in the merge list. required since
-+ # parent (below) can be None
-+ trees[root]["disp_parent"] = parent
-+
- atom_graph = digraph()
- if True:
- try:
-@@ -2081,7 +2089,7 @@
- portage.dep._dep_check_strict = False
- mycheck = portage.dep_check(depstring, None,
- pkgsettings, myuse=myuse,
-- myroot=root, trees=trees)
-+ myroot=root, trees=trees, dep_type=dep_type)
- finally:
- if parent is not None:
- trees[root].pop("parent")
-@@ -2116,6 +2124,7 @@
- selected_atoms[pkg] = [atom for atom in \
- atom_graph.child_nodes(node) if atom in chosen_atoms]
-
-+ trees[root].pop("disp_parent")
- return selected_atoms
-
- def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,
-@@ -4633,6 +4642,37 @@
- for x in blockers:
- print(x)
-
-+ # print readonly selected packages
-+ if len(ro_selected) > 0:
-+ out.write("\n%s\n\n" % (darkgreen("Packages resolved from readonly installations:")))
-+
-+ ro_mismatch_warning = False
-+ ro_dupcheck = []
-+ for x in ro_selected:
-+ tmp_type = x["type"].replace("END","")
-+ while len(tmp_type) < 4:
-+ tmp_type += " "
-+ if str(x["atom"]) not in ro_dupcheck:
-+ out.write("[%s %s] %s %s %s (%s by %s)" % (teal("readonly"),
-+ green(tmp_type), green(str(x["matches"][0])), yellow("from"),
-+ blue(x["ro_root"]), turquoise(str(x["atom"])), green(x["parent"].cpv)))
-+
-+ ro_dupcheck.append(str(x["atom"]))
-+
-+ if x["host_mismatch"]:
-+ ro_mismatch_warning = True
-+ out.write(" %s\n" % (red("**")))
-+ else:
-+ out.write("\n")
-+
-+ if ro_mismatch_warning:
-+ out.write("\n%s:" % (red("**")))
-+ out.write(yellow(" WARNING: packages marked with ** have been resolved as a\n"))
-+ out.write(yellow(" runtime dependency, but the CHOST variable for the parent\n"))
-+ out.write(yellow(" and dependency package don't match. This could cause link\n"))
-+ out.write(yellow(" errors. It is recommended to use RDEPEND READONLY_EPREFIX's\n"))
-+ out.write(yellow(" only with matching CHOST portage instances.\n"))
-+
- if verbosity == 3:
- print()
- print(counters)
-diff -ru prefix-portage-2.2.00.15801.orig/pym/portage/__init__.py prefix-portage-2.2.00.15801/pym/portage/__init__.py
---- prefix-portage-2.2.00.15801.orig/pym/portage/__init__.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/portage/__init__.py 2010-03-11 10:40:37 +0100
-@@ -85,7 +85,7 @@
- 'portage.dep:best_match_to_list,dep_getcpv,dep_getkey,' + \
- 'flatten,get_operator,isjustname,isspecific,isvalidatom,' + \
- 'match_from_list,match_to_list',
-- 'portage.dep.dep_check:dep_check,dep_eval,dep_wordreduce,dep_zapdeps',
-+ 'portage.dep.dep_check:dep_check,dep_eval,dep_wordreduce,dep_zapdeps,dep_wordreduce_readonly',
- 'portage.eclass_cache',
- 'portage.env.loaders',
- 'portage.exception',
-diff -ru prefix-portage-2.2.00.15801.orig/pym/portage/dbapi/vartree.py prefix-portage-2.2.00.15801/pym/portage/dbapi/vartree.py
---- prefix-portage-2.2.00.15801.orig/pym/portage/dbapi/vartree.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/portage/dbapi/vartree.py 2010-03-11 10:38:21 +0100
-@@ -1837,9 +1837,20 @@
- self._counter_path = os.path.join(root,
- CACHE_PATH, "counter")
-
-+ plibreg_path = os.path.join(self.root, PRIVATE_PATH, "preserved_libs_registry")
-+
-+ if vartree:
-+ self._kill_eprefix = vartree._kill_eprefix
-+ else:
-+ self._kill_eprefix = False
-+
-+ if self._kill_eprefix:
-+ self._aux_cache_filename = os.path.join(self.root, self._aux_cache_filename.replace(EPREFIX, ""))
-+ self._counter_path = os.path.join(self.root, self._counter_path.replace(EPREFIX, ""))
-+ plibreg_path = os.path.join(self.root, plibreg_path.replace(EPREFIX, ""))
-+
- try:
-- self.plib_registry = PreservedLibsRegistry(self.root,
-- os.path.join(self.root, PRIVATE_PATH, "preserved_libs_registry"))
-+ self.plib_registry = PreservedLibsRegistry(self.root, plibreg_path)
- except PermissionDenied:
- # apparently this user isn't allowed to access PRIVATE_PATH
- self.plib_registry = None
-@@ -1861,6 +1872,9 @@
- # This is an optimized hotspot, so don't use unicode-wrapped
- # os module and don't use os.path.join().
- rValue = self.root + _os.sep + VDB_PATH + _os.sep + mykey
-+ if self._kill_eprefix:
-+ rValue = rValue.replace(EPREFIX, "")
-+
- if filename is not None:
- # If filename is always relative, we can do just
- # rValue += _os.sep + filename
-@@ -2012,6 +2026,9 @@
- returnme = []
- basepath = os.path.join(self.root, VDB_PATH) + os.path.sep
-
-+ if self._kill_eprefix:
-+ basepath = os.path.join(self.root, basepath.replace(EPREFIX, ""))
-+
- if use_cache:
- from portage import listdir
- else:
-@@ -2102,7 +2119,12 @@
- return list(self._iter_match(mydep,
- self.cp_list(mydep.cp, use_cache=use_cache)))
- try:
-- curmtime = os.stat(os.path.join(self.root, VDB_PATH, mycat)).st_mtime
-+ _tmp_path = os.path.join(self.root, VDB_PATH, mycat)
-+
-+ if self._kill_eprefix:
-+ _tmp_path = os.path.join(self.root, _tmp_path.replace(EPREFIX, ""))
-+
-+ curmtime = os.stat(_tmp_path).st_mtime
- except (IOError, OSError):
- curmtime=0
-
-@@ -2689,7 +2711,7 @@
- class vartree(object):
- "this tree will scan a var/db/pkg database located at root (passed to init)"
- def __init__(self, root="/", virtual=None, clone=None, categories=None,
-- settings=None):
-+ settings=None, kill_eprefix=False):
- if clone:
- writemsg("vartree.__init__(): deprecated " + \
- "use of clone parameter\n", noiselevel=-1)
-@@ -2698,6 +2720,7 @@
- self.populated = 1
- from portage import config
- self.settings = config(clone=clone.settings)
-+ self._kill_eprefix = clone._kill_eprefix
- else:
- self.root = root[:]
- if settings is None:
-@@ -2705,6 +2728,7 @@
- self.settings = settings
- if categories is None:
- categories = settings.categories
-+ self._kill_eprefix=kill_eprefix
- self.dbapi = vardbapi(self.root, categories=categories,
- settings=settings, vartree=self)
- self.populated = 1
-@@ -2736,6 +2760,10 @@
- raise
- except Exception as e:
- mydir = os.path.join(self.root, VDB_PATH, mycpv)
-+
-+ if self._kill_eprefix:
-+ mydir = os.path.join(self.root, mydir.replace(EPREFIX, ""))
-+
- writemsg(_("\nParse Error reading PROVIDE and USE in '%s'\n") % mydir,
- noiselevel=-1)
- if mylines:
-diff -ru prefix-portage-2.2.00.15801.orig/pym/portage/dep/dep_check.py prefix-portage-2.2.00.15801/pym/portage/dep/dep_check.py
---- prefix-portage-2.2.00.15801.orig/pym/portage/dep/dep_check.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/portage/dep/dep_check.py 2010-03-11 10:40:52 +0100
-@@ -244,6 +244,95 @@
- return 0
- return 1
-
-+ro_trees={}
-+ro_vartrees={}
-+ro_selected=[]
-+
-+def dep_match_readonly_roots(settings, atom, dep_type, parent=None):
-+ if len(ro_trees) < len(settings.readonly_roots):
-+ # MDUFT: create additional vartrees for every readonly root here.
-+ # the ro_vartrees instances are created below as they are needed to
-+ # avoid reading vartrees of portage instances which aren't required
-+ # while resolving this dependencies.
-+ for type in ("DEPEND","RDEPEND", "PDEPEND"):
-+ ro_trees[type] = []
-+
-+ for ro_root, ro_dep_types in settings.readonly_roots.items():
-+ if type in ro_dep_types:
-+ ro_trees[type].append(ro_root)
-+
-+ if len(ro_trees) == 0:
-+ return []
-+
-+ matches = []
-+
-+ for ro_root in ro_trees[dep_type]:
-+ if not ro_vartrees.has_key(ro_root):
-+ # target_root=ro_root ok? or should it be the real target_root?
-+ _tmp_settings = portage.config(config_root=ro_root, target_root=ro_root,
-+ config_incrementals=portage.const.INCREMENTALS)
-+
-+ ro_vartrees[ro_root] = portage.vartree(root=ro_root,
-+ categories=_tmp_settings.categories,
-+ settings=_tmp_settings, kill_eprefix=True)
-+
-+ ro_matches = ro_vartrees[ro_root].dbapi.match(atom)
-+
-+ if ro_matches:
-+ ro_host_mismatch = False
-+ if dep_type is "RDEPEND":
-+ # we need to assure binary compatability, so it needs to be
-+ # the same CHOST! But how? for now i cannot do anything...
-+ if parent and parent.metadata["CHOST"] != ro_vartrees[ro_root].settings.get("CHOST", ""):
-+ # provocate a big fat warning in the list of external packages.
-+ ro_host_mismatch = True
-+ pass
-+
-+ matches.append({ "ro_root": ro_root, "atom": atom, "matches": ro_matches,
-+ "type": dep_type, "parent": parent, "host_mismatch": ro_host_mismatch })
-+
-+ return matches
-+
-+def dep_wordreduce_readonly(reduced, unreduced, settings, dep_type, parent):
-+ for mypos, token in enumerate(unreduced):
-+ # recurse if it's a list.
-+ if isinstance(reduced[mypos], list):
-+ reduced[mypos] = dep_wordreduce_readonly(reduced[mypos],
-+ unreduced[mypos], settings, dep_type, parent)
-+ # do nothing if it's satisfied already.
-+ elif not reduced[mypos]:
-+ ro_matches = dep_match_readonly_roots(settings, unreduced[mypos], dep_type, parent)
-+
-+ if ro_matches:
-+ # TODO: select a match if there are more than one?
-+ # for now, the first match is taken...
-+ ro_selected.append(ro_matches[0])
-+ reduced[mypos] = True
-+
-+ return reduced
-+
-+# this may be better placed somewhere else, but i put it here for now, to
-+# keep all functions in the patch on one big heap.
-+def readonly_pathmatch_any(settings, path):
-+ path = path.lstrip('/')
-+ # first try locally, and match that if it exists.
-+ if os.path.exists(os.path.join(EPREFIX,path)):
-+ return os.path.join(EPREFIX,path)
-+
-+ # after that try all readonly roots where DEPEND is allowed. this makes
-+ # sure that executing binaries is possible from there.
-+ for ro_root, ro_deps in settings.readonly_roots.items():
-+ if "DEPEND" in ro_deps:
-+ print(" --- checking %s --- " % (os.path.join(ro_root,path)))
-+ if os.path.exists(os.path.join(ro_root,path)):
-+ return os.path.join(ro_root,path)
-+ break
-+
-+ # as a fallback make the string the same as it was originally.
-+ # even though this path doesn't exist.
-+ return os.path.join(EPREFIX,path)
-+
-+
- def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
- """
- Takes an unreduced and reduced deplist and removes satisfied dependencies.
-@@ -501,7 +590,7 @@
- assert(False) # This point should not be reachable
-
- def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
-- use_cache=1, use_binaries=0, myroot="/", trees=None):
-+ use_cache=1, use_binaries=0, myroot="/", trees=None , dep_type=None):
- """Takes a depend string and parses the condition."""
- edebug = mysettings.get("PORTAGE_DEBUG", None) == "1"
- #check_config_instance(mysettings)
-@@ -579,6 +668,14 @@
- writemsg("mysplit: %s\n" % (mysplit), 1)
- writemsg("mysplit2: %s\n" % (mysplit2), 1)
-
-+ if dep_type is not None:
-+ mysplit2=dep_wordreduce_readonly(unreduced=mysplit[:],
-+ reduced=mysplit2, settings=mysettings,
-+ dep_type=dep_type, parent=trees[myroot].get("disp_parent"))
-+
-+ writemsg("\n", 1)
-+ writemsg("mysplit2 after readonly reduce: %s\n" % (mysplit2), 1)
-+
- try:
- selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
- use_binaries=use_binaries, trees=trees)
-diff -ru prefix-portage-2.2.00.15801.orig/pym/portage/exception.py prefix-portage-2.2.00.15801/pym/portage/exception.py
---- prefix-portage-2.2.00.15801.orig/pym/portage/exception.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/portage/exception.py 2010-03-11 10:38:21 +0100
-@@ -128,3 +128,6 @@
- class UntrustedSignature(SignatureException):
- """Signature was not certified to the desired security level"""
-
-+class InvalidReadonlyERoot(PortageException):
-+ """Readonly EROOT definition string in make.conf invalid."""
-+
-diff -ru prefix-portage-2.2.00.15801.orig/pym/portage/package/ebuild/config.py prefix-portage-2.2.00.15801/pym/portage/package/ebuild/config.py
---- prefix-portage-2.2.00.15801.orig/pym/portage/package/ebuild/config.py 2010-03-11 10:39:16 +0100
-+++ prefix-portage-2.2.00.15801/pym/portage/package/ebuild/config.py 2010-03-11 10:38:21 +0100
-@@ -427,6 +427,7 @@
- self.prevmaskdict = copy.deepcopy(clone.prevmaskdict)
- self.pprovideddict = copy.deepcopy(clone.pprovideddict)
- self.features = copy.deepcopy(clone.features)
-+ self.readonly_roots = copy.deepcopy(clone.readonly_roots)
-
- self._accept_license = copy.deepcopy(clone._accept_license)
- self._plicensedict = copy.deepcopy(clone._plicensedict)
-@@ -1017,6 +1018,50 @@
- _validate_cache_for_unsupported_eapis = False
- _glep_55_enabled = True
-
-+ # expand READONLY_EPREFIX to a list of all readonly portage instances
-+ # all the way down to the last one. beware that ATM a deeper instance
-+ # in the chain can provide more than the toplevel! this means that
-+ # if you only inherit DEPENDS from one instance, that instance may
-+ # inherit RDEPENDs from another one, making the top-level instance
-+ # inherit RDEPENDs from there too - even if the intermediate prefix
-+ # does not do this.
-+ self.readonly_roots = {}
-+ my_ro_current_instance = config_root
-+ my_ro_widest_depset = set(['DEPEND', 'RDEPEND', 'PDEPEND'])
-+
-+ while True:
-+ my_ro_current_make_conf_file = os.path.join(my_ro_current_instance,MAKE_CONF_FILE.lstrip(os.path.sep))
-+
-+ if os.path.exists(my_ro_current_make_conf_file):
-+ my_ro_cfg = getconfig(my_ro_current_make_conf_file, tolerant=1)
-+
-+ if my_ro_cfg.has_key("READONLY_EPREFIX"):
-+ if not my_ro_cfg["READONLY_EPREFIX"].find(":"):
-+ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s" % (my_ro_current_make_conf_file))
-+
-+ (my_ro_cfg_root,my_ro_cfg_root_deps) = my_ro_cfg["READONLY_EPREFIX"].rsplit(":",1)
-+
-+ if not os.path.exists(my_ro_cfg_root):
-+ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s: path does not exist!" % (my_ro_current_instance))
-+
-+ if self.readonly_roots.has_key(my_ro_cfg_root):
-+ raise portage.exception.InvalidReadonlyERoot("ERROR: circular READONLY_EPREFIX's in %s. %s already checked for %s" % (my_ro_current_make_conf_file, my_ro_cfg_root, self.readonly_roots[my_ro_cfg_root]))
-+
-+ if my_ro_cfg_root == config_root:
-+ raise portage.exception.InvalidReadonlyERoot("ERROR: cannot add this instance as READONLY_EPREFIX in %s." % (my_ro_current_make_conf_file))
-+
-+ # intersect the widest depset with the current one to strip down
-+ # the allowed dependency resolution to not be wider than the
-+ # next higher one. this way we can prevent for a given prefix
-+ # to resolve RDEPENDs from a prefix with a different CHOST that
-+ # is a few levels deeper in the chain.
-+ my_ro_widest_depset = set(my_ro_cfg_root_deps.split(",")) & my_ro_widest_depset
-+ self.readonly_roots[my_ro_cfg_root] = my_ro_widest_depset
-+ my_ro_current_instance = my_ro_cfg_root
-+ continue
-+
-+ break
-+
- for k in self._case_insensitive_vars:
- if k in self:
- self[k] = self[k].lower()
-@@ -2574,6 +2619,10 @@
- if eapi not in ("0", "1", "2", "3", "3_pre2"):
- mydict.pop("AA", None)
-
-+ # populate with PORTAGE_READONLY_EPREFIXES
-+ if self.readonly_roots and len(self.readonly_roots) > 0:
-+ mydict["PORTAGE_READONLY_EPREFIXES"] = ':'.join(self.readonly_roots)
-+
- # Prefix variables are supported starting with EAPI 3.
- # but during transition, we just support them anywhere
- #if phase == 'depend' or eapi in (None, "0", "1", "2"):
diff --git a/sys-apps/portage/files/portage-2.2.01.18826-aix-preservelibs.patch b/sys-apps/portage/files/portage-2.2.01.18826-aix-preservelibs.patch
deleted file mode 100644
index 002f11ce42..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.18826-aix-preservelibs.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Need to list executables in NEEDED.XCOFF.1 too for preserve-libs.
-
-Do not prepend filenames with '.' twice when calculating the preserve-lib
-helper-filenames. Can't say which commit triggers this problem, as this
-did work before.
---- bin/misc-functions.sh.orig 2011-06-16 17:15:47 +0200
-+++ bin/misc-functions.sh 2011-06-16 17:17:13 +0200
-@@ -1178,7 +1178,9 @@
- fi
- prev_FILE=${FILE}
-
-- [[ " ${FLAGS} " == *" SHROBJ "* ]] || continue
-+ # shared objects have both EXEC and SHROBJ flags,
-+ # while executables have EXEC flag only.
-+ [[ " ${FLAGS} " == *" EXEC "* ]] || continue
-
- # Make sure we disallow insecure RUNPATH's
- # Don't want paths that point to the tree where the package was built
---- pym/portage/util/_dyn_libs/LinkageMapXCoff.py.orig 2011-06-17 11:26:45 +0200
-+++ pym/portage/util/_dyn_libs/LinkageMapXCoff.py 2011-06-17 11:32:13 +0200
-@@ -255,7 +255,11 @@
- def as_contentmember(obj):
- if obj.endswith("]"):
- if obj.find("/") >= 0:
-+ if obj[obj.rfind("/")+1] == ".":
-+ return obj
- return obj[:obj.rfind("/")] + "/." + obj[obj.rfind("/")+1:]
-+ if obj[0] == ".":
-+ return obj
- return "." + obj
- return obj
-
diff --git a/sys-apps/portage/files/portage-2.2.01.19247-aix-preserve-libs.patch b/sys-apps/portage/files/portage-2.2.01.19247-aix-preserve-libs.patch
deleted file mode 100644
index ecc42fd07c..0000000000
--- a/sys-apps/portage/files/portage-2.2.01.19247-aix-preserve-libs.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-Drop code identical to and inheritable from LinkageMapELF.
-
-Update code that is duplicated from LinkageMapELF.
-
-Actually query information for /all/ preserved shared objects,
-not the last one only.
-Maybe the KeyError-problem is gone for AIX due to this fix,
-even if that workaround was inherited from LinkageMapELF.
-
-Deal with existing helper files in a binpkg created with 'quickpkg'.
-Eventually improve performance when creating helper files.
-
---- pym/portage/util/_dyn_libs/LinkageMapXCoff.py.orig 2011-09-14 16:02:34 +0200
-+++ pym/portage/util/_dyn_libs/LinkageMapXCoff.py 2011-09-14 16:34:43 +0200
-@@ -71,21 +71,10 @@
- # filesystem.
- return os.path.realpath(abs_path)
- # Return a tuple of the device and inode, as well as the basename,
-- # because of hardlinks the device and inode might be identical.
-+ # because of hardlinks (notably for the .libNAME[shr.o] helpers)
-+ # the device and inode might be identical.
- return (object_stat.st_dev, object_stat.st_ino, os.path.basename(abs_path.rstrip(os.sep)))
-
-- def file_exists(self):
-- """
-- Determine if the file for this key exists on the filesystem.
--
-- @rtype: Boolean
-- @return:
-- 1. True if the file exists.
-- 2. False if the file does not exist or is a broken symlink.
--
-- """
-- return isinstance(self._key, tuple)
--
- class _LibGraphNode(_ObjectKey):
- __slots__ = ("alt_paths",)
-
-@@ -175,10 +164,9 @@
- continue
- plibs.update((x, cpv) for x in items)
- if plibs:
-- for x in plibs:
-- args = [BASH_BINARY, "-c", ':'
-- + '; member="' + x + '"'
-- + '; archive=${member}'
-+ args = [BASH_BINARY , "-c" , ':'
-+ + '; for member in "$@"'
-+ + '; do archive=${member}'
- + '; if [[ ${member##*/} == .*"["*"]" ]]'
- + '; then member=${member%/.*}/${member##*/.}'
- + '; archive=${member%[*}'
-@@ -195,9 +183,21 @@
- + '; done'
- + '; [[ -n ${MEMBER} ]] && MEMBER="[${MEMBER}]"'
- + '; [[ " ${FLAGS} " == *" SHROBJ "* ]] && soname=${FILE##*/}${MEMBER} || soname='
-- + '; echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}}${MEMBER};${soname};${RUNPATH};${needed}"'
-- + '; [[ -z ${member} && -n ${MEMBER} ]] && echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}};${FILE##*/};;"'
-- ]
-+ + '; case ${member:+y}:${MEMBER:+y}'
-+ # member requested, member found: show shared archive member
-+ + ' in y:y) echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}}${MEMBER};${soname};${RUNPATH};${needed}"'
-+ # no member requested, member found: show archive
-+ + ' ;; :y) echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}};${FILE##*/};;"'
-+ # no member requested, no member found: show standalone shared object
-+ + ' ;; : ) echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}};${FILE##*/};${RUNPATH};${needed}"'
-+ # member requested, no member found: ignore archive replaced by standalone shared object
-+ + ' ;; y: )'
-+ + ' ;; esac'
-+ + '; done'
-+ , 'aixdll-query'
-+ ]
-+ args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
-+ for x in plibs)
- try:
- proc = subprocess.Popen(args, stdout=subprocess.PIPE)
- except EnvironmentError as e:
-@@ -228,17 +228,8 @@
- owner = plibs.pop(fields[1], None)
- lines.append((owner, "aixdll-query", ";".join(fields)))
- proc.wait()
-+ proc.stdout.close()
-
-- if plibs:
-- # Preserved libraries that did not appear in the bash
-- # aixdll-query code output. This is known to happen with
-- # statically linked libraries. Generate dummy lines for
-- # these, so we can assume that every preserved library has
-- # an entry in self._obj_properties. This is important in
-- # order to prevent findConsumers from raising an unwanted
-- # KeyError.
-- for x, cpv in plibs.items():
-- lines.append((cpv, "plibs", ";".join(['', x, '', '', ''])))
- # Share identical frozenset instances when available,
- # in order to conserve memory.
- frozensets = {}
-@@ -318,23 +309,4 @@
- soname_node.providers = tuple(set(soname_node.providers))
- soname_node.consumers = tuple(set(soname_node.consumers))
-
-- def getSoname(self, obj):
-- """
-- Return the soname associated with an object.
--
-- @param obj: absolute path to an object
-- @type obj: string (example: '/usr/bin/bar')
-- @rtype: string
-- @return: soname as a string
--
-- """
-- if not self._libs:
-- self.rebuild()
-- if isinstance(obj, self._ObjectKey):
-- obj_key = obj
-- if obj_key not in self._obj_properties:
-- raise KeyError("%s not in object list" % obj_key)
-- return self._obj_properties[obj_key].soname
-- if obj not in self._obj_key_cache:
-- raise KeyError("%s not in object list" % obj)
-- return self._obj_properties[self._obj_key_cache[obj]].soname
-+ pass
---- bin/misc-functions.sh.orig 2011-09-14 17:53:45 +0200
-+++ bin/misc-functions.sh 2011-09-14 18:21:01 +0200
-@@ -1297,7 +1297,7 @@
- else
- die "cannot find where to use 'ar' and 'strip' from"
- fi
-- local archives_members= archives=() chmod400files=()
-+ local archives_members= archives=() helperfiles=()
- local archive_member soname runpath needed archive contentmember
- while read archive_member; do
- archive_member=${archive_member#*;${EPREFIX}/} # drop "^type;EPREFIX/"
-@@ -1321,13 +1321,24 @@
- # portage does os.lstat() on merged files every now
- # and then, so keep stamp-files for archive members
- # around to get the preserve-libs feature working.
-- { echo "Please leave this file alone, it is an important helper"
-- echo "for portage to implement the 'preserve-libs' feature on AIX."
-- } > "${ED}${contentmember}" || die "cannot create ${contentmember}"
-- chmod400files[${#chmod400files[@]}]=${ED}${contentmember}
-+ helperfiles[${#helperfiles[@]}]=${ED}${contentmember}
- done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1
-- [[ ${#chmod400files[@]} == 0 ]] ||
-- chmod 0400 "${chmod400files[@]}" || die "cannot chmod ${chmod400files[@]}"
-+ if [[ ${#helperfiles[@]} > 0 ]]; then
-+ rm -f "${helperfiles[@]}" || die "cannot prune ${helperfiles[@]}"
-+ local f prev=
-+ for f in "${helperfiles[@]}"
-+ do
-+ if [[ -z ${prev} ]]; then
-+ { echo "Please leave this file alone, it is an important helper"
-+ echo "for portage to implement the 'preserve-libs' feature on AIX."
-+ } > "${f}" || die "cannot create ${f}"
-+ chmod 0400 "${f}" || die "cannot chmod ${f}"
-+ prev=${f}
-+ else
-+ ln "${prev}" "${f}" || die "cannot create hardlink ${f}"
-+ fi
-+ done
-+ fi
-
- local preservemembers libmetadir prunedirs=()
- local FILE MEMBER FLAGS
diff --git a/sys-apps/portage/files/portage-2.2.10.1-brokentty-more-platforms.patch b/sys-apps/portage/files/portage-2.2.10.1-brokentty-more-platforms.patch
deleted file mode 100644
index bd7ab7ffcb..0000000000
--- a/sys-apps/portage/files/portage-2.2.10.1-brokentty-more-platforms.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-https://gitweb.gentoo.org/proj/portage.git/commit/?h=prefix&id=9607fb432f1333774bf6994166e2fa7e96616b6d
-
-From 9556da42590eecaafe126473aff04c2cee59d833 Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
-Date: Thu, 18 Jun 2015 18:39:58 +0200
-Subject: [PATCH] disable openpty on more unices
-
----
- pym/portage/util/_pty.py | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/pym/portage/util/_pty.py b/pym/portage/util/_pty.py
-index 11c8b92..a92f575 100644
---- a/pym/portage/util/_pty.py
-+++ b/pym/portage/util/_pty.py
-@@ -9,12 +9,12 @@ from portage import os
- from portage.output import get_term_size, set_term_size
- from portage.util import writemsg
-
--# Disable the use of openpty on Solaris as it seems Python's openpty
--# implementation doesn't play nice on Solaris with Portage's
--# behaviour causing hangs/deadlocks.
-+# Disable the use of openpty on Solaris (and others) as it seems Python's
-+# openpty implementation doesn't play nice with Portage's behaviour,
-+# causing hangs/deadlocks.
- # Additional note for the future: on Interix, pipes do NOT work, so
- # _disable_openpty on Interix must *never* be True
--_disable_openpty = platform.system() in ("SunOS","FreeMiNT",)
-+_disable_openpty = platform.system() in ("AIX","FreeMiNT","HP-UX","SunOS",)
-
- _fbsd_test_pty = platform.system() == 'FreeBSD'
-
---
-2.0.5
-
diff --git a/sys-apps/portage/files/portage-2.2.10.1-case-insensitive-fs.patch b/sys-apps/portage/files/portage-2.2.10.1-case-insensitive-fs.patch
deleted file mode 100644
index 7f69cd64b5..0000000000
--- a/sys-apps/portage/files/portage-2.2.10.1-case-insensitive-fs.patch
+++ /dev/null
@@ -1,375 +0,0 @@
-From fc3e0fafac889586ad85b12f414bcd10d30d7021 Mon Sep 17 00:00:00 2001
-From: Zac Medico <zmedico@gentoo.org>
-Date: Thu, 2 Oct 2014 10:57:11 -0700
-Subject: [PATCH] FEATURES=case-insensitive-fs for bug #524236
-
-When case-insensitive-fs is enabled in FEATURES, the dblink.isowner
-method, _owners_db class, and ConfigProtect class will be
-case-insensitive. This causes the collision-protect and unmerge code
-to behave correctly for a case-insensitive file system. If the file
-system is case-insensitive but case-preserving, then case is preserved
-in the CONTENTS data of installed packages.
-
-X-Gentoo-Bug: 524236
-X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=524236
----
- bin/dispatch-conf | 8 +++++++-
- bin/etc-update | 14 +++++++++++---
- bin/portageq | 7 ++++---
- bin/quickpkg | 4 +++-
- man/make.conf.5 | 4 ++++
- pym/_emerge/depgraph.py | 4 +++-
- pym/portage/_global_updates.py | 4 +++-
- pym/portage/const.py | 1 +
- pym/portage/dbapi/vartree.py | 32 +++++++++++++++++++++++++++++++-
- pym/portage/update.py | 6 ++++--
- pym/portage/util/__init__.py | 10 +++++++++-
- 11 files changed, 80 insertions(+), 14 deletions(-)
-
-diff --git a/bin/dispatch-conf b/bin/dispatch-conf
-index fb0a8af..7946415 100755
---- a/bin/dispatch-conf
-+++ b/bin/dispatch-conf
-@@ -29,6 +29,10 @@ from portage.process import find_binary, spawn
- FIND_EXTANT_CONFIGS = "find '%s' %s -name '._cfg????_%s' ! -name '.*~' ! -iname '.*.bak' -print"
- DIFF_CONTENTS = "diff -Nu '%s' '%s'"
-
-+if "case-insensitive-fs" in portage.settings.features:
-+ FIND_EXTANT_CONFIGS = \
-+ FIND_EXTANT_CONFIGS.replace("-name '._cfg", "-iname '._cfg")
-+
- # We need a secure scratch dir and python does silly verbose errors on the use of tempnam
- oldmask = os.umask(0o077)
- SCRATCH_DIR = None
-@@ -144,7 +148,9 @@ class dispatch:
- protect_obj = portage.util.ConfigProtect(
- config_root, config_paths,
- portage.util.shlex_split(
-- portage.settings.get('CONFIG_PROTECT_MASK', '')))
-+ portage.settings.get('CONFIG_PROTECT_MASK', '')),
-+ case_insensitive = ("case-insensitive-fs"
-+ in portage.settings.features))
-
- def diff(file1, file2):
- return diffstatusoutput(DIFF_CONTENTS, file1, file2)
-diff --git a/bin/etc-update b/bin/etc-update
-index 1a99231..c27379b 100755
---- a/bin/etc-update
-+++ b/bin/etc-update
-@@ -67,6 +67,7 @@ scan() {
- mkdir "${TMP}"/files || die "Failed mkdir command!"
- count=0
- input=0
-+ local basename
- local find_opts
- local path
-
-@@ -75,13 +76,17 @@ scan() {
-
- if [[ ! -d ${path} ]] ; then
- [[ ! -f ${path} ]] && continue
-- local my_basename="${path##*/}"
-+ basename="${path##*/}"
- path="${path%/*}"
-- find_opts=( -maxdepth 1 -name "._cfg????_${my_basename}" )
-+ find_opts=( -maxdepth 1 )
- else
-+ basename=*
- # Do not traverse hidden directories such as .svn or .git.
-- find_opts=( -name '.*' -type d -prune -o -name '._cfg????_*' )
-+ find_opts=( -name '.*' -type d -prune -o )
- fi
-+ ${case_insensitive} && \
-+ find_opts+=( -iname ) || find_opts+=( -name )
-+ find_opts+=( "._cfg????_${basename}" )
- find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print )
-
- if [ ! -w "${path}" ] ; then
-@@ -623,6 +628,7 @@ ${SET_X} && set -x
- type -P portageq >/dev/null || die "missing portageq"
- portage_vars=(
- CONFIG_PROTECT{,_MASK}
-+ FEATURES
- PORTAGE_CONFIGROOT
- PORTAGE_INST_{G,U}ID
- PORTAGE_TMPDIR
-@@ -633,6 +639,8 @@ portage_vars=(
- eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "$(type -P portageq)" envvar -v ${portage_vars[@]})
- export PORTAGE_TMPDIR
- SCAN_PATHS=${*:-${CONFIG_PROTECT}}
-+[[ " ${FEATURES} " == *" case-insensitive-fs "* ]] && \
-+ case_insensitive=true || case_insensitive=false
-
- TMP="${PORTAGE_TMPDIR}/etc-update-$$"
- trap "die terminated" SIGTERM
-diff --git a/bin/portageq b/bin/portageq
-index 009f116..552cff6 100755
---- a/bin/portageq
-+++ b/bin/portageq
-@@ -379,8 +379,8 @@ def is_protected(argv):
- protect = portage.util.shlex_split(settings.get("CONFIG_PROTECT", ""))
- protect_mask = portage.util.shlex_split(
- settings.get("CONFIG_PROTECT_MASK", ""))
-- protect_obj = ConfigProtect(root, protect, protect_mask)
--
-+ protect_obj = ConfigProtect(root, protect, protect_mask,
-+ case_insensitive = ("case-insensitive-fs" in settings.features))
- if protect_obj.isprotected(f):
- return 0
- return 1
-@@ -414,7 +414,8 @@ def filter_protected(argv):
- protect = portage.util.shlex_split(settings.get("CONFIG_PROTECT", ""))
- protect_mask = portage.util.shlex_split(
- settings.get("CONFIG_PROTECT_MASK", ""))
-- protect_obj = ConfigProtect(root, protect, protect_mask)
-+ protect_obj = ConfigProtect(root, protect, protect_mask,
-+ case_insensitive = ("case-insensitive-fs" in settings.features))
-
- errors = 0
-
-diff --git a/bin/quickpkg b/bin/quickpkg
-index cf75791..4d6bc87 100755
---- a/bin/quickpkg
-+++ b/bin/quickpkg
-@@ -102,7 +102,9 @@ def quickpkg_atom(options, infos, arg, eout):
- if not include_config:
- confprot = ConfigProtect(eroot,
- shlex_split(settings.get("CONFIG_PROTECT", "")),
-- shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
-+ shlex_split(settings.get("CONFIG_PROTECT_MASK", "")),
-+ case_insensitive = ("case-insensitive-fs"
-+ in settings.features))
- def protect(filename):
- if not confprot.isprotected(filename):
- return False
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index 84e894b..7b7daa4 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -265,6 +265,10 @@ Build binary packages for just packages in the system set.
- Enable a special progress indicator when \fBemerge\fR(1) is calculating
- dependencies.
- .TP
-+.B case\-insensitive\-fs
-+Use case\-insensitive file name comparisions when merging and unmerging
-+files.
-+.TP
- .B ccache
- Enable portage support for the ccache package. If the ccache dir is not
- present in the user's environment, then portage will default to
-diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
-index 5180db5..cae8c32 100644
---- a/pym/_emerge/depgraph.py
-+++ b/pym/_emerge/depgraph.py
-@@ -7799,7 +7799,9 @@ class depgraph(object):
- settings = self._frozen_config.roots[root].settings
- protect_obj[root] = ConfigProtect(settings["EROOT"], \
- shlex_split(settings.get("CONFIG_PROTECT", "")),
-- shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
-+ shlex_split(settings.get("CONFIG_PROTECT_MASK", "")),
-+ case_insensitive = ("case-insensitive-fs"
-+ in settings.features))
-
- def write_changes(root, changes, file_to_write_to):
- file_contents = None
-diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py
-index 17dc080..bb39f7a 100644
---- a/pym/portage/_global_updates.py
-+++ b/pym/portage/_global_updates.py
-@@ -208,7 +208,9 @@ def _do_global_updates(trees, prev_mtimes, quiet=False, if_mtime_changed=True):
- update_config_files(root,
- shlex_split(mysettings.get("CONFIG_PROTECT", "")),
- shlex_split(mysettings.get("CONFIG_PROTECT_MASK", "")),
-- repo_map, match_callback=_config_repo_match)
-+ repo_map, match_callback = _config_repo_match,
-+ case_insensitive = "case-insensitive-fs"
-+ in mysettings.features)
-
- # The above global updates proceed quickly, so they
- # are considered a single mtimedb transaction.
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index acb90f9..5545a84 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -125,6 +125,7 @@ SUPPORTED_FEATURES = frozenset([
- "buildpkg",
- "buildsyspkg",
- "candy",
-+ "case-insensitive-fs",
- "ccache",
- "cgroup",
- "chflags",
-diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
-index b46ba0b..8a68f4e 100644
---- a/pym/portage/dbapi/vartree.py
-+++ b/pym/portage/dbapi/vartree.py
-@@ -1052,6 +1052,11 @@ class vardbapi(dbapi):
- def add(self, cpv):
- eroot_len = len(self._vardb._eroot)
- contents = self._vardb._dblink(cpv).getcontents()
-+
-+ if "case-insensitive-fs" in self._vardb.settings.features:
-+ contents = dict((k.lower(), v)
-+ for k, v in contents.items())
-+
- pkg_hash = self._hash_pkg(cpv)
- if not contents:
- # Empty path is a code used to represent empty contents.
-@@ -1189,6 +1194,8 @@ class vardbapi(dbapi):
- hash_pkg = owners_cache._hash_pkg
- hash_str = owners_cache._hash_str
- base_names = self._vardb._aux_cache["owners"]["base_names"]
-+ case_insensitive = "case-insensitive-fs" \
-+ in vardb.settings.features
-
- dblink_cache = {}
-
-@@ -1205,6 +1212,8 @@ class vardbapi(dbapi):
- while path_iter:
-
- path = path_iter.pop()
-+ if case_insensitive:
-+ path = path.lower()
- is_basename = os.sep != path[:1]
- if is_basename:
- name = path
-@@ -1236,6 +1245,8 @@ class vardbapi(dbapi):
-
- if is_basename:
- for p in dblink(cpv).getcontents():
-+ if case_insensitive:
-+ p = p.lower()
- if os.path.basename(p) == name:
- owners.append((cpv, p[len(root):]))
- else:
-@@ -1265,8 +1276,12 @@ class vardbapi(dbapi):
- if not path_list:
- return
-
-+ case_insensitive = "case-insensitive-fs" \
-+ in self._vardb.settings.features
- path_info_list = []
- for path in path_list:
-+ if case_insensitive:
-+ path = path.lower()
- is_basename = os.sep != path[:1]
- if is_basename:
- name = path
-@@ -1285,6 +1300,8 @@ class vardbapi(dbapi):
- for path, name, is_basename in path_info_list:
- if is_basename:
- for p in dblnk.getcontents():
-+ if case_insensitive:
-+ p = p.lower()
- if os.path.basename(p) == name:
- search_pkg.results.append((dblnk, p[len(root):]))
- else:
-@@ -1540,7 +1557,9 @@ class dblink(object):
- portage.util.shlex_split(
- self.settings.get("CONFIG_PROTECT", "")),
- portage.util.shlex_split(
-- self.settings.get("CONFIG_PROTECT_MASK", "")))
-+ self.settings.get("CONFIG_PROTECT_MASK", "")),
-+ case_insensitive = ("case-insensitive-fs"
-+ in self.settings.features))
-
- return self._protect_obj
-
-@@ -2762,7 +2781,16 @@ class dblink(object):
- filename.lstrip(os_filename_arg.path.sep)))
-
- pkgfiles = self.getcontents()
-+
-+ preserve_case = None
-+ if "case-insensitive-fs" in self.settings.features:
-+ destfile = destfile.lower()
-+ preserve_case = dict((k.lower(), k) for k in pkgfiles)
-+ pkgfiles = dict((k.lower(), v) for k, v in pkgfiles.items())
-+
- if pkgfiles and destfile in pkgfiles:
-+ if preserve_case is not None:
-+ return preserve_case[destfile]
- return destfile
- if pkgfiles:
- basename = os_filename_arg.path.basename(destfile)
-@@ -2855,6 +2883,8 @@ class dblink(object):
- for p_path in p_path_list:
- x = os_filename_arg.path.join(p_path, basename)
- if x in pkgfiles:
-+ if preserve_case is not None:
-+ return preserve_case[x]
- return x
-
- return False
-diff --git a/pym/portage/update.py b/pym/portage/update.py
-index df4e11b..7a71092 100644
---- a/pym/portage/update.py
-+++ b/pym/portage/update.py
-@@ -282,7 +282,8 @@ def parse_updates(mycontent):
- myupd.append(mysplit)
- return myupd, errors
-
--def update_config_files(config_root, protect, protect_mask, update_iter, match_callback = None):
-+def update_config_files(config_root, protect, protect_mask, update_iter,
-+ match_callback = None, case_insensitive = False):
- """Perform global updates on /etc/portage/package.*, /etc/portage/profile/package.*,
- /etc/portage/profile/packages and /etc/portage/sets.
- config_root - location of files to update
-@@ -406,7 +407,8 @@ def update_config_files(config_root, protect, protect_mask, update_iter, match_c
- sys.stdout.flush()
-
- protect_obj = ConfigProtect(
-- config_root, protect, protect_mask)
-+ config_root, protect, protect_mask,
-+ case_insensitive = case_insensitive)
- for x in update_files:
- updating_file = os.path.join(abs_user_config, x)
- if protect_obj.isprotected(updating_file):
-diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
-index 4105c19..707b001 100644
---- a/pym/portage/util/__init__.py
-+++ b/pym/portage/util/__init__.py
-@@ -1555,10 +1555,12 @@ class LazyItemsDict(UserDict):
- return result
-
- class ConfigProtect(object):
-- def __init__(self, myroot, protect_list, mask_list):
-+ def __init__(self, myroot, protect_list, mask_list,
-+ case_insensitive = False):
- self.myroot = myroot
- self.protect_list = protect_list
- self.mask_list = mask_list
-+ self.case_insensitive = case_insensitive
- self.updateprotect()
-
- def updateprotect(self):
-@@ -1572,6 +1574,8 @@ class ConfigProtect(object):
- for x in self.protect_list:
- ppath = normalize_path(
- os.path.join(self.myroot, x.lstrip(os.path.sep)))
-+ if self.case_insensitive:
-+ ppath = ppath.lower()
- try:
- if stat.S_ISDIR(os.stat(ppath).st_mode):
- self._dirs.add(ppath)
-@@ -1584,6 +1588,8 @@ class ConfigProtect(object):
- for x in self.mask_list:
- ppath = normalize_path(
- os.path.join(self.myroot, x.lstrip(os.path.sep)))
-+ if self.case_insensitive:
-+ ppath = ppath.lower()
- try:
- """Use lstat so that anything, even a broken symlink can be
- protected."""
-@@ -1604,6 +1610,8 @@ class ConfigProtect(object):
- masked = 0
- protected = 0
- sep = os.path.sep
-+ if self.case_insensitive:
-+ obj = obj.lower()
- for ppath in self.protect:
- if len(ppath) > masked and obj.startswith(ppath):
- if ppath in self._dirs:
---
-1.8.5.5
-
diff --git a/sys-apps/portage/files/portage-2.2.7-macho-relative-install_names.patch b/sys-apps/portage/files/portage-2.2.7-macho-relative-install_names.patch
deleted file mode 100644
index d38d966836..0000000000
--- a/sys-apps/portage/files/portage-2.2.7-macho-relative-install_names.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-commit e1fbd70801e93a5b77febc6c9e95ad43d0ecabbb
-Author: Fabian Groffen <grobian@gentoo.org>
-Date: Sun Dec 22 14:45:31 2013 +0100
-
- install_qa_check_macho: allow relative install_names
-
- relative install_names (@..../) will be used in binaries a lot, and if
- they are provided as such, there is nothing wrong with it. Since they
- disallow us to do any checks, we just do the least check we can do,
- which is for the install_name self-reference. We want to find the
- library that points to in the install image, if not, it must be wrong.
-
-diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
-index 129f7d3..83004df 100644
---- a/bin/misc-functions.sh
-+++ b/bin/misc-functions.sh
-@@ -1049,6 +1049,15 @@ install_qa_check_macho() {
- rm -f "${T}/mach-o.check"
- fi
-
-+ install_name_is_relative() {
-+ case $1 in
-+ "@executable_path/"*) return 0 ;;
-+ "@loader_path"/*) return 0 ;;
-+ "@rpath/"*) return 0 ;;
-+ *) return 1 ;;
-+ esac
-+ }
-+
- # While we generate the NEEDED files, check that we don't get kernel
- # traps at runtime because of broken install_names on Darwin.
- rm -f "${T}"/.install_name_check_failed
-@@ -1061,6 +1070,17 @@ install_qa_check_macho() {
- # See if the self-reference install_name points to an existing
- # and to be installed file. This usually is a symlink for the
- # major version.
-+ if install_name_is_relative ${install_name} ; then
-+ # try to locate the library in the installed image
-+ local inpath=${install_name#@*/}
-+ local libl
-+ for libl in $(find "${ED}" -name "${inpath##*/}") ; do
-+ if [[ ${libl} == */${inpath} ]] ; then
-+ install_name=/${libl#${D}}
-+ break
-+ fi
-+ done
-+ fi
- if [[ ! -e ${D}${install_name} ]] ; then
- eqawarn "QA Notice: invalid self-reference install_name ${install_name} in ${obj}"
- # remember we are in an implicit subshell, that's
-@@ -1077,7 +1097,7 @@ install_qa_check_macho() {
- elif [[ ${lib} == ${S}* ]] ; then
- eqawarn "QA Notice: install_name references \${S}: ${lib} in ${obj}"
- touch "${T}"/.install_name_check_failed
-- elif [[ ! -e ${lib} && ! -e ${D}${lib} && ${lib} != "@executable_path/"* && ${lib} != "@loader_path/"* ]] ; then
-+ elif ! install_name_is_relative ${lib} && [[ ! -e ${lib} && ! -e ${D}${lib} ]] ; then
- eqawarn "QA Notice: invalid reference to ${lib} in ${obj}"
- # remember we are in an implicit subshell, that's
- # why we touch a file here ... ideally we should be
-@@ -1086,7 +1106,7 @@ install_qa_check_macho() {
- fi
- done
-
-- # backwards compatability
-+ # backwards compatibility
- echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
- # what we use
- echo "${arch};${obj};${install_name};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.MACHO.3
diff --git a/sys-apps/portage/files/portage-2.2.7-sandbox.patch b/sys-apps/portage/files/portage-2.2.7-sandbox.patch
deleted file mode 100644
index 9797d3165b..0000000000
--- a/sys-apps/portage/files/portage-2.2.7-sandbox.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-candidate patch to be included in the next revision
-
-https://bugs.gentoo.org/show_bug.cgi?id=490016
-
-diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
-index 691ef97..7a000b1 100644
---- a/pym/portage/package/ebuild/doebuild.py
-+++ b/pym/portage/package/ebuild/doebuild.py
-@@ -1311,10 +1311,8 @@ def _spawn_actionmap(settings):
- nosandbox = ("sandbox" not in features and \
- "usersandbox" not in features)
-
-- if not portage.process.sandbox_capable:
-- nosandbox = True
--
-- if not portage.process.macossandbox_capable:
-+ if not (portage.process.sandbox_capable or \
-+ portage.process.macossandbox_capable):
- nosandbox = True
-
- sesandbox = settings.selinux_enabled() and \
diff --git a/sys-apps/portage/files/portage-2.2.7-shebang-fixes.patch b/sys-apps/portage/files/portage-2.2.7-shebang-fixes.patch
deleted file mode 100644
index afb00c15aa..0000000000
--- a/sys-apps/portage/files/portage-2.2.7-shebang-fixes.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-Hi Fabian,
-
-when /bin/bash is some bash-3.x, things break miserably:
-/tools/gentoo/buildslave/sauxz3-f_pfx-10.0/build/gentoo-prefix/usr/lib/portage/bin/eapi.sh: line 8: syntax error in conditional expression: unexpected token `('
-/tools/gentoo/buildslave/sauxz3-f_pfx-10.0/build/gentoo-prefix/usr/lib/portage/bin/eapi.sh: line 8: syntax error near `^(0'
-/tools/gentoo/buildslave/sauxz3-f_pfx-10.0/build/gentoo-prefix/usr/lib/portage/bin/eapi.sh: line 8: ` [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]'
-/tools/gentoo/buildslave/sauxz3-f_pfx-10.0/build/gentoo-prefix/usr/lib/portage/bin/ebuild-helpers/keepdir: line 7: ___eapi_has_prefix_variables: command not found
-
-There are still some scripts in 2.2.7 that need to get the shebangs fixed:
-$ git grep '#!/'
-
-Thanks!
-/haubi/
----
- bin/bashrc-functions.sh | 2 +-
- bin/eapi.sh | 2 +-
- bin/ebuild-helpers/doheader | 2 +-
- bin/ebuild-helpers/keepdir | 2 +-
- bin/ebuild-helpers/newins | 1 -
- bin/ebuild-helpers/xattr/install | 2 +-
- bin/helper-functions.sh | 2 +-
- bin/install.py | 2 +-
- bin/phase-functions.sh | 2 +-
- bin/phase-helpers.sh | 2 +-
- bin/xattr-helper.py | 2 +-
- misc/emerge-delta-webrsync | 2 +-
- 12 files changed, 11 insertions(+), 12 deletions(-)
-
-diff --git a/bin/bashrc-functions.sh b/bin/bashrc-functions.sh
-index 69a5eb9..1a92738 100644
---- a/bin/bashrc-functions.sh
-+++ b/bin/bashrc-functions.sh
-@@ -1,4 +1,4 @@
--#!@PREFIX_PORTAGE_BASH@
-+#!@PORTAGE_BASH@
- # Copyright 1999-2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/eapi.sh b/bin/eapi.sh
-index 623b89f..670f884 100644
---- a/bin/eapi.sh
-+++ b/bin/eapi.sh
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!@PORTAGE_BASH@
- # Copyright 2012 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
-index 3795365..5b6b169 100755
---- a/bin/ebuild-helpers/doheader
-+++ b/bin/ebuild-helpers/doheader
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!@PORTAGE_BASH@
- # Copyright 1999-2012 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir
-index bec2feb..7167981 100755
---- a/bin/ebuild-helpers/keepdir
-+++ b/bin/ebuild-helpers/keepdir
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!@PORTAGE_BASH@
- # Copyright 1999-2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
-index 26dd049..2638a38 100755
---- a/bin/ebuild-helpers/newins
-+++ b/bin/ebuild-helpers/newins
-@@ -1,5 +1,4 @@
- #!@PORTAGE_BASH@
--#!/bin/bash
- # Copyright 1999-2012 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
-index f51f621..b1d2315 100755
---- a/bin/ebuild-helpers/xattr/install
-+++ b/bin/ebuild-helpers/xattr/install
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!@PORTAGE_BASH@
- # Copyright 2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
-index c574612..864d5fe 100644
---- a/bin/helper-functions.sh
-+++ b/bin/helper-functions.sh
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!@PORTAGE_BASH@
- # Copyright 1999-2012 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/install.py b/bin/install.py
-index 2c6dfbe..9bd38c7 100755
---- a/bin/install.py
-+++ b/bin/install.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/python
-+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
-index 80e7cc6..4650e14 100644
---- a/bin/phase-functions.sh
-+++ b/bin/phase-functions.sh
-@@ -1,4 +1,4 @@
--#!@PREFIX_PORTAGE_BASH@
-+#!@PORTAGE_BASH@
- # Copyright 1999-2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
-index 12238c6..dc20991 100644
---- a/bin/phase-helpers.sh
-+++ b/bin/phase-helpers.sh
-@@ -1,4 +1,4 @@
--#!@PREFIX_PORTAGE_BASH@
-+#!@PORTAGE_BASH@
- # Copyright 1999-2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py
-index a85309f..d6cef4f 100755
---- a/bin/xattr-helper.py
-+++ b/bin/xattr-helper.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/python
-+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 2012-2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
-
-diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
-index b16982b..66e9275 100755
---- a/misc/emerge-delta-webrsync
-+++ b/misc/emerge-delta-webrsync
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!@PORTAGE_BASH@
- # Copyright 1999-2013 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
- # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
---
-1.8.1.5
-
-
-
diff --git a/sys-apps/portage/files/portage-2.3.5-prefix-chaining.patch b/sys-apps/portage/files/portage-2.3.18-prefix-chaining.patch
similarity index 87%
rename from sys-apps/portage/files/portage-2.3.5-prefix-chaining.patch
rename to sys-apps/portage/files/portage-2.3.18-prefix-chaining.patch
index fa6ee5f690..1c2537eb00 100644
--- a/sys-apps/portage/files/portage-2.3.5-prefix-chaining.patch
+++ b/sys-apps/portage/files/portage-2.3.18-prefix-chaining.patch
@@ -1,8 +1,10 @@
-From d5990d439a42a5195bf8b2f8df16da532674c3f2 Mon Sep 17 00:00:00 2001
+From: hanetzer@startmail.com
From: Michael Haubenwallner <haubi@gentoo.org>
Date: Thu, 23 Mar 2017 13:52:32 +0100
Subject: [PATCH] add prefix-chaining support
+updated for 2.3.18
+
---
bin/install-qa-check.d/05prefix | 30 ++++++-
bin/phase-helpers.sh | 28 ++++++
@@ -15,14 +17,12 @@ Subject: [PATCH] add prefix-chaining support
pym/portage/dep/dep_check.py | 99 +++++++++++++++++++++-
.../package/ebuild/_config/LocationsManager.py | 3 +
pym/portage/package/ebuild/config.py | 62 ++++++++++++++
- pym/portage/package/ebuild/doebuild.py | 25 +++++-
+ pym/portage/package/ebuild/doebuild.py | 24 +++++-
pym/portage/package/ebuild/fetch.py | 4 +
pym/portage/sync/controller.py | 27 +++---
pym/portage/util/_dyn_libs/LinkageMapELF.py | 4 +-
- 15 files changed, 376 insertions(+), 48 deletions(-)
+ 15 files changed, 376 insertions(+), 47 deletions(-)
-diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
-index 32561e2..0c11473 100644
--- a/bin/install-qa-check.d/05prefix
+++ b/bin/install-qa-check.d/05prefix
@@ -79,16 +79,42 @@ install_qa_check_prefix() {
@@ -70,11 +70,9 @@ index 32561e2..0c11473 100644
continue
else
# this is definitely wrong: script in $PATH and invalid shebang
-diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
-index 349cd20..5d2a735 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
-@@ -867,6 +867,10 @@ has_version() {
+@@ -868,6 +868,10 @@ has_version() {
"${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" has_version "${eroot}" "${atom}"
fi
local retval=$?
@@ -85,7 +83,7 @@ index 349cd20..5d2a735 100644
case "${retval}" in
0|1)
return ${retval}
-@@ -926,6 +930,10 @@ best_version() {
+@@ -927,6 +931,10 @@ best_version() {
"${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" best_version "${eroot}" "${atom}"
fi
local retval=$?
@@ -96,7 +94,7 @@ index 349cd20..5d2a735 100644
case "${retval}" in
0|1)
return ${retval}
-@@ -1145,6 +1153,10 @@ if ___eapi_has_master_repositories; then
+@@ -1167,6 +1175,10 @@ if ___eapi_has_master_repositories; then
output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" master_repositories "${EROOT}" "${repository}")
fi
retval=$?
@@ -107,7 +105,7 @@ index 349cd20..5d2a735 100644
[[ -n ${output} ]] && echo "${output}"
case "${retval}" in
0|1)
-@@ -1176,6 +1188,10 @@ if ___eapi_has_repository_path; then
+@@ -1198,6 +1210,10 @@ if ___eapi_has_repository_path; then
output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" get_repo_path "${EROOT}" "${repository}")
fi
retval=$?
@@ -118,7 +116,7 @@ index 349cd20..5d2a735 100644
[[ -n ${output} ]] && echo "${output}"
case "${retval}" in
0|1)
-@@ -1206,6 +1222,10 @@ if ___eapi_has_available_eclasses; then
+@@ -1228,6 +1244,10 @@ if ___eapi_has_available_eclasses; then
output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" available_eclasses "${EROOT}" "${repository}")
fi
retval=$?
@@ -129,7 +127,7 @@ index 349cd20..5d2a735 100644
[[ -n ${output} ]] && echo "${output}"
case "${retval}" in
0|1)
-@@ -1236,6 +1256,10 @@ if ___eapi_has_eclass_path; then
+@@ -1258,6 +1278,10 @@ if ___eapi_has_eclass_path; then
else
output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}")
fi
@@ -140,7 +138,7 @@ index 349cd20..5d2a735 100644
retval=$?
[[ -n ${output} ]] && echo "${output}"
case "${retval}" in
-@@ -1267,6 +1291,10 @@ if ___eapi_has_license_path; then
+@@ -1289,6 +1313,10 @@ if ___eapi_has_license_path; then
else
output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" license_path "${EROOT}" "${repository}" "${license}")
fi
@@ -151,8 +149,6 @@ index 349cd20..5d2a735 100644
retval=$?
[[ -n ${output} ]] && echo "${output}"
case "${retval}" in
-diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
-index 704243a..c1b9c06 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -39,7 +39,7 @@ from portage import os
@@ -164,7 +160,7 @@ index 704243a..c1b9c06 100644
from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFAULT
from portage.const import SUPPORTED_BINPKG_FORMATS, TIMESTAMP_FORMAT
from portage.dbapi.dep_expand import dep_expand
-@@ -65,6 +65,7 @@ from portage.util.SlotObject import SlotObject
+@@ -65,6 +65,7 @@ from portage.util.SlotObject import Slot
from portage.util._async.run_main_scheduler import run_main_scheduler
from portage.util._async.SchedulerInterface import SchedulerInterface
from portage.util._eventloop.global_event_loop import global_event_loop
@@ -172,7 +168,7 @@ index 704243a..c1b9c06 100644
from portage._global_updates import _global_updates
from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
from portage.localization import _
-@@ -2633,6 +2634,9 @@ def missing_sets_warning(root_config, missing_sets):
+@@ -2659,6 +2660,9 @@ def missing_sets_warning(root_config, mi
if portage.const.EPREFIX:
global_config_path = os.path.join(portage.const.EPREFIX,
portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
@@ -182,14 +178,18 @@ index 704243a..c1b9c06 100644
msg.append(" This usually means that '%s'" % \
(os.path.join(global_config_path, "sets/portage.conf"),))
msg.append(" is missing or corrupt.")
-diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
-index 53881c5..8198fe1 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
-@@ -3097,23 +3097,24 @@ class depgraph(object):
- edepend["HDEPEND"] = ""
-
+@@ -3239,15 +3239,15 @@ class depgraph(object):
+ # _dep_disjunctive_stack first, so that choices for build-time
+ # deps influence choices for run-time deps (bug 639346).
deps = (
+- (myroot, edepend["RDEPEND"],
++ (myroot, "RDEPEND",
+ self._priority(runtime=True)),
+- (myroot, edepend["PDEPEND"],
++ (myroot, "PDEPEND",
+ self._priority(runtime_post=True)),
- (depend_root, edepend["DEPEND"],
+ (depend_root, "DEPEND",
self._priority(buildtime=True,
@@ -200,23 +200,18 @@ index 53881c5..8198fe1 100644
self._priority(buildtime=True,
optional=(pkg.built or ignore_hdepend_deps),
ignored=ignore_hdepend_deps)),
-- (myroot, edepend["RDEPEND"],
-+ (myroot, "RDEPEND",
- self._priority(runtime=True)),
-- (myroot, edepend["PDEPEND"],
-+ (myroot, "PDEPEND",
- self._priority(runtime_post=True))
- )
+@@ -3255,8 +3255,8 @@ class depgraph(object):
debug = "--debug" in self._frozen_config.myopts
- for dep_root, dep_string, dep_priority in deps:
+- if not dep_string:
+ for dep_root, dep_type, dep_priority in deps:
-+ dep_string = edepend[dep_type]
- if not dep_string:
++ if not dep_string:
continue
if debug:
-@@ -3151,7 +3152,7 @@ class depgraph(object):
+ writemsg_level("\nParent: %s\n" % (pkg,),
+@@ -3293,7 +3293,7 @@ class depgraph(object):
try:
dep_string = list(self._queue_disjunctive_deps(
@@ -225,7 +220,7 @@ index 53881c5..8198fe1 100644
except portage.exception.InvalidDependString as e:
if pkg.installed:
self._dynamic_config._masked_installed.add(pkg)
-@@ -3166,14 +3167,14 @@ class depgraph(object):
+@@ -3308,14 +3308,14 @@ class depgraph(object):
if not self._add_pkg_dep_string(
pkg, dep_root, dep_priority, dep_string,
@@ -242,7 +237,7 @@ index 53881c5..8198fe1 100644
_autounmask_backup = self._dynamic_config._autounmask
if dep_priority.optional or dep_priority.ignored:
# Temporarily disable autounmask for deps that
-@@ -3182,7 +3183,7 @@ class depgraph(object):
+@@ -3324,7 +3324,7 @@ class depgraph(object):
try:
return self._wrapped_add_pkg_dep_string(
pkg, dep_root, dep_priority, dep_string,
@@ -251,7 +246,7 @@ index 53881c5..8198fe1 100644
finally:
self._dynamic_config._autounmask = _autounmask_backup
-@@ -3218,7 +3219,7 @@ class depgraph(object):
+@@ -3360,7 +3360,7 @@ class depgraph(object):
not slot_operator_rebuild
def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
@@ -260,7 +255,7 @@ index 53881c5..8198fe1 100644
if isinstance(pkg.depth, int):
depth = pkg.depth + 1
else:
-@@ -3242,7 +3243,7 @@ class depgraph(object):
+@@ -3384,7 +3384,7 @@ class depgraph(object):
try:
selected_atoms = self._select_atoms(dep_root,
dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
@@ -269,7 +264,7 @@ index 53881c5..8198fe1 100644
except portage.exception.InvalidDependString:
if pkg.installed:
self._dynamic_config._masked_installed.add(pkg)
-@@ -3540,7 +3541,7 @@ class depgraph(object):
+@@ -3691,7 +3691,7 @@ class depgraph(object):
child_pkgs.sort()
yield (atom, child_pkgs[-1])
@@ -278,7 +273,7 @@ index 53881c5..8198fe1 100644
"""
Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
Yields non-disjunctive deps. Raises InvalidDependString when
-@@ -3549,33 +3550,33 @@ class depgraph(object):
+@@ -3700,33 +3700,33 @@ class depgraph(object):
for x in dep_struct:
if isinstance(x, list):
if x and x[0] == "||":
@@ -319,7 +314,7 @@ index 53881c5..8198fe1 100644
return 0
return 1
-@@ -4428,7 +4429,7 @@ class depgraph(object):
+@@ -4579,7 +4579,7 @@ class depgraph(object):
return self._select_atoms_highest_available(*pargs, **kwargs)
def _select_atoms_highest_available(self, root, depstring,
@@ -328,7 +323,7 @@ index 53881c5..8198fe1 100644
"""This will raise InvalidDependString if necessary. If trees is
None then self._dynamic_config._filtered_trees is used."""
-@@ -4451,6 +4452,13 @@ class depgraph(object):
+@@ -4602,6 +4602,13 @@ class depgraph(object):
pkgsettings = self._frozen_config.pkgsettings[root]
if trees is None:
trees = self._dynamic_config._filtered_trees
@@ -342,7 +337,7 @@ index 53881c5..8198fe1 100644
mytrees = trees[root]
atom_graph = digraph()
if True:
-@@ -4482,7 +4490,7 @@ class depgraph(object):
+@@ -4633,7 +4640,7 @@ class depgraph(object):
mycheck = portage.dep_check(depstring, None,
pkgsettings, myuse=myuse,
@@ -351,7 +346,7 @@ index 53881c5..8198fe1 100644
finally:
# restore state
self._dynamic_config._autounmask = _autounmask_backup
-@@ -4558,6 +4566,7 @@ class depgraph(object):
+@@ -4709,6 +4716,7 @@ class depgraph(object):
continue
node_stack.append((child_node, node, child_atom))
@@ -359,11 +354,9 @@ index 53881c5..8198fe1 100644
return selected_atoms
def _expand_virt_from_graph(self, root, atom):
-diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
-index e993ce1..32a942c 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
-@@ -22,11 +22,12 @@ from portage.localization import localized_size
+@@ -22,11 +22,12 @@ from portage.localization import localiz
from portage.package.ebuild.config import _get_feature_flags
from portage.package.ebuild._spawn_nofetch import spawn_nofetch
from portage.output import ( blue, colorize, create_color_func,
@@ -428,11 +421,9 @@ index e993ce1..32a942c 100644
self.print_messages(show_repos)
self.print_blockers()
if self.conf.verbosity == 3:
-diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py
-index 2c9bf97..6a27842 100644
--- a/pym/portage/_sets/__init__.py
+++ b/pym/portage/_sets/__init__.py
-@@ -21,6 +21,7 @@ from portage.const import _ENABLE_SET_CONFIG
+@@ -21,6 +21,7 @@ from portage.const import _ENABLE_SET_CO
from portage.exception import PackageSetNotFound
from portage.localization import _
from portage.util import writemsg_level
@@ -440,7 +431,7 @@ index 2c9bf97..6a27842 100644
from portage.util.configparser import (SafeConfigParser,
NoOptionError, ParsingError, read_configs)
-@@ -281,6 +282,10 @@ def load_default_config(settings, trees):
+@@ -281,6 +282,10 @@ def load_default_config(settings, trees)
if portage.const.EPREFIX:
global_config_path = os.path.join(portage.const.EPREFIX,
GLOBAL_CONFIG_PATH.lstrip(os.sep))
@@ -451,11 +442,9 @@ index 2c9bf97..6a27842 100644
vcs_dirs = [_unicode_encode(x, encoding=_encodings['fs']) for x in VCS_DIRS]
def _getfiles():
for path, dirs, files in os.walk(os.path.join(global_config_path, "sets")):
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 952b33c..351b499 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
-@@ -191,6 +191,7 @@ SUPPORTED_FEATURES = frozenset([
+@@ -189,6 +189,7 @@ SUPPORTED_FEATURES = frozenset([
"notitles",
"parallel-fetch",
"parallel-install",
@@ -463,7 +452,7 @@ index 952b33c..351b499 100644
"prelink-checksums",
"preserve-libs",
"protect-owned",
-@@ -269,6 +270,11 @@ MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
+@@ -239,6 +240,11 @@ MANIFEST2_IDENTIFIERS = ("AUX", "MISC
#EPREFIX = ""
# END PREFIX LOCAL
@@ -475,11 +464,9 @@ index 952b33c..351b499 100644
# pick up EPREFIX from the environment if set
if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
EPREFIX = os.environ["PORTAGE_OVERRIDE_EPREFIX"]
-diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
-index 83fe5d3..e4b2491 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
-@@ -194,8 +194,19 @@ class vardbapi(dbapi):
+@@ -195,8 +195,19 @@ class vardbapi(dbapi):
self._counter_path = os.path.join(self._eroot,
CACHE_PATH, "counter")
@@ -501,7 +488,7 @@ index 83fe5d3..e4b2491 100644
self._linkmap = LinkageMap(self)
chost = self.settings.get('CHOST')
if not chost:
-@@ -236,6 +247,9 @@ class vardbapi(dbapi):
+@@ -237,6 +248,9 @@ class vardbapi(dbapi):
# This is an optimized hotspot, so don't use unicode-wrapped
# os module and don't use os.path.join().
rValue = self._eroot + VDB_PATH + _os.sep + mykey
@@ -511,7 +498,7 @@ index 83fe5d3..e4b2491 100644
if filename is not None:
# If filename is always relative, we can do just
# rValue += _os.sep + filename
-@@ -499,6 +513,9 @@ class vardbapi(dbapi):
+@@ -500,6 +514,9 @@ class vardbapi(dbapi):
returnme = []
basepath = os.path.join(self._eroot, VDB_PATH) + os.path.sep
@@ -521,7 +508,7 @@ index 83fe5d3..e4b2491 100644
if use_cache:
from portage import listdir
else:
-@@ -595,11 +612,17 @@ class vardbapi(dbapi):
+@@ -596,11 +613,17 @@ class vardbapi(dbapi):
del self.matchcache[mycat]
return list(self._iter_match(mydep,
self.cp_list(mydep.cp, use_cache=use_cache)))
@@ -541,7 +528,7 @@ index 83fe5d3..e4b2491 100644
except (IOError, OSError):
curmtime=0
-@@ -1421,7 +1444,7 @@ class vardbapi(dbapi):
+@@ -1448,7 +1471,7 @@ class vardbapi(dbapi):
class vartree(object):
"this tree will scan a var/db/pkg database located at root (passed to init)"
def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
@@ -550,7 +537,7 @@ index 83fe5d3..e4b2491 100644
if settings is None:
settings = portage.settings
-@@ -1439,6 +1462,7 @@ class vartree(object):
+@@ -1466,6 +1489,7 @@ class vartree(object):
" constructor is unused",
DeprecationWarning, stacklevel=2)
@@ -558,11 +545,9 @@ index 83fe5d3..e4b2491 100644
self.settings = settings
self.dbapi = vardbapi(settings=settings, vartree=self)
self.populated = 1
-diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
-index 737d2b1..7ca883a 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
-@@ -255,6 +255,95 @@ class _dep_choice(SlotObject):
+@@ -298,6 +298,95 @@ class _dep_choice(SlotObject):
__slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
'all_installed_slots')
@@ -658,7 +643,7 @@ index 737d2b1..7ca883a 100644
def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
"""
Takes an unreduced and reduced deplist and removes satisfied dependencies.
-@@ -643,7 +732,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
+@@ -695,7 +784,7 @@ def dep_zapdeps(unreduced, reduced, myro
assert(False) # This point should not be reachable
def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
@@ -667,7 +652,7 @@ index 737d2b1..7ca883a 100644
"""
Takes a depend string, parses it, and selects atoms.
The myroot parameter is unused (use mysettings['EROOT'] instead).
-@@ -741,6 +830,14 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+@@ -796,6 +885,14 @@ def dep_check(depstring, mydbapi, mysett
writemsg("mysplit: %s\n" % (mysplit), 1)
writemsg("mysplit2: %s\n" % (mysplit2), 1)
@@ -682,8 +667,6 @@ index 737d2b1..7ca883a 100644
selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
use_binaries=use_binaries, trees=trees)
-diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
-index 55b8c08..32e969e 100644
--- a/pym/portage/package/ebuild/_config/LocationsManager.py
+++ b/pym/portage/package/ebuild/_config/LocationsManager.py
@@ -307,6 +307,9 @@ class LocationsManager(object):
@@ -696,11 +679,9 @@ index 55b8c08..32e969e 100644
def set_port_dirs(self, portdir, portdir_overlay):
self.portdir = portdir
-diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
-index 1ac2cb1..2e31cf0 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
-@@ -305,6 +305,7 @@ class config(object):
+@@ -306,6 +306,7 @@ class config(object):
self.features = features_set(self)
self.features._features = copy.deepcopy(clone.features._features)
self._features_overrides = copy.deepcopy(clone._features_overrides)
@@ -708,7 +689,7 @@ index 1ac2cb1..2e31cf0 100644
#Strictly speaking _license_manager is not immutable. Users need to ensure that
#extract_global_changes() is called right after __init__ (if at all).
-@@ -944,6 +945,63 @@ class config(object):
+@@ -945,6 +946,63 @@ class config(object):
self._validate_commands()
@@ -772,7 +753,7 @@ index 1ac2cb1..2e31cf0 100644
for k in self._case_insensitive_vars:
if k in self:
self[k] = self[k].lower()
-@@ -2778,6 +2836,10 @@ class config(object):
+@@ -2813,6 +2871,10 @@ class config(object):
if not eapi_exports_merge_type(eapi):
mydict.pop("MERGE_TYPE", None)
@@ -783,8 +764,6 @@ index 1ac2cb1..2e31cf0 100644
# Prefix variables are supported beginning with EAPI 3, or when
# force-prefix is in FEATURES, since older EAPIs would otherwise be
# useless with prefix configurations. This brings compatibility with
-diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
-index 1878d1f..9fc17f7 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -51,6 +51,7 @@ from portage import bsd_chflags, \
@@ -795,17 +774,23 @@ index 1878d1f..9fc17f7 100644
EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, PORTAGE_PYM_PACKAGES, EPREFIX, MACOSSANDBOX_PROFILE
from portage.data import portage_gid, portage_uid, secpass, \
uid, userpriv_groups
-@@ -71,7 +72,8 @@ from portage.output import colormap
- from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
- from portage.util import apply_recursive_permissions, \
- apply_secpass_permissions, noiselimit, \
-- writemsg, writemsg_stdout, write_atomic
-+ writemsg, writemsg_stdout, write_atomic, getconfig
+@@ -72,6 +73,7 @@ from portage.package.ebuild.prepare_buil
+ from portage.process import find_binary
+ from portage.util import ( apply_recursive_permissions,
+ apply_secpass_permissions,
++ getconfig,
+ noiselimit,
+ shlex_split,
+ varexpand,
+@@ -79,6 +81,7 @@ from portage.util import ( apply_recursi
+ writemsg_stdout,
+ write_atomic
+ )
+from portage.util._path import exists_raise_eaccess
from portage.util.cpuinfo import get_cpu_count
from portage.util.lafilefixer import rewrite_lafile
- from portage.util.socks5 import get_socks5_proxy
-@@ -233,8 +235,27 @@ def _doebuild_path(settings, eapi=None):
+ from portage.util.compression_probe import _compressors
+@@ -241,8 +244,27 @@ def _doebuild_path(settings, eapi=None):
for x in portage_bin_path:
path.append(os.path.join(x, "ebuild-helpers"))
@@ -834,11 +819,9 @@ index 1878d1f..9fc17f7 100644
path.extend(rootpath)
path.extend(extrapath)
# END PREFIX LOCAL
-diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
-index 265d0c9..2ec6ff4 100644
--- a/pym/portage/package/ebuild/fetch.py
+++ b/pym/portage/package/ebuild/fetch.py
-@@ -43,6 +43,7 @@ from portage.output import colorize, EOutput
+@@ -43,6 +43,7 @@ from portage.output import colorize, EOu
from portage.util import apply_recursive_permissions, \
apply_secpass_permissions, ensure_dirs, grabdict, shlex_split, \
varexpand, writemsg, writemsg_level, writemsg_stdout
@@ -846,7 +829,7 @@ index 265d0c9..2ec6ff4 100644
from portage.process import spawn
_userpriv_spawn_kwargs = (
-@@ -874,6 +875,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
+@@ -874,6 +875,9 @@ def fetch(myuris, mysettings, listonly=0
global_config_path = GLOBAL_CONFIG_PATH
if portage.const.EPREFIX:
global_config_path = os.path.join(portage.const.EPREFIX,
@@ -856,8 +839,6 @@ index 265d0c9..2ec6ff4 100644
GLOBAL_CONFIG_PATH.lstrip(os.sep))
missing_file_param = False
-diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
-index 3bccf6f..cacd637 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -94,19 +94,20 @@ class SyncManager(object):
@@ -894,20 +875,18 @@ index 3bccf6f..cacd637 100644
def __getattr__(self, name):
if name == 'async':
-diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
-index 54a25e0..0296d3f 100644
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
-@@ -23,7 +23,7 @@ from portage.util import varexpand
- from portage.util import writemsg_level
- from portage.util._dyn_libs.NeededEntry import NeededEntry
- from portage.util.elf.header import ELFHeader
+@@ -12,7 +12,7 @@ from portage import _os_merge
+ from portage import _unicode_decode
+ from portage import _unicode_encode
+ from portage.cache.mappings import slot_dict_class
-from portage.const import EPREFIX
+from portage.const import BPREFIX
-
- if sys.hexversion >= 0x3000000:
- _unicode = str
-@@ -269,7 +269,7 @@ class LinkageMapELF(object):
+ from portage.dep.soname.multilib_category import compute_multilib_category
+ from portage.exception import CommandNotFound, InvalidData
+ from portage.localization import _
+@@ -268,7 +268,7 @@ class LinkageMapELF(object):
continue
plibs.update((x, cpv) for x in items)
if plibs:
@@ -916,6 +895,3 @@ index 54a25e0..0296d3f 100644
args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
for x in plibs)
try:
---
-2.10.2
-
diff --git a/sys-apps/portage/files/portage-2.3.4-mj-safe-econf.patch b/sys-apps/portage/files/portage-2.3.4-mj-safe-econf.patch
deleted file mode 100644
index 9cb9020bfc..0000000000
--- a/sys-apps/portage/files/portage-2.3.4-mj-safe-econf.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From c0153776be692d11a4af156e77bad50aa8c7bd12 Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <haubi@gentoo.org>
-Date: Thu, 2 Mar 2017 10:37:19 +0100
-Subject: [PATCH] econf: multijob-safe shebang tweaking
-
-Using econf in parallel for multiple configurations (multilib, or
-ncurses' wide+narrow), both may try to fix configure's shebang.
-On Cygwin at least, this may cause 'sed -i' to fail with:
- sed: cannot rename /.../work/ncurses-6.0/sedXZsjI6: Permission denied
-Instead of 'sed -i', better use 'mv -f' towards the original file.
----
- bin/phase-helpers.sh | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
-index 9e4e6a2..b72cb1a 100644
---- a/bin/phase-helpers.sh
-+++ b/bin/phase-helpers.sh
-@@ -573,13 +573,13 @@ econf() {
- if [[ -n $CONFIG_SHELL && \
- "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then
- # preserve timestamp, see bug #440304
-- touch -r "${ECONF_SOURCE}/configure" "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die
-+ cp "${ECONF_SOURCE}/configure" "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die
- sed -i \
- -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \
-- "${ECONF_SOURCE}/configure" \
-+ "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" \
- || die "Substition of shebang in '${ECONF_SOURCE}/configure' failed"
-- touch -r "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" "${ECONF_SOURCE}/configure" || die
-- rm -f "${ECONF_SOURCE}/configure._portage_tmp_.${pid}"
-+ touch -r "${ECONF_SOURCE}/configure" "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die
-+ mv -f "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" "${ECONF_SOURCE}/configure" || die
- fi
- if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then
- find "${WORKDIR}" -type f '(' \
---
-2.10.2
-
diff --git a/sys-apps/portage/portage-2.3.18.ebuild b/sys-apps/portage/portage-2.3.18.ebuild
index a7abe3406a..7e4bf1ab37 100644
--- a/sys-apps/portage/portage-2.3.18.ebuild
+++ b/sys-apps/portage/portage-2.3.18.ebuild
@@ -93,7 +93,7 @@ python_prepare_all() {
epatch "${FILESDIR}"/${PN}-2.3.10-ebuildshell.patch # 155161
use prefix-chaining &&
- epatch "${FILESDIR}"/${PN}-2.3.8-prefix-chaining.patch
+ epatch "${FILESDIR}"/${PN}-2.3.18-prefix-chaining.patch
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2018-05-28 16:44 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2018-05-28 16:44 UTC (permalink / raw
To: gentoo-commits
commit: cb20d3f95bd20b528a14126b3d1c545c4ddb1704
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon May 28 16:40:04 2018 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon May 28 16:43:59 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cb20d3f9
sys-apps/portage: bump ebuildshell+prefix-chaining patches
Package-Manager: Portage-2.3.24, Repoman-2.3.6
.../portage/files/portage-2.3.40-ebuildshell.patch | 354 ++++++++
.../files/portage-2.3.40-prefix-chaining.patch | 921 +++++++++++++++++++++
sys-apps/portage/portage-2.3.40.1.ebuild | 5 +-
3 files changed, 1277 insertions(+), 3 deletions(-)
diff --git a/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch
new file mode 100644
index 0000000000..167ed3824e
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch
@@ -0,0 +1,354 @@
+From 9075d30d24af87f69d23ae129dc75e1305cd3aa8 Mon Sep 17 00:00:00 2001
+From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
+Date: Wed, 6 Nov 2013 12:40:05 +0100
+Subject: [PATCH 1/2] Add ebuildshell feature, bug#155161.
+
+---
+ bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
+ bin/filter-bash-environment.py | 55 +++++++++----
+ bin/save-ebuild-env.sh | 2 +-
+ man/make.conf.5 | 6 ++
+ pym/_emerge/AbstractEbuildProcess.py | 1 +
+ pym/portage/const.py | 1 +
+ 6 files changed, 194 insertions(+), 17 deletions(-)
+
+diff --git a/bin/ebuild.sh b/bin/ebuild.sh
+index f76a48d8e..51ba95cb1 100755
+--- a/bin/ebuild.sh
++++ b/bin/ebuild.sh
+@@ -121,7 +121,7 @@ __qa_source() {
+ __qa_call() {
+ local shopts=$(shopt) OLDIFS="$IFS"
+ local retval
+- "$@"
++ __call-ebuildshell "$@"
+ retval=$?
+ set +e
+ [[ $shopts != $(shopt) ]] &&
+@@ -547,6 +547,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
+ unset BIN_PATH BIN BODY FUNC_SRC
+ fi
+
++__call-ebuildshell() {
++ if ! has ebuildshell ${FEATURES}; then
++ "$@"
++ return $?
++ fi
++ local __ebuildshell_args=( "$@" )
++ # These are the variables I have seen 'bash -i' maintaining the values for:
++ local __ebuildshell_bash_i_vars="__ebuildshell_.*
++ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
++ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
++ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
++ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
++ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
++ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
++ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
++ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
++ (
++ cat <<-EOE
++ # local variables of functions using recursive ebuildshell are
++ # visible to the EXIT trap of that recursive ebuildshell. To
++ # keep them local, we have to filter them from that recursive
++ # ebuildshell's return-env. As 'declare -p' is unable to tell
++ # local-ity of variables, we abuse the trace attribute for local
++ # variables to filter them from the return-env. So we need the
++ # local alias active before declaring any functions.
++ # On a sidehand, this allows for copy&paste of function body
++ # lines including the local keyword.
++ alias local='declare -t'
++ shopt -s expand_aliases
++ EOE
++ (
++ declare -p
++ declare -fp
++ shopt -p
++ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
++ ) |
++ (
++ # we need everything but the bash vars after 'env -i'
++ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
++ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
++ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
++ --report-readonly-variables \
++ --preserve-readonly-attribute \
++ "${__ebuildshell_bash_i_vars}" \
++ || die "filter-bash-environment.py failed"
++ )
++ # 'declare -g' is available since bash-4.2,
++ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
++ if (( ${BASH_VERSINFO[0]} > 4 )) ||
++ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
++ then
++ __ebuildshell_bash42_true=
++ __ebuildshell_bash42_false='#bash-4.2#'
++ else
++ __ebuildshell_bash42_true='#bash-4.2#'
++ __ebuildshell_bash42_false=
++ fi
++ # The already readonly variables, without bash maintained ones:
++ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
++ cat <<-EOE
++ # properly quote the function arguments
++ $(declare -p __ebuildshell_args)
++ set -- "\${__ebuildshell_args[@]}"
++ unset __ebuildshell_args
++ # be informative about what to do
++ PS1="EBUILD ${PN} $1 \$ "
++ type $1
++ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
++ echo "WANTED: \$@"
++ echo "or use: \"\\\$@\""
++ # use bash history, but not the 'user's real one
++ HISTFILE=~/.bash_history
++ # but do not use history-expansion with '!',
++ # for copy&paste of function body lines containing: !
++ set +H
++ # this is a debugging shell already
++ shopt -u extdebug
++ trap - DEBUG
++ # at exit, dump the current environment
++ trap "
++ unalias local
++ unset -f __call-ebuildshell
++ rm -f '${__ebuildshell_tmpf}.return-'*
++ (
++ (
++ # declare -p does not tell the -g flag,
++ # so we add it by aliasing declare.
++ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
++ declare -p
++ ${__ebuildshell_bash42_true}echo \"unalias declare\"
++ declare -fp
++ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
++ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
++ ) |
++ (
++ # We may have more readonly variables now, yet we
++ # need to filter variables that were readonly before.
++ # And filter local variables by their trace attribute.
++ 2>'${__ebuildshell_tmpf}.return-rovars' \\
++ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
++ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
++ --report-readonly-variables \\
++ --preserve-readonly-attribute \\
++ --filter-traced-variables \\
++ '${__ebuildshell_bash_i_vars} \
++ ${__ebuildshell_ro_ebuild_vars}' \\
++ || die 'filter-bash-environment.py failed'
++ )
++ ) > '${__ebuildshell_tmpf}.return-env'
++ " EXIT
++ # can do some cleanup right now
++ rm -f '${__ebuildshell_tmpf}.ebuild-'*
++ EOE
++ ) > "${__ebuildshell_tmpf}.ebuild-env"
++
++ # pre-fill the history with "$@"
++ echo '"$@"' >> ~/.bash_history
++ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
++
++ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
++
++ # The environment- and exit-status handling after leaving the ebuildshell
++ # prompt is expected to be identical as without the ebuildshell prompt.
++ local __ebuildshell_status=$?
++
++ # We might be in a recursive ebuildshell, but do not want
++ # any aliases being active while sourcing the return-env.
++ local __ebuildshell_orig_aliases=$(alias)
++ unalias -a
++ source "${__ebuildshell_tmpf}.return-env"
++ unalias -a
++ eval "${__ebuildshell_orig_aliases}"
++
++ # Portage has a whitelist of readonly variables: If an ebuild defines
++ # additional readonly variables, their readonly attribute is removed
++ # across ebuild phases. If we ever want to preserve the readonly
++ # attribute of additional ebuild-defined variables across phases,
++ # when returning from the ebuildshell their names are in
++ # "${__ebuildshell_tmpf}.return-rovars"
++ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
++
++ return ${__ebuildshell_status}
++}
++
+ # Subshell/helper die support (must export for the die helper).
+ export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
+ trap 'exit 1' SIGTERM
+diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
+index 06cac7214..5590dbfc4 100755
+--- a/bin/filter-bash-environment.py
++++ b/bin/filter-bash-environment.py
+@@ -12,7 +12,8 @@ func_end_re = re.compile(br'^\}$')
+
+ var_assign_re = re.compile(br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
+ close_quote_re = re.compile(br'(\\"|"|\')\s*$')
+-readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+')
++readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
++trace_re = re.compile(br'^declare\s+-\S*t\S*\s+')
+ # declare without assignment
+ var_declare_re = re.compile(br'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
+
+@@ -27,7 +28,7 @@ def have_end_quote(quote, line):
+ return close_quote_match is not None and \
+ close_quote_match.group(1) == quote
+
+-def filter_declare_readonly_opt(line):
++def filter_declare_readonly_opt(line, options):
+ readonly_match = readonly_re.match(line)
+ if readonly_match is not None:
+ declare_opts = b''
+@@ -35,14 +36,19 @@ def filter_declare_readonly_opt(line):
+ group = readonly_match.group(i)
+ if group is not None:
+ declare_opts += group
++ var = readonly_match.group(3)
++ if '--report-readonly-variables' in options:
++ getattr(sys.stderr, 'buffer', sys.stderr).write(var + b'\n')
++ if '--preserve-readonly-attribute' in options:
++ declare_opts += b'r'
+ if declare_opts:
+ line = b'declare -' + declare_opts + \
+- b' ' + line[readonly_match.end():]
++ b' ' + var + line[readonly_match.end():]
+ else:
+- line = b'declare ' + line[readonly_match.end():]
++ line = b'declare ' + var + line[readonly_match.end():]
+ return line
+
+-def filter_bash_environment(pattern, file_in, file_out):
++def filter_bash_environment(pattern, file_in, file_out, options):
+ # Filter out any instances of the \1 character from variable values
+ # since this character multiplies each time that the environment
+ # is saved (strange bash behavior). This can eventually result in
+@@ -66,6 +72,8 @@ def filter_bash_environment(pattern, file_in, file_out):
+ quote = var_assign_match.group(3)
+ filter_this = pattern.match(var_assign_match.group(2)) \
+ is not None
++ if not filter_this and '--filter-traced-variables' in options:
++ filter_this = trace_re.match(line) is not None
+ # Exclude the start quote when searching for the end quote,
+ # to ensure that the start quote is not misidentified as the
+ # end quote (happens if there is a newline immediately after
+@@ -75,7 +83,7 @@ def filter_bash_environment(pattern, file_in, file_out):
+ multi_line_quote = quote
+ multi_line_quote_filter = filter_this
+ if not filter_this:
+- line = filter_declare_readonly_opt(line)
++ line = filter_declare_readonly_opt(line, options)
+ file_out.write(line.replace(b"\1", b""))
+ continue
+ else:
+@@ -84,8 +92,10 @@ def filter_bash_environment(pattern, file_in, file_out):
+ # declare without assignment
+ filter_this = pattern.match(declare_match.group(2)) \
+ is not None
++ if not filter_this and '--filter-traced-variables' in options:
++ filter_this = trace_re.match(line) is not None
+ if not filter_this:
+- line = filter_declare_readonly_opt(line)
++ line = filter_declare_readonly_opt(line, options)
+ file_out.write(line)
+ continue
+
+@@ -122,13 +132,28 @@ if __name__ == "__main__":
+ "while leaving bash function definitions and here-documents " + \
+ "intact. The PATTERN is a space separated list of variable names" + \
+ " and it supports python regular expression syntax."
+- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
+- args = sys.argv[1:]
+-
+- if '-h' in args or '--help' in args:
+- sys.stdout.write(usage + "\n")
+- sys.stdout.flush()
+- sys.exit(os.EX_OK)
++ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
++ args = []
++ known_options = {
++ '--report-readonly-variables':
++ "Write names of readonly variables to stderr.",
++ '--preserve-readonly-attribute':
++ "Preserve the '-r' flag in 'declare -r'.",
++ '--filter-traced-variables':
++ "Filter out variables declared with '-t' attribute."
++ }
++ options = {}
++ for arg in sys.argv[1:]:
++ if arg in known_options.keys():
++ options[arg] = True
++ continue
++ if '-h' == arg or '--help' == arg:
++ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
++ for option, descr in known_options.items():
++ sys.stdout.write(" " + option + "\t" + descr + "\n")
++ sys.stdout.flush()
++ sys.exit(os.EX_OK)
++ args.append(arg)
+
+ if len(args) != 1:
+ sys.stderr.write(usage + "\n")
+@@ -151,5 +176,5 @@ if __name__ == "__main__":
+
+ var_pattern = b'^(' + b'|'.join(var_pattern) + b')$'
+ filter_bash_environment(
+- re.compile(var_pattern), file_in, file_out)
++ re.compile(var_pattern), file_in, file_out, options)
+ file_out.flush()
+diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
+index bb17382d4..af35a3327 100755
+--- a/bin/save-ebuild-env.sh
++++ b/bin/save-ebuild-env.sh
+@@ -53,7 +53,7 @@ __save_ebuild_env() {
+ einfo einfon ewarn eerror ebegin __eend eend KV_major \
+ KV_minor KV_micro KV_to_int get_KV has \
+ __has_phase_defined_up_to \
+- hasv hasq __qa_source __qa_call \
++ hasv hasq __qa_source __qa_call __call-ebuildshell \
+ addread addwrite adddeny addpredict __sb_append_var \
+ use usev useq has_version portageq \
+ best_version use_with use_enable register_die_hook \
+diff --git a/man/make.conf.5 b/man/make.conf.5
+index b0c1aa4f2..568f350a0 100644
+--- a/man/make.conf.5
++++ b/man/make.conf.5
+@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
+ Use locks to ensure that unsandboxed ebuild phases never execute
+ concurrently. Also see \fIparallel\-install\fR.
+ .TP
++.B ebuildshell
++Drop into an interactive shell for each phase function, meant for
++debugging. Because the shell would normally be used to execute the
++phase function, commands like src_unpack or epatch are available in the
++interactive shell. Use `die` to terminate the merge.
++.TP
+ .B fail\-clean
+ Clean up temporary files after a build failure. This is particularly useful
+ if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
+diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
+index 370cac529..a521596e5 100644
+--- a/pym/_emerge/AbstractEbuildProcess.py
++++ b/pym/_emerge/AbstractEbuildProcess.py
+@@ -181,6 +181,7 @@ class AbstractEbuildProcess(SpawnProcess):
+ self.fd_pipes = {}
+ null_fd = None
+ if 0 not in self.fd_pipes and \
++ "ebuildshell" not in self.settings.features and \
+ self.phase not in self._phases_interactive_whitelist and \
+ "interactive" not in self.settings.get("PROPERTIES", "").split():
+ null_fd = os.open('/dev/null', os.O_RDONLY)
+diff --git a/pym/portage/const.py b/pym/portage/const.py
+index 3c23c85ed..d9c57f300 100644
+--- a/pym/portage/const.py
++++ b/pym/portage/const.py
+@@ -161,6 +161,7 @@ SUPPORTED_FEATURES = frozenset([
+ "distlocks",
+ "downgrade-backup",
+ "ebuild-locks",
++ "ebuildshell",
+ "fail-clean",
+ "fakeroot",
+ "fixlafiles",
+--
+2.16.1
+
diff --git a/sys-apps/portage/files/portage-2.3.40-prefix-chaining.patch b/sys-apps/portage/files/portage-2.3.40-prefix-chaining.patch
new file mode 100644
index 0000000000..8e0864990d
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.3.40-prefix-chaining.patch
@@ -0,0 +1,921 @@
+From 9c991762d6becb779925d59289eb0324f269ad18 Mon Sep 17 00:00:00 2001
+From: Michael Haubenwallner <haubi@gentoo.org>
+Date: Thu, 23 Mar 2017 13:52:32 +0100
+Subject: [PATCH 2/2] add prefix-chaining support
+
+---
+ bin/install-qa-check.d/05prefix | 30 ++++++-
+ bin/phase-helpers.sh | 24 ++++++
+ pym/_emerge/actions.py | 6 +-
+ pym/_emerge/depgraph.py | 53 +++++++-----
+ pym/_emerge/resolver/output.py | 40 ++++++++-
+ pym/portage/_sets/__init__.py | 5 ++
+ pym/portage/const.py | 6 ++
+ pym/portage/dbapi/vartree.py | 34 ++++++--
+ pym/portage/dep/dep_check.py | 99 +++++++++++++++++++++-
+ .../package/ebuild/_config/LocationsManager.py | 3 +
+ pym/portage/package/ebuild/config.py | 62 ++++++++++++++
+ pym/portage/package/ebuild/doebuild.py | 24 +++++-
+ pym/portage/package/ebuild/fetch.py | 4 +
+ pym/portage/sync/controller.py | 27 +++---
+ pym/portage/util/_dyn_libs/LinkageMapELF.py | 4 +-
+ 15 files changed, 373 insertions(+), 48 deletions(-)
+
+diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
+index 32561e263..0c1147367 100644
+--- a/bin/install-qa-check.d/05prefix
++++ b/bin/install-qa-check.d/05prefix
+@@ -79,16 +79,42 @@ install_qa_check_prefix() {
+ # unprefixed shebang, is the script directly in $PATH or an init
+ # script?
+ if [[ ":${PATH}:${EPREFIX}/etc/init.d:" == *":${fp}:"* ]] ; then
+- if [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then
++ all_epfs="$PORTAGE_READONLY_EPREFIXES:$EPREFIX:$EROOT:$ED"
++ save_IFS=$IFS
++ IFS=:
++ epfs=( $all_epfs )
++ IFS=$save_IFS
++
++ found=
++ for x in "${epfs[@]}"; do
++ [[ -z "${x}" ]] && continue
++ check="${x}${line[0]}"
++
++ # might already contain a prefix
++ if [[ "${line[0]}" == "${x}"* ]]; then
++ check="${line[0]}"
++ fi
++
++ if [[ -e ${check} ]]; then
++ found="${check}"
++ fi
++ done
++
++ if [[ -n ${found} ]] ; then
+ # is it unprefixed, but we can just fix it because a
+ # prefixed variant exists
+ eqawarn "prefixing shebang of ${fn#${D}}"
++
++ if [[ ${found} == "${ED}"* || ${found} == "${EROOT}"* ]]; then
++ found="${EPREFIX}${line[0]}"
++ fi
++
+ # statement is made idempotent on purpose, because
+ # symlinks may point to the same target, and hence the
+ # same real file may be sedded multiple times since we
+ # read the shebangs in one go upfront for performance
+ # reasons
+- sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${EPREFIX}"${line[0]}':' "${rf}"
++ sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${found}"':' "${rf}"
+ continue
+ else
+ # this is definitely wrong: script in $PATH and invalid shebang
+diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
+index 75d92b407..c32533fb3 100644
+--- a/bin/phase-helpers.sh
++++ b/bin/phase-helpers.sh
+@@ -934,6 +934,10 @@ ___best_version_and_has_version_common() {
+ fi
+ "${cmd[@]}"
+ local retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ ${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' '${FUNCNAME[1]}' '${READONLY_EPREFIX%:*}' '${atom}'"
++ retval=$?
++ fi
+ case "${retval}" in
+ 0|1)
+ return ${retval}
+@@ -1194,6 +1198,10 @@ if ___eapi_has_master_repositories; then
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" master_repositories "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' master_repositories '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -1225,6 +1233,10 @@ if ___eapi_has_repository_path; then
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" get_repo_path "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' get_repo_path '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -1255,6 +1267,10 @@ if ___eapi_has_available_eclasses; then
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" available_eclasses "${EROOT}" "${repository}")
+ fi
+ retval=$?
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' available_eclasses '${READONLY_EPREFIX%:*}' '${repository}'")
++ retval=$?
++ fi
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+ 0|1)
+@@ -1285,6 +1301,10 @@ if ___eapi_has_eclass_path; then
+ else
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}")
+ fi
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=$(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' eclass_path '${READONLY_EPREFIX%:*}' '${repository}' '${eclass}'")
++ retval=$?
++ fi
+ retval=$?
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+@@ -1316,6 +1336,10 @@ if ___eapi_has_license_path; then
+ else
+ output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" license_path "${EROOT}" "${repository}" "${license}")
+ fi
++ if [[ ${retval} -eq 1 && -n ${READONLY_EPREFIX} ]]; then
++ output=(${SHELL} -c "EPREFIX='${READONLY_EPREFIX%:*}' EPYTHON= '${PORTAGE_BIN_PATH}/ebuild-helpers/portageq' license_path '${READONLY_EPREFIX%:*}' '${repository}' '${license}'")
++ retval=$?
++ fi
+ retval=$?
+ [[ -n ${output} ]] && echo "${output}"
+ case "${retval}" in
+diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
+index 432fc57e3..764462fc5 100644
+--- a/pym/_emerge/actions.py
++++ b/pym/_emerge/actions.py
+@@ -39,7 +39,7 @@ from portage import os
+ from portage import shutil
+ from portage import eapi_is_supported, _encodings, _unicode_decode
+ from portage.cache.cache_errors import CacheError
+-from portage.const import EPREFIX
++from portage.const import EPREFIX, BPREFIX
+ from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFAULT
+ from portage.const import SUPPORTED_BINPKG_FORMATS, TIMESTAMP_FORMAT
+ from portage.dbapi.dep_expand import dep_expand
+@@ -65,6 +65,7 @@ from portage.util.SlotObject import SlotObject
+ from portage.util._async.run_main_scheduler import run_main_scheduler
+ from portage.util._async.SchedulerInterface import SchedulerInterface
+ from portage.util._eventloop.global_event_loop import global_event_loop
++from portage.util._path import exists_raise_eaccess
+ from portage._global_updates import _global_updates
+ from portage.sync.old_tree_timestamp import old_tree_timestamp_warn
+ from portage.localization import _
+@@ -2672,6 +2673,9 @@ def missing_sets_warning(root_config, missing_sets):
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
+ portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
++ portage.const.GLOBAL_CONFIG_PATH.lstrip(os.sep))
+ msg.append(" This usually means that '%s'" % \
+ (os.path.join(global_config_path, "sets/portage.conf"),))
+ msg.append(" is missing or corrupt.")
+diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
+index f7bac69f9..a6eb0d3d4 100644
+--- a/pym/_emerge/depgraph.py
++++ b/pym/_emerge/depgraph.py
+@@ -3355,19 +3355,19 @@ class depgraph(object):
+ # _dep_disjunctive_stack first, so that choices for build-time
+ # deps influence choices for run-time deps (bug 639346).
+ deps = (
+- (myroot, edepend["RDEPEND"],
++ (myroot, "RDEPEND",
+ self._priority(runtime=True)),
+- (myroot, edepend["PDEPEND"],
++ (myroot, "PDEPEND",
+ self._priority(runtime_post=True)),
+- (depend_root, edepend["DEPEND"],
++ (depend_root, "DEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_depend_deps),
+ ignored=ignore_depend_deps)),
+- (self._frozen_config._running_root.root, edepend["HDEPEND"],
++ (self._frozen_config._running_root.root, "HDEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_hdepend_deps),
+ ignored=ignore_hdepend_deps)),
+- (self._frozen_config._running_root.root, edepend["BDEPEND"],
++ (self._frozen_config._running_root.root, "BDEPEND",
+ self._priority(buildtime=True,
+ optional=(pkg.built or ignore_bdepend_deps),
+ ignored=ignore_bdepend_deps)),
+@@ -3375,7 +3375,8 @@ class depgraph(object):
+
+ debug = "--debug" in self._frozen_config.myopts
+
+- for dep_root, dep_string, dep_priority in deps:
++ for dep_root, dep_type, dep_priority in deps:
++ dep_string = edepend[dep_type]
+ if not dep_string:
+ continue
+ if debug:
+@@ -3413,7 +3414,7 @@ class depgraph(object):
+
+ try:
+ dep_string = list(self._queue_disjunctive_deps(
+- pkg, dep_root, dep_priority, dep_string))
++ pkg, dep_root, dep_priority, dep_string, dep_type))
+ except portage.exception.InvalidDependString as e:
+ if pkg.installed:
+ self._dynamic_config._masked_installed.add(pkg)
+@@ -3428,14 +3429,14 @@ class depgraph(object):
+
+ if not self._add_pkg_dep_string(
+ pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied):
++ allow_unsatisfied, dep_type):
+ return 0
+
+ self._dynamic_config._traversed_pkg_deps.add(pkg)
+ return 1
+
+ def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied):
++ allow_unsatisfied, dep_type=None):
+ _autounmask_backup = self._dynamic_config._autounmask
+ if dep_priority.optional or dep_priority.ignored:
+ # Temporarily disable autounmask for deps that
+@@ -3444,7 +3445,7 @@ class depgraph(object):
+ try:
+ return self._wrapped_add_pkg_dep_string(
+ pkg, dep_root, dep_priority, dep_string,
+- allow_unsatisfied)
++ allow_unsatisfied, dep_type)
+ finally:
+ self._dynamic_config._autounmask = _autounmask_backup
+
+@@ -3480,7 +3481,7 @@ class depgraph(object):
+ not slot_operator_rebuild
+
+ def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
+- dep_string, allow_unsatisfied):
++ dep_string, allow_unsatisfied, dep_type=None):
+ if isinstance(pkg.depth, int):
+ depth = pkg.depth + 1
+ else:
+@@ -3504,7 +3505,7 @@ class depgraph(object):
+ try:
+ selected_atoms = self._select_atoms(dep_root,
+ dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
+- strict=strict, priority=dep_priority)
++ strict=strict, priority=dep_priority, dep_type=dep_type)
+ except portage.exception.InvalidDependString:
+ if pkg.installed:
+ self._dynamic_config._masked_installed.add(pkg)
+@@ -3811,7 +3812,7 @@ class depgraph(object):
+ child_pkgs.sort()
+ yield (atom, child_pkgs[-1])
+
+- def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct):
++ def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
+ """
+ Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack.
+ Yields non-disjunctive deps. Raises InvalidDependString when
+@@ -3820,33 +3821,33 @@ class depgraph(object):
+ for x in dep_struct:
+ if isinstance(x, list):
+ if x and x[0] == "||":
+- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
++ self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
+ else:
+ for y in self._queue_disjunctive_deps(
+- pkg, dep_root, dep_priority, x):
++ pkg, dep_root, dep_priority, x, dep_type):
+ yield y
+ else:
+ # Note: Eventually this will check for PROPERTIES=virtual
+ # or whatever other metadata gets implemented for this
+ # purpose.
+ if x.cp.startswith('virtual/'):
+- self._queue_disjunction(pkg, dep_root, dep_priority, [x])
++ self._queue_disjunction(pkg, dep_root, dep_priority, [x], dep_type)
+ else:
+ yield x
+
+- def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct):
++ def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct, dep_type=None):
+ self._dynamic_config._dep_disjunctive_stack.append(
+- (pkg, dep_root, dep_priority, dep_struct))
++ (pkg, dep_root, dep_priority, dep_struct, dep_type))
+
+ def _pop_disjunction(self, allow_unsatisfied):
+ """
+ Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to
+ populate self._dynamic_config._dep_stack.
+ """
+- pkg, dep_root, dep_priority, dep_struct = \
++ pkg, dep_root, dep_priority, dep_struct, dep_type = \
+ self._dynamic_config._dep_disjunctive_stack.pop()
+ if not self._add_pkg_dep_string(
+- pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied):
++ pkg, dep_root, dep_priority, dep_struct, allow_unsatisfied, dep_type):
+ return 0
+ return 1
+
+@@ -4699,7 +4700,7 @@ class depgraph(object):
+ return self._select_atoms_highest_available(*pargs, **kwargs)
+
+ def _select_atoms_highest_available(self, root, depstring,
+- myuse=None, parent=None, strict=True, trees=None, priority=None):
++ myuse=None, parent=None, strict=True, trees=None, priority=None, dep_type=None):
+ """This will raise InvalidDependString if necessary. If trees is
+ None then self._dynamic_config._filtered_trees is used."""
+
+@@ -4722,6 +4723,13 @@ class depgraph(object):
+ pkgsettings = self._frozen_config.pkgsettings[root]
+ if trees is None:
+ trees = self._dynamic_config._filtered_trees
++
++ # this one is needed to guarantee good readonly root
++ # resolution display in the merge list. required since
++ # parent (below) can be None
++ trees[root]["disp_parent"] = parent
++
++
+ mytrees = trees[root]
+ atom_graph = digraph()
+ if True:
+@@ -4753,7 +4761,7 @@ class depgraph(object):
+
+ mycheck = portage.dep_check(depstring, None,
+ pkgsettings, myuse=myuse,
+- myroot=root, trees=trees)
++ myroot=root, trees=trees, dep_type=dep_type)
+ finally:
+ # restore state
+ self._dynamic_config._autounmask = _autounmask_backup
+@@ -4829,6 +4837,7 @@ class depgraph(object):
+ continue
+ node_stack.append((child_node, node, child_atom))
+
++ trees[root].pop("disp_parent")
+ return selected_atoms
+
+ def _expand_virt_from_graph(self, root, atom):
+diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
+index 24340576c..4a1741f3a 100644
+--- a/pym/_emerge/resolver/output.py
++++ b/pym/_emerge/resolver/output.py
+@@ -22,11 +22,12 @@ from portage.localization import localized_size
+ from portage.package.ebuild.config import _get_feature_flags
+ from portage.package.ebuild._spawn_nofetch import spawn_nofetch
+ from portage.output import ( blue, colorize, create_color_func,
+- darkblue, darkgreen, green, nc_len, teal)
++ darkblue, darkgreen, green, nc_len, teal, yellow, turquoise)
+ bad = create_color_func("BAD")
+ from portage._sets.base import InternalPackageSet
+ from portage.util import writemsg_stdout
+ from portage.versions import best, cpv_getversion
++from portage.dep.dep_check import ro_selected
+
+ from _emerge.Blocker import Blocker
+ from _emerge.create_world_atom import create_world_atom
+@@ -563,6 +564,42 @@ class Display(object):
+ writemsg_stdout("%s\n" % (pkg,), noiselevel=-1)
+ return
+
++ def print_readonly_prefix(self):
++ """Performs the actual output printing for the readonly prefix
++ information stuff
++ """
++ out = sys.stdout
++
++ # print readonly selected packages
++ if len(ro_selected) > 0:
++ out.write("\n%s\n\n" % (darkgreen("Packages resolved from readonly installations:")))
++
++ ro_mismatch_warning = False
++ ro_dupcheck = []
++ for x in ro_selected:
++ tmp_type = x["type"].replace("END","")
++ while len(tmp_type) < 4:
++ tmp_type += " "
++ if x["parent"] and str(x["atom"]) not in ro_dupcheck:
++ out.write("[%s %s] %s %s %s (%s by %s)" % (teal("readonly"),
++ green(tmp_type), green(str(x["matches"][0])), yellow("from"),
++ blue(x["ro_root"]), turquoise(str(x["atom"])), green(x["parent"].cpv)))
++
++ ro_dupcheck.append(str(x["atom"]))
++
++ if x["host_mismatch"]:
++ ro_mismatch_warning = True
++ out.write(" %s\n" % (red("**")))
++ else:
++ out.write("\n")
++
++ if ro_mismatch_warning:
++ out.write("\n%s:" % (red("**")))
++ out.write(yellow(" WARNING: packages marked with ** have been resolved as a\n"))
++ out.write(yellow(" runtime dependency, but the CHOST variable for the parent\n"))
++ out.write(yellow(" and dependency package don't match. This could cause link\n"))
++ out.write(yellow(" errors. It is recommended to use RDEPEND READONLY_EPREFIX's\n"))
++ out.write(yellow(" only with matching CHOST portage instances.\n"))
+
+ def print_verbose(self, show_repos):
+ """Prints the verbose output to std_out
+@@ -913,6 +950,7 @@ class Display(object):
+ show_repos = self.quiet_repo_display and repoadd_set and repoadd_set != set(["0"])
+
+ # now finally print out the messages
++ self.print_readonly_prefix()
+ self.print_messages(show_repos)
+ self.print_blockers()
+ if self.conf.verbosity == 3:
+diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py
+index 2c9bf9715..6a2784207 100644
+--- a/pym/portage/_sets/__init__.py
++++ b/pym/portage/_sets/__init__.py
+@@ -21,6 +21,7 @@ from portage.const import _ENABLE_SET_CONFIG
+ from portage.exception import PackageSetNotFound
+ from portage.localization import _
+ from portage.util import writemsg_level
++from portage.util._path import exists_raise_eaccess
+ from portage.util.configparser import (SafeConfigParser,
+ NoOptionError, ParsingError, read_configs)
+
+@@ -281,6 +282,10 @@ def load_default_config(settings, trees):
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++
+ vcs_dirs = [_unicode_encode(x, encoding=_encodings['fs']) for x in VCS_DIRS]
+ def _getfiles():
+ for path, dirs, files in os.walk(os.path.join(global_config_path, "sets")):
+diff --git a/pym/portage/const.py b/pym/portage/const.py
+index d9c57f300..a3d927c3b 100644
+--- a/pym/portage/const.py
++++ b/pym/portage/const.py
+@@ -190,6 +190,7 @@ SUPPORTED_FEATURES = frozenset([
+ "notitles",
+ "parallel-fetch",
+ "parallel-install",
++ "prefix-chaining",
+ "prelink-checksums",
+ "preserve-libs",
+ "protect-owned",
+@@ -241,6 +242,11 @@ MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
+ #EPREFIX = ""
+ # END PREFIX LOCAL
+
++BPREFIX = EPREFIX
++
++# --prefix commandline arg always rules, ends up in os.environ["EPREFIX"]
++if "EPREFIX" in os.environ:
++ os.environ["PORTAGE_OVERRIDE_EPREFIX"] = os.environ["EPREFIX"]
+ # pick up EPREFIX from the environment if set
+ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
+ EPREFIX = os.environ["PORTAGE_OVERRIDE_EPREFIX"]
+diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
+index 77a72b5b1..f20c6763e 100644
+--- a/pym/portage/dbapi/vartree.py
++++ b/pym/portage/dbapi/vartree.py
+@@ -196,8 +196,19 @@ class vardbapi(dbapi):
+ self._counter_path = os.path.join(self._eroot,
+ CACHE_PATH, "counter")
+
+- self._plib_registry = PreservedLibsRegistry(settings["ROOT"],
+- os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry"))
++ plibreg_path = os.path.join(self._eroot, PRIVATE_PATH, "preserved_libs_registry")
++
++ if vartree:
++ self._kill_eprefix = vartree._kill_eprefix
++ else:
++ self._kill_eprefix = False
++
++ if self._kill_eprefix:
++ self._aux_cache_filename = self._aux_cache_filename.replace(EPREFIX, "")
++ self._counter_path = self._counter_path.replace(EPREFIX, "")
++ plibreg_path = plibreg_path.replace(EPREFIX, "")
++
++ self._plib_registry = PreservedLibsRegistry(settings["ROOT"], plibreg_path)
+ self._linkmap = LinkageMap(self)
+ chost = self.settings.get('CHOST')
+ if not chost:
+@@ -238,6 +249,9 @@ class vardbapi(dbapi):
+ # This is an optimized hotspot, so don't use unicode-wrapped
+ # os module and don't use os.path.join().
+ rValue = self._eroot + VDB_PATH + _os.sep + mykey
++ if self._kill_eprefix:
++ rValue = rValue.replace(EPREFIX, "")
++
+ if filename is not None:
+ # If filename is always relative, we can do just
+ # rValue += _os.sep + filename
+@@ -502,6 +516,9 @@ class vardbapi(dbapi):
+ returnme = []
+ basepath = os.path.join(self._eroot, VDB_PATH) + os.path.sep
+
++ if self._kill_eprefix:
++ basepath = os.path.join(self.root, basepath.replace(EPREFIX, ""))
++
+ if use_cache:
+ from portage import listdir
+ else:
+@@ -598,11 +615,17 @@ class vardbapi(dbapi):
+ del self.matchcache[mycat]
+ return list(self._iter_match(mydep,
+ self.cp_list(mydep.cp, use_cache=use_cache)))
++
++ _tmp_path = os.path.join(self._eroot, VDB_PATH, mycat)
++
++ if self._kill_eprefix:
++ _tmp_path = _tmp_path.replace(EPREFIX, "")
++
+ try:
+ if sys.hexversion >= 0x3030000:
+- curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime_ns
++ curmtime = os.stat(_tmp_path).st_mtime_ns
+ else:
+- curmtime = os.stat(os.path.join(self._eroot, VDB_PATH, mycat)).st_mtime
++ curmtime = os.stat(_tmp_path).st_mtime
+ except (IOError, OSError):
+ curmtime=0
+
+@@ -1450,7 +1473,7 @@ class vardbapi(dbapi):
+ class vartree(object):
+ "this tree will scan a var/db/pkg database located at root (passed to init)"
+ def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
+- settings=None):
++ settings=None, kill_eprefix=None):
+
+ if settings is None:
+ settings = portage.settings
+@@ -1468,6 +1491,7 @@ class vartree(object):
+ " constructor is unused",
+ DeprecationWarning, stacklevel=2)
+
++ self._kill_eprefix = kill_eprefix
+ self.settings = settings
+ self.dbapi = vardbapi(settings=settings, vartree=self)
+ self.populated = 1
+diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
+index 2896e2389..c700a3651 100644
+--- a/pym/portage/dep/dep_check.py
++++ b/pym/portage/dep/dep_check.py
+@@ -298,6 +298,95 @@ class _dep_choice(SlotObject):
+ __slots__ = ('atoms', 'slot_map', 'cp_map', 'all_available',
+ 'all_installed_slots', 'new_slot_count')
+
++ro_trees={}
++ro_vartrees={}
++ro_selected=[]
++
++def dep_match_readonly_roots(settings, atom, dep_type, parent=None):
++ if len(ro_trees) < len(settings.readonly_prefixes):
++ # MDUFT: create additional vartrees for every readonly root here.
++ # the ro_vartrees instances are created below as they are needed to
++ # avoid reading vartrees of portage instances which aren't required
++ # while resolving this dependencies.
++ for type in ("DEPEND","RDEPEND", "PDEPEND"):
++ ro_trees[type] = []
++
++ for ro_root, ro_dep_types in settings.readonly_prefixes.items():
++ if type in ro_dep_types:
++ ro_trees[type].append(ro_root)
++
++ if len(ro_trees) == 0:
++ return []
++
++ matches = []
++
++ for ro_root in ro_trees[dep_type]:
++ if not ro_root in ro_vartrees:
++ # target_root=ro_root ok? or should it be the real target_root?
++ _tmp_settings = portage.config(config_root=ro_root, target_root=ro_root,
++ config_incrementals=portage.const.INCREMENTALS)
++
++ ro_vartrees[ro_root] = portage.vartree(root=ro_root,
++ categories=_tmp_settings.categories,
++ settings=_tmp_settings, kill_eprefix=True)
++
++ ro_matches = ro_vartrees[ro_root].dbapi.match(atom)
++
++ if ro_matches:
++ ro_host_mismatch = False
++ if dep_type is "RDEPEND":
++ # we need to assure binary compatability, so it needs to be
++ # the same CHOST! But how? for now i cannot do anything...
++ if parent and parent.metadata["CHOST"] != ro_vartrees[ro_root].settings.get("CHOST", ""):
++ # provocate a big fat warning in the list of external packages.
++ ro_host_mismatch = True
++ pass
++
++ matches.append({ "ro_root": ro_root, "atom": atom, "matches": ro_matches,
++ "type": dep_type, "parent": parent, "host_mismatch": ro_host_mismatch })
++
++ return matches
++
++def dep_wordreduce_readonly(reduced, unreduced, settings, dep_type, parent):
++ for mypos, token in enumerate(unreduced):
++ # recurse if it's a list.
++ if isinstance(reduced[mypos], list):
++ reduced[mypos] = dep_wordreduce_readonly(reduced[mypos],
++ unreduced[mypos], settings, dep_type, parent)
++
++ # do nothing if it's satisfied already.
++ elif not reduced[mypos]:
++ ro_matches = dep_match_readonly_roots(settings, unreduced[mypos], dep_type, parent)
++
++ if ro_matches:
++ # TODO: select a match if there are more than one?
++ # for now, the first match is taken...
++ ro_selected.append(ro_matches[0])
++ reduced[mypos] = True
++
++ return reduced
++
++# this may be better placed somewhere else, but i put it here for now, to
++# keep all functions in the patch on one big heap.
++def readonly_pathmatch_any(settings, path):
++ path = path.lstrip('/')
++ # first try locally, and match that if it exists.
++ if os.path.exists(os.path.join(EPREFIX,path)):
++ return os.path.join(EPREFIX,path)
++
++ # after that try all readonly roots where DEPEND is allowed. this makes
++ # sure that executing binaries is possible from there.
++ for ro_root, ro_deps in settings.readonly_roots.items():
++ if "DEPEND" in ro_deps:
++ print(" --- checking %s --- " % (os.path.join(ro_root,path)))
++ if os.path.exists(os.path.join(ro_root,path)):
++ return os.path.join(ro_root,path)
++ break
++
++ # as a fallback make the string the same as it was originally.
++ # even though this path doesn't exist.
++ return os.path.join(EPREFIX,path)
++
+ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
+ minimize_slots=False):
+ """
+@@ -725,7 +814,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None,
+ assert(False) # This point should not be reachable
+
+ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+- use_cache=1, use_binaries=0, myroot=None, trees=None):
++ use_cache=1, use_binaries=0, myroot=None, trees=None, dep_type=None):
+ """
+ Takes a depend string, parses it, and selects atoms.
+ The myroot parameter is unused (use mysettings['EROOT'] instead).
+@@ -829,6 +918,14 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+ writemsg("mysplit: %s\n" % (mysplit), 1)
+ writemsg("mysplit2: %s\n" % (mysplit2), 1)
+
++ if dep_type is not None:
++ mysplit2=dep_wordreduce_readonly(unreduced=mysplit[:],
++ reduced=mysplit2, settings=mysettings,
++ dep_type=dep_type, parent=trees[myroot].get("disp_parent"))
++
++ writemsg("\n", 1)
++ writemsg("mysplit2 after readonly reduce: %s\n" % (mysplit2), 1)
++
+ selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
+ use_binaries=use_binaries, trees=trees, minimize_slots=dnf)
+
+diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
+index f7d7209ff..e37e5b1a9 100644
+--- a/pym/portage/package/ebuild/_config/LocationsManager.py
++++ b/pym/portage/package/ebuild/_config/LocationsManager.py
+@@ -326,6 +326,9 @@ class LocationsManager(object):
+ if portage.const.EPREFIX:
+ self.global_config_path = os.path.join(portage.const.EPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(self.global_config_path) and portage.const.BPREFIX:
++ self.global_config_path = os.path.join(portage.const.BPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
+
+ def set_port_dirs(self, portdir, portdir_overlay):
+ self.portdir = portdir
+diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
+index 059aa83ce..3bf6049e8 100644
+--- a/pym/portage/package/ebuild/config.py
++++ b/pym/portage/package/ebuild/config.py
+@@ -309,6 +309,7 @@ class config(object):
+ self.features = features_set(self)
+ self.features._features = copy.deepcopy(clone.features._features)
+ self._features_overrides = copy.deepcopy(clone._features_overrides)
++ self.readonly_prefixes = copy.deepcopy(clone.readonly_prefixes)
+
+ #Strictly speaking _license_manager is not immutable. Users need to ensure that
+ #extract_global_changes() is called right after __init__ (if at all).
+@@ -969,6 +970,63 @@ class config(object):
+
+ self._validate_commands()
+
++ # expand READONLY_EPREFIX to a list of all readonly portage instances
++ # all the way down to the last one. beware that ATM a deeper instance
++ # in the chain can provide more than the toplevel! this means that
++ # if you only inherit DEPENDS from one instance, that instance may
++ # inherit RDEPENDs from another one, making the top-level instance
++ # inherit RDEPENDs from there too - even if the intermediate prefix
++ # does not do this.
++ self.readonly_prefixes = {}
++ ro_cfg_root = config_root
++ ro_widest_depset = set(['DEPEND', 'RDEPEND', 'PDEPEND'])
++
++ while ro_cfg_root:
++ ro_make_conf_paths = [
++ os.path.join(ro_cfg_root, 'etc', 'make.conf'),
++ os.path.join(ro_cfg_root, MAKE_CONF_FILE)
++ ]
++ try:
++ if os.path.samefile(*ro_make_conf_paths):
++ ro_make_conf_paths.pop()
++ except OSError:
++ pass
++
++ ro_cfg_root = None
++ for ro_make_conf in ro_make_conf_paths:
++ if not os.path.exists(ro_make_conf):
++ continue
++
++ ro_cfg = getconfig(ro_make_conf, tolerant=True, allow_sourcing=True)
++ if not "READONLY_EPREFIX" in ro_cfg:
++ continue
++
++ if not ro_cfg["READONLY_EPREFIX"].find(":"):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s" % (ro_make_conf))
++
++ if ro_cfg_root is not None:
++ raise portage.exception.InvalidReadonlyERoot("ERROR: duplicate READONLY_EPREFIX in %s and %s" % tuple(ro_make_conf_paths))
++
++ (ro_cfg_root,ro_cfg_root_deps) = ro_cfg["READONLY_EPREFIX"].rsplit(":",1)
++
++ if not os.path.exists(ro_cfg_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: malformed READONLY_EPREFIX in %s: %s does not exist!" % (ro_make_conf, ro_cfg_root))
++
++ if os.path.samefile(ro_cfg_root, config_root):
++ raise portage.exception.InvalidReadonlyERoot("ERROR: cannot add this instance (%s) as READONLY_EPREFIX in %s." % (ro_cfg_root, ro_make_conf))
++
++ if ro_cfg_root in self.readonly_prefixes:
++ raise portage.exception.InvalidReadonlyERoot("ERROR: circular READONLY_EPREFIX's in %s. %s already checked for %s" % (ro_make_conf, ro_cfg_root, self.readonly_prefixes[ro_cfg_root]))
++
++ # intersect the widest depset with the current one to strip down
++ # the allowed dependency resolution to not be wider than the
++ # next higher one. this way we can prevent for a given prefix
++ # to resolve RDEPENDs from a prefix with a different CHOST that
++ # is a few levels deeper in the chain.
++ ro_widest_depset = set(ro_cfg_root_deps.split(",")) & ro_widest_depset
++ self.readonly_prefixes[ro_cfg_root] = ro_widest_depset
++ pass
++
+ for k in self._case_insensitive_vars:
+ if k in self:
+ self[k] = self[k].lower()
+@@ -2771,6 +2829,10 @@ class config(object):
+ if not (src_phase and eapi_attrs.broot):
+ mydict.pop("BROOT", None)
+
++ # populate with PORTAGE_READONLY_EPREFIXES
++ if self.readonly_prefixes and len(self.readonly_prefixes) > 0:
++ mydict["PORTAGE_READONLY_EPREFIXES"] = ':'.join(self.readonly_prefixes)
++
+ # Prefix variables are supported beginning with EAPI 3, or when
+ # force-prefix is in FEATURES, since older EAPIs would otherwise be
+ # useless with prefix configurations. This brings compatibility with
+diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
+index f8b784d6b..a6548a43b 100644
+--- a/pym/portage/package/ebuild/doebuild.py
++++ b/pym/portage/package/ebuild/doebuild.py
+@@ -52,6 +52,7 @@ from portage import bsd_chflags, \
+ unmerge, _encodings, _os_merge, \
+ _shell_quote, _unicode_decode, _unicode_encode
+ from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \
++ GLOBAL_CONFIG_PATH, \
+ EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, PORTAGE_PYM_PACKAGES, EPREFIX, MACOSSANDBOX_PROFILE
+ from portage.data import portage_gid, portage_uid, secpass, \
+ uid, userpriv_groups
+@@ -73,6 +74,7 @@ from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs
+ from portage.process import find_binary
+ from portage.util import ( apply_recursive_permissions,
+ apply_secpass_permissions,
++ getconfig,
+ noiselimit,
+ shlex_split,
+ varexpand,
+@@ -80,6 +82,7 @@ from portage.util import ( apply_recursive_permissions,
+ writemsg_stdout,
+ write_atomic
+ )
++from portage.util._path import exists_raise_eaccess
+ from portage.util.cpuinfo import get_cpu_count
+ from portage.util.lafilefixer import rewrite_lafile
+ from portage.util.compression_probe import _compressors
+@@ -243,8 +246,27 @@ def _doebuild_path(settings, eapi=None):
+
+ for x in portage_bin_path:
+ path.append(os.path.join(x, "ebuild-helpers"))
++
++ # PREFIX CHAINING: append default path for all prefixes involved
++ pfxs = [ eprefix ]
++ pfxs.extend(settings.readonly_prefixes)
++ for prefix in pfxs:
++ global_config_path = os.path.join(prefix, GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ make_globals_path = os.path.join(global_config_path, "make.globals")
++ if exists_raise_eaccess(make_globals_path):
++ expand_map = { "EPREFIX": prefix }
++ pxcfg = getconfig(make_globals_path, True, expand_map)
++ pxdefp = [x for x in pxcfg.get("DEFAULT_PATH", "").split(":") if x]
++ for x in pxdefp:
++ if x.startswith(prefix) and not x in path:
++ path.append(x)
++ else:
++ pxdefs = [prefix + "/usr/sbin", prefix + "/usr/bin", prefix + "/sbin", prefix + "/bin"]
++ path.extend(pxdefs)
++ # END PREFIX CHAINING
++
+ path.extend(prerootpath)
+- path.extend(defaultpath)
++ # path.extend(defaultpath) # PREFIX CHAINING appends the default path for involved prefixes above
+ path.extend(rootpath)
+ path.extend(extrapath)
+ # END PREFIX LOCAL
+diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py
+index 265d0c9fc..2ec6ff472 100644
+--- a/pym/portage/package/ebuild/fetch.py
++++ b/pym/portage/package/ebuild/fetch.py
+@@ -43,6 +43,7 @@ from portage.output import colorize, EOutput
+ from portage.util import apply_recursive_permissions, \
+ apply_secpass_permissions, ensure_dirs, grabdict, shlex_split, \
+ varexpand, writemsg, writemsg_level, writemsg_stdout
++from portage.util._path import exists_raise_eaccess
+ from portage.process import spawn
+
+ _userpriv_spawn_kwargs = (
+@@ -874,6 +875,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
+ global_config_path = GLOBAL_CONFIG_PATH
+ if portage.const.EPREFIX:
+ global_config_path = os.path.join(portage.const.EPREFIX,
++ GLOBAL_CONFIG_PATH.lstrip(os.sep))
++ if not exists_raise_eaccess(global_config_path) and portage.const.BPREFIX:
++ global_config_path = os.path.join(portage.const.BPREFIX,
+ GLOBAL_CONFIG_PATH.lstrip(os.sep))
+
+ missing_file_param = False
+diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
+index 3bccf6f74..cacd63797 100644
+--- a/pym/portage/sync/controller.py
++++ b/pym/portage/sync/controller.py
+@@ -94,19 +94,20 @@ class SyncManager(object):
+ self.module_controller = portage.sync.module_controller
+ self.module_names = self.module_controller.module_names
+ self.hooks = {}
+- for _dir in ["repo.postsync.d", "postsync.d"]:
+- postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+- portage.USER_CONFIG_PATH, _dir)
+- hooks = OrderedDict()
+- for filepath in util._recursive_file_list(postsync_dir):
+- name = filepath.split(postsync_dir)[1].lstrip(os.sep)
+- if os.access(filepath, os.X_OK):
+- hooks[filepath] = name
+- else:
+- writemsg_level(" %s %s hook: '%s' is not executable\n"
+- % (warn("*"), _dir, _unicode_decode(name),),
+- level=logging.WARN, noiselevel=2)
+- self.hooks[_dir] = hooks
++ for _confroot in [self.settings["PORTAGE_CONFIGROOT"], portage.const.BPREFIX]:
++ for _dir in ["repo.postsync.d", "postsync.d"]:
++ postsync_dir = os.path.join(_confroot,
++ portage.USER_CONFIG_PATH, _dir)
++ hooks = OrderedDict()
++ for filepath in util._recursive_file_list(postsync_dir):
++ name = filepath.split(postsync_dir)[1].lstrip(os.sep)
++ if os.access(filepath, os.X_OK):
++ hooks[filepath] = name
++ else:
++ writemsg_level(" %s %s hook: '%s' is not executable\n"
++ % (warn("*"), _dir, _unicode_decode(name),),
++ level=logging.WARN, noiselevel=2)
++ self.hooks[_dir] = hooks
+
+ def __getattr__(self, name):
+ if name == 'async':
+diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py
+index a063621c1..968fbd339 100644
+--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py
++++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py
+@@ -12,7 +12,7 @@ from portage import _os_merge
+ from portage import _unicode_decode
+ from portage import _unicode_encode
+ from portage.cache.mappings import slot_dict_class
+-from portage.const import EPREFIX
++from portage.const import BPREFIX
+ from portage.dep.soname.multilib_category import compute_multilib_category
+ from portage.exception import CommandNotFound, InvalidData
+ from portage.localization import _
+@@ -268,7 +268,7 @@ class LinkageMapELF(object):
+ continue
+ plibs.update((x, cpv) for x in items)
+ if plibs:
+- args = [os.path.join(EPREFIX or "/", "usr/bin/scanelf"), "-qF", "%a;%F;%S;%r;%n"]
++ args = [os.path.join(BPREFIX or "/", "usr/bin/scanelf"), "-qF", "%a;%F;%S;%r;%n"]
+ args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
+ for x in plibs)
+ try:
+--
+2.16.1
+
diff --git a/sys-apps/portage/portage-2.3.40.1.ebuild b/sys-apps/portage/portage-2.3.40.1.ebuild
index bf7393b3ac..0bea1d9f01 100644
--- a/sys-apps/portage/portage-2.3.40.1.ebuild
+++ b/sys-apps/portage/portage-2.3.40.1.ebuild
@@ -91,10 +91,9 @@ pkg_setup() {
python_prepare_all() {
distutils-r1_python_prepare_all
- # fails to apply
- #epatch "${FILESDIR}"/${PN}-2.3.10-ebuildshell.patch # 155161
+ epatch "${FILESDIR}"/${PN}-2.3.40-ebuildshell.patch # 155161
use prefix-chaining &&
- epatch "${FILESDIR}"/${PN}-2.3.18-prefix-chaining.patch
+ epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2018-06-22 14:34 Michael Haubenwallner
0 siblings, 0 replies; 14+ messages in thread
From: Michael Haubenwallner @ 2018-06-22 14:34 UTC (permalink / raw
To: gentoo-commits
commit: b69fe7bafe8c39c105de5545dc3903af76f233f4
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 22 13:34:27 2018 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Fri Jun 22 13:45:09 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=b69fe7ba
sys-apps/portage: add the stacked-prefix patch (#658572)
Package-Manager: Portage-2.3.24, Repoman-2.3.6
.../files/portage-2.3.40-stacked-prefix.patch | 59 ++++++++++++++++++++++
sys-apps/portage/portage-2.3.40.2.ebuild | 3 +-
2 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/sys-apps/portage/files/portage-2.3.40-stacked-prefix.patch b/sys-apps/portage/files/portage-2.3.40-stacked-prefix.patch
new file mode 100644
index 0000000000..d967d1faf7
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.3.40-stacked-prefix.patch
@@ -0,0 +1,59 @@
+From 8a121d477a9a13569be3fb50eaeaa1162ed884bd Mon Sep 17 00:00:00 2001
+From: Michael Haubenwallner <haubi@gentoo.org>
+Date: Tue, 19 Jun 2018 16:39:12 +0200
+Subject: [PATCH 1/2] introduce the 'stacked-prefix' FEATURE
+
+When we merge into another EPREFIX, but not into some ROOT,
+and CHOST is equal to CBUILD, build tools found in EPREFIX
+perfectly work for the current build environment.
+In a "stacked prefix" we explicitly utilize this situation.
+
+This is useful during prefix bootstrap (#655414, #655326), but also to
+build packages for targets unable to support the full portage toolchain
+(native Windows, MinGW), but otherwise do not require a full cross
+compilation setup.
+---
+ bin/phase-helpers.sh | 14 ++++++++++++++
+ pym/portage/const.py | 1 +
+ 2 files changed, 15 insertions(+)
+
+diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
+index 75d92b407..c5a818db7 100644
+--- a/bin/phase-helpers.sh
++++ b/bin/phase-helpers.sh
+@@ -927,6 +927,20 @@ ___best_version_and_has_version_common() {
+ fi ;;
+ esac
+
++ if ___eapi_has_prefix_variables &&
++ has "${root_arg}" '--host-root' '-b' &&
++ has stacked-prefix ${FEATURES} &&
++ [[ -z ${ROOT%/} ]] &&
++ [[ ${CBUILD} == ${CHOST} ]] &&
++ [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] &&
++ :; then
++ # When we merge into another EPREFIX, but not into some ROOT,
++ # and CHOST is equal to CBUILD, build tools found in EPREFIX
++ # perfectly work for the current build environment.
++ # In a "stacked prefix" we explicitly utilize this situation.
++ "${FUNCNAME[1]}" "${atom}" && return 0
++ fi
++
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
+ cmd+=("${PORTAGE_BIN_PATH}"/ebuild-ipc "${FUNCNAME[1]}" "${root}" "${atom}")
+ else
+diff --git a/pym/portage/const.py b/pym/portage/const.py
+index d9c57f300..be7bf1036 100644
+--- a/pym/portage/const.py
++++ b/pym/portage/const.py
+@@ -203,6 +203,7 @@ SUPPORTED_FEATURES = frozenset([
+ "splitdebug",
+ "split-elog",
+ "split-log",
++ "stacked-prefix",
+ "strict",
+ "strict-keepdir",
+ "stricter",
+--
+2.16.1
+
diff --git a/sys-apps/portage/portage-2.3.40.2.ebuild b/sys-apps/portage/portage-2.3.40.2.ebuild
index 8e6b1c32a5..63935aaa09 100644
--- a/sys-apps/portage/portage-2.3.40.2.ebuild
+++ b/sys-apps/portage/portage-2.3.40.2.ebuild
@@ -92,7 +92,8 @@ python_prepare_all() {
distutils-r1_python_prepare_all
epatch "${FILESDIR}"/${PN}-2.3.40-ebuildshell.patch # 155161
- use prefix-chaining &&
+ epatch "${FILESDIR}"/${PN}-2.3.40-stacked-prefix.patch # 658572
+ use prefix-chaining && # maybe useful even with stacked-prefix
epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
if use native-extensions; then
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2018-06-25 8:41 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2018-06-25 8:41 UTC (permalink / raw
To: gentoo-commits
commit: f9b900006df9c0561a60758f442b80ea99023154
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 25 08:39:40 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 25 08:39:40 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f9b90000
sys-apps/portage: version bump, includes stacked-prefix feature
Package-Manager: Portage-2.3.40.2-prefix, Repoman-2.3.9
sys-apps/portage/Manifest | 2 +-
.../files/portage-2.3.40-stacked-prefix.patch | 59 ----------------------
...age-2.3.40.2.ebuild => portage-2.3.40.3.ebuild} | 1 -
3 files changed, 1 insertion(+), 61 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index d89f09de53..61a3d79f0d 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,4 +1,4 @@
DIST prefix-portage-2.2.28.tar.bz2 1187416 BLAKE2B 1ec27def0b427f60b38dc60178461c2395d388500b6f20d5f9dcd76090c5e68e6578da0073cb5cc3b5b2beb2c2c55ef12afef70d7562fba0a6f0cf90847624ea SHA512 ea0661783d421d204272b9a210745aa2040a18ea347299b3d768588e10ca8dd2e24b46975249bf30010bf565514aea640f4edb9db2ca064312c899304a8c1f42
DIST prefix-portage-2.3.13.tar.bz2 1205509 BLAKE2B 851492dc1d3bd55721dfc1662af98a193c8071d87b6b64a09a736864031fa6482fe59a1662789ce8320b156241470688a9a815d79f7367b79500e590a41604f5 SHA512 4d59d04b9d6a896a545a40e04973a1c29f421b5d90f08012cb00a27ba1081eb914ddb625f543c26c93c8c75ba690f6ec72e4d9301f4f8e01a5fc68a3438cf46c
DIST prefix-portage-2.3.18.tar.bz2 1230290 BLAKE2B 9a7a290493293f166520931aab32a720519ebec15f4c74fe0b0dcd7cc930d591c24e3c87cae4722da119d57826b020b37092ec492bb4e12b774e51334eccf156 SHA512 508a5891fc28297e68baf031f4e99674a58c6268b16d50e094adc6676fb42f81bb81bd6f3dc70c24636be64ae015db51df86c49267c8c5a98129fe5e006310d7
-DIST prefix-portage-2.3.40.2.tar.bz2 1216158 BLAKE2B d8806b4047ded791e8646ea64c568f9fe0354a5cf2a54a1616c1fc1050f0476b218522c56a9f06636e2a70f70571d762186ba30057efe213ffb7270bc7ef503c SHA512 d85e3eea4149f2fe3ec8dc2fb15d1fd65c5d78c67828c36f064f0663b6305c5d06c1a29f3d62c777f0d1b619aa60178e5a3fbfbadb0a03bbde0570c5913b0675
+DIST prefix-portage-2.3.40.3.tar.bz2 1253190 BLAKE2B 53e60b561e1f9b2a5367a1a23a74ba315358b8e7eb05eead2a46078198b92786745dbd07ab1bf69587866f462955a5dd6c0bc3eb51dbe507bfbff31d899c5f45 SHA512 67c2d7554c9236748b25a8b9f0f60736beda535298395ba2eb86dd5634b6520d645df193914f079d2c61cfa0d8f263f67c3476828319e2395dec2e45cf4b9b14
diff --git a/sys-apps/portage/files/portage-2.3.40-stacked-prefix.patch b/sys-apps/portage/files/portage-2.3.40-stacked-prefix.patch
deleted file mode 100644
index d967d1faf7..0000000000
--- a/sys-apps/portage/files/portage-2.3.40-stacked-prefix.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 8a121d477a9a13569be3fb50eaeaa1162ed884bd Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <haubi@gentoo.org>
-Date: Tue, 19 Jun 2018 16:39:12 +0200
-Subject: [PATCH 1/2] introduce the 'stacked-prefix' FEATURE
-
-When we merge into another EPREFIX, but not into some ROOT,
-and CHOST is equal to CBUILD, build tools found in EPREFIX
-perfectly work for the current build environment.
-In a "stacked prefix" we explicitly utilize this situation.
-
-This is useful during prefix bootstrap (#655414, #655326), but also to
-build packages for targets unable to support the full portage toolchain
-(native Windows, MinGW), but otherwise do not require a full cross
-compilation setup.
----
- bin/phase-helpers.sh | 14 ++++++++++++++
- pym/portage/const.py | 1 +
- 2 files changed, 15 insertions(+)
-
-diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
-index 75d92b407..c5a818db7 100644
---- a/bin/phase-helpers.sh
-+++ b/bin/phase-helpers.sh
-@@ -927,6 +927,20 @@ ___best_version_and_has_version_common() {
- fi ;;
- esac
-
-+ if ___eapi_has_prefix_variables &&
-+ has "${root_arg}" '--host-root' '-b' &&
-+ has stacked-prefix ${FEATURES} &&
-+ [[ -z ${ROOT%/} ]] &&
-+ [[ ${CBUILD} == ${CHOST} ]] &&
-+ [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] &&
-+ :; then
-+ # When we merge into another EPREFIX, but not into some ROOT,
-+ # and CHOST is equal to CBUILD, build tools found in EPREFIX
-+ # perfectly work for the current build environment.
-+ # In a "stacked prefix" we explicitly utilize this situation.
-+ "${FUNCNAME[1]}" "${atom}" && return 0
-+ fi
-+
- if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
- cmd+=("${PORTAGE_BIN_PATH}"/ebuild-ipc "${FUNCNAME[1]}" "${root}" "${atom}")
- else
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index d9c57f300..be7bf1036 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -203,6 +203,7 @@ SUPPORTED_FEATURES = frozenset([
- "splitdebug",
- "split-elog",
- "split-log",
-+ "stacked-prefix",
- "strict",
- "strict-keepdir",
- "stricter",
---
-2.16.1
-
diff --git a/sys-apps/portage/portage-2.3.40.2.ebuild b/sys-apps/portage/portage-2.3.40.3.ebuild
similarity index 99%
rename from sys-apps/portage/portage-2.3.40.2.ebuild
rename to sys-apps/portage/portage-2.3.40.3.ebuild
index 63935aaa09..2ebda124cb 100644
--- a/sys-apps/portage/portage-2.3.40.2.ebuild
+++ b/sys-apps/portage/portage-2.3.40.3.ebuild
@@ -92,7 +92,6 @@ python_prepare_all() {
distutils-r1_python_prepare_all
epatch "${FILESDIR}"/${PN}-2.3.40-ebuildshell.patch # 155161
- epatch "${FILESDIR}"/${PN}-2.3.40-stacked-prefix.patch # 658572
use prefix-chaining && # maybe useful even with stacked-prefix
epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2020-08-02 11:43 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2020-08-02 11:43 UTC (permalink / raw
To: gentoo-commits
commit: e4209bd2ca1ed72324cac02cd49a0634114c5f10
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 2 11:43:06 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Aug 2 11:43:06 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e4209bd2
sys-apps/portage: cleanup and version bump 3.0.1
Package-Manager: Portage-3.0.1-prefix, Repoman-2.3.23
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 3 +-
sys-apps/portage/files/05portage.envd | 1 -
sys-apps/portage/files/portage-2.2.28-cygwin.patch | 16 -
.../files/portage-2.2.28-ebuildshell-r1.patch | 354 --------------------
.../portage/files/portage-2.3.10-ebuildshell.patch | 355 ---------------------
.../portage/files/portage-2.3.40-ebuildshell.patch | 354 --------------------
sys-apps/portage/files/portage-ccache.conf | 2 +
sys-apps/portage/metadata.xml | 1 -
sys-apps/portage/portage-2.3.100.ebuild | 264 ---------------
sys-apps/portage/portage-2.3.68.ebuild | 264 ---------------
...{portage-2.3.84.ebuild => portage-3.0.1.ebuild} | 117 ++++---
11 files changed, 79 insertions(+), 1652 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 7e8f3291c5..40b9f12b82 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,3 +1,2 @@
DIST prefix-portage-2.3.100.tar.bz2 1331695 BLAKE2B 165f113041da8ad1150cc59d25a420effaa163a7694ba8ff36ce1e5fa75669b8fde31ad74594b28b987f9ec5685b9a31aa5228419afd476726ba17ec8f7575db SHA512 8163bfd4e83e48d560dd07150dd468d3b4a63d1507d23226107479bd5de9da3cd94308851b64c63851572288877cb2774f986f8c1a5163521a341ce4c72fbf0c
-DIST prefix-portage-2.3.68.tar.bz2 1283044 BLAKE2B 81a9462c2b34b64baff78bc046676abf147a6840f7fb2872c9e26eef5a110e2c53b550ac213f734f7c4e70e4b220ea62d885cd99652d9093448f6e5c4633a115 SHA512 7c6124e0b01fd1fdba68a5cb68882baa2301945faf559bb61afd6b632128ca435d7e9a596b1079bd744ed4155041399ba0a3779190c9fa891b5dc815ccb46813
-DIST prefix-portage-2.3.84.tar.bz2 1289922 BLAKE2B 1644b7c1a03b7fbccabe24bfd9c8378d12aeabeda2db35e286372901898d5f572c39e36625fbc2914334ca64e38e1320adca0143a9898fca64223be7d8a877cc SHA512 e243e21405a53e6ff234a7851fc4ef869450dc213acd6ed2168329c7c947289a97c60104aa31bd85319b3fef0abbc2c5759608abd795edc426b06ddea2ce3cdb
+DIST prefix-portage-3.0.1.tar.bz2 1279330 BLAKE2B ac94a2c2b56f23cf35cb229ae8719077e41fe7fb8e74d16beb3542b43d246d6c26dce73b9cec4c126b65b9bf0b4452bc233a83aeb4c873e8dd7c8d5742008221 SHA512 5c141b80e20f11aad6990e5f42fcc2cddb6475e03fc978fd1446773dd6833dd4ccf96b07440e1184cb95e210654218011b383872004907a915164813da22663c
diff --git a/sys-apps/portage/files/05portage.envd b/sys-apps/portage/files/05portage.envd
deleted file mode 100644
index ec949055ca..0000000000
--- a/sys-apps/portage/files/05portage.envd
+++ /dev/null
@@ -1 +0,0 @@
-PYTHONPATH="@GENTOO_PORTAGE_EPREFIX@/usr/lib/portage/pym"
diff --git a/sys-apps/portage/files/portage-2.2.28-cygwin.patch b/sys-apps/portage/files/portage-2.2.28-cygwin.patch
deleted file mode 100644
index 9a9bbec43a..0000000000
--- a/sys-apps/portage/files/portage-2.2.28-cygwin.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- prefix-portage-2.2.28/bin/helper-functions.sh.orig 2016-11-16 15:43:02.338368826 +0100
-+++ prefix-portage-2.2.28/bin/helper-functions.sh 2016-11-16 15:43:21.498359600 +0100
-@@ -21,11 +21,12 @@
- # Setup a pipe for children to write their pids to when they finish.
- # We have to allocate two fd's because POSIX has undefined behavior
- # when you open a FIFO for simultaneous read/write. #487056
-+ # And Cygwin supports just one read/write fd at once. #583962
- local pipe=$(mktemp -t multijob.XXXXXX)
- rm -f "${pipe}"
- mkfifo -m 600 "${pipe}"
-- __redirect_alloc_fd mj_write_fd "${pipe}"
- __redirect_alloc_fd mj_read_fd "${pipe}"
-+ __redirect_alloc_fd mj_write_fd "${pipe}" '>'
- rm -f "${pipe}"
-
- # See how many children we can fork based on the user's settings.
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch
deleted file mode 100644
index 298f0a0b08..0000000000
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-From bd58cc5f041558ab0885a1bf733319c38a24f24b Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH] Add the ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 145 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 57 ++++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- pym/_emerge/AbstractEbuildProcess.py | 1 +
- pym/portage/const.py | 1 +
- 6 files changed, 194 insertions(+), 18 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index a400ef7..b5a4eaa 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -112,7 +112,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -524,6 +524,149 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+
-+ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index a4cdc54..1c4ad58 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
-
- var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(r'(\\"|"|\')\s*$')
--readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(r'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -29,7 +30,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = ''
-@@ -37,14 +38,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ sys.stderr.write(var + "\n")
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += 'r'
- if declare_opts:
-- line = 'declare -%s %s' % \
-- (declare_opts, line[readonly_match.end():])
-+ line = 'declare -%s %s%s' % \
-+ (declare_opts, var, line[readonly_match.end():])
- else:
-- line = 'declare ' + line[readonly_match.end():]
-+ line = 'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -68,6 +74,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -77,7 +85,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace("\1", ""))
- continue
- else:
-@@ -86,8 +94,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -124,13 +134,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -154,5 +179,5 @@ if __name__ == "__main__":
-
- var_pattern = "^(%s)$" % "|".join(var_pattern)
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index f0bf001..706660d 100644
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index aea189e..46b0aa4 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -380,6 +380,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 8bd30a6..4ff78b4 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -161,6 +161,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 179efce..0a91aaf 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -142,6 +142,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.10.2
-
diff --git a/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
deleted file mode 100644
index d0381a0696..0000000000
--- a/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
+++ /dev/null
@@ -1,355 +0,0 @@
-From 05a16e4c910f7dc053358d8519c6708d3a4b14ca Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH] Add ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 57 ++++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- pym/_emerge/AbstractEbuildProcess.py | 1 +
- pym/portage/const.py | 1 +
- 6 files changed, 195 insertions(+), 18 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index a60a24d..b592372 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -121,7 +121,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -533,6 +533,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
-+
-+ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index 029e491..0ddda7c 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
-
- var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(r'(\\"|"|\')\s*$')
--readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(r'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -29,7 +30,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = ''
-@@ -37,14 +38,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ sys.stderr.write(var + "\n")
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += 'r'
- if declare_opts:
-- line = 'declare -%s %s' % \
-- (declare_opts, line[readonly_match.end():])
-+ line = 'declare -%s %s%s' % \
-+ (declare_opts, var, line[readonly_match.end():])
- else:
-- line = 'declare ' + line[readonly_match.end():]
-+ line = 'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -68,6 +74,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -77,7 +85,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace("\1", ""))
- continue
- else:
-@@ -86,8 +94,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -124,13 +134,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -154,5 +179,5 @@ if __name__ == "__main__":
-
- var_pattern = "^(%s)$" % "|".join(var_pattern)
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index 4c6ca3f..bbb5780 100755
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index 653e8bc..2bb8e71 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 8bd30a6..4ff78b4 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -161,6 +161,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 172c5b1..a0ad1f9 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -160,6 +160,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.10.2
-
diff --git a/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch
deleted file mode 100644
index 0c1e48a82d..0000000000
--- a/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-From 8c6b115fa0325b5bed2e1a9c4c8e8af45cdecc2e Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH 1/2] Add ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 55 +++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- pym/_emerge/AbstractEbuildProcess.py | 1 +
- pym/portage/const.py | 1 +
- 6 files changed, 194 insertions(+), 17 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f76a48d8e..683a4e9c1 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -121,7 +121,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -547,6 +547,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
-+
-+ env -i HOME=~ ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index 06cac7214..5590dbfc4 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -12,7 +12,8 @@ func_end_re = re.compile(br'^\}$')
-
- var_assign_re = re.compile(br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(br'(\\"|"|\')\s*$')
--readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(br'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(br'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -27,7 +28,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = b''
-@@ -35,14 +36,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ getattr(sys.stderr, 'buffer', sys.stderr).write(var + b'\n')
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += b'r'
- if declare_opts:
- line = b'declare -' + declare_opts + \
-- b' ' + line[readonly_match.end():]
-+ b' ' + var + line[readonly_match.end():]
- else:
-- line = b'declare ' + line[readonly_match.end():]
-+ line = b'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -66,6 +72,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -75,7 +83,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace(b"\1", b""))
- continue
- else:
-@@ -84,8 +92,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -122,13 +132,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -151,5 +176,5 @@ if __name__ == "__main__":
-
- var_pattern = b'^(' + b'|'.join(var_pattern) + b')$'
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index bb17382d4..af35a3327 100755
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index b0c1aa4f2..568f350a0 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 370cac529..a521596e5 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -181,6 +181,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 3c23c85ed..d9c57f300 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -161,6 +161,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.16.1
-
diff --git a/sys-apps/portage/files/portage-ccache.conf b/sys-apps/portage/files/portage-ccache.conf
new file mode 100644
index 0000000000..37857fde31
--- /dev/null
+++ b/sys-apps/portage/files/portage-ccache.conf
@@ -0,0 +1,2 @@
+# Prevent ccache files from being cleaned
+x /var/tmp/ccache
diff --git a/sys-apps/portage/metadata.xml b/sys-apps/portage/metadata.xml
index 1ffd22f625..062dafe624 100644
--- a/sys-apps/portage/metadata.xml
+++ b/sys-apps/portage/metadata.xml
@@ -11,7 +11,6 @@
<email>dev-portage@gentoo.org</email>
</maintainer>
<use>
- <flag name="epydoc">Build html API documentation with epydoc.</flag>
<flag name="apidoc">Build html API documentation with sphinx-apidoc.</flag>
<flag name="gentoo-dev">Enable features required for Gentoo ebuild development.</flag>
<flag name="ipc">Use inter-process communication between portage and
diff --git a/sys-apps/portage/portage-2.3.100.ebuild b/sys-apps/portage/portage-2.3.100.ebuild
deleted file mode 100644
index a651d7eeb5..0000000000
--- a/sys-apps/portage/portage-2.3.100.ebuild
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=(
- pypy3
- python3_{6,7,8,9}
- python2_7
-)
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-
-inherit eutils distutils-r1 multilib
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-LICENSE="GPL-2"
-KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="0"
-IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
-
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )"
-# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-RDEPEND="
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- !build? (
- >=sys-apps/sed-4.0.5
- app-shells/bash:0[readline]
- >=app-admin/eselect-1.2
- $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
- python{2_7,3_4,3_5} pypy)
- )
- elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_uclibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- kernel_linux? ( >=app-misc/pax-utils-0.1.17 )
- kernel_SunOS? ( >=app-misc/pax-utils-0.1.17 )
- kernel_FreeBSD? ( >=app-misc/pax-utils-0.1.17 )
- kernel_Darwin? ( >=app-misc/pax-utils-0.1.18 )
- kernel_AIX? ( >=sys-apps/aix-miscutils-0.1.1634 )
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
- python2_7 pypy)
- ) )
- !<app-admin/logrotate-3.8.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- userland_GNU? ( >=sys-apps/coreutils-6.4 )
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
-
-SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-TARBALL_PV=${PV}
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-
-pkg_setup() {
- use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
-}
-
-python_prepare_all() {
- distutils-r1_python_prepare_all
-
- epatch "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
-
- if use native-extensions; then
- printf "[build_ext]\nportage-ext-modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use epydoc && targets+=( epydoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use epydoc && targets+=(
- install_epydoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- # comment out sanity test until it is fixed to work
- # with the new PORTAGE_PYM_PATH
- #if [[ $ROOT == / ]] ; then
- ## Run some minimal tests as a sanity check.
- #local test_runner=$(find "${ED}" -name runTests)
- #if [[ -n $test_runner && -x $test_runner ]] ; then
- #einfo "Running preinst sanity tests..."
- #"$test_runner" || die "preinst sanity tests failed"
- #fi
- #fi
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
- fi
-}
diff --git a/sys-apps/portage/portage-2.3.68.ebuild b/sys-apps/portage/portage-2.3.68.ebuild
deleted file mode 100644
index 083ed2521d..0000000000
--- a/sys-apps/portage/portage-2.3.68.ebuild
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=(
- pypy3
- python3_6 python3_7
- python2_7
-)
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-
-inherit eutils distutils-r1 multilib
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-LICENSE="GPL-2"
-KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="0"
-IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
-
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )"
-# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-RDEPEND="
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- !build? (
- >=sys-apps/sed-4.0.5
- app-shells/bash:0[readline]
- >=app-admin/eselect-1.2
- $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
- python{2_7,3_4,3_5} pypy)
- )
- elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_uclibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- kernel_linux? ( >=app-misc/pax-utils-0.1.17 )
- kernel_SunOS? ( >=app-misc/pax-utils-0.1.17 )
- kernel_FreeBSD? ( >=app-misc/pax-utils-0.1.17 )
- kernel_Darwin? ( >=app-misc/pax-utils-0.1.18 )
- kernel_AIX? ( >=sys-apps/aix-miscutils-0.1.1634 )
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
- python2_7 pypy)
- ) )
- !<app-admin/logrotate-3.8.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- userland_GNU? ( >=sys-apps/coreutils-6.4 )
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
-
-SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-TARBALL_PV=${PV}
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-
-pkg_setup() {
- use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
-}
-
-python_prepare_all() {
- distutils-r1_python_prepare_all
-
- epatch "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
-
- if use native-extensions; then
- printf "[build_ext]\nportage-ext-modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use epydoc && targets+=( epydoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use epydoc && targets+=(
- install_epydoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- # comment out sanity test until it is fixed to work
- # with the new PORTAGE_PYM_PATH
- #if [[ $ROOT == / ]] ; then
- ## Run some minimal tests as a sanity check.
- #local test_runner=$(find "${ED}" -name runTests)
- #if [[ -n $test_runner && -x $test_runner ]] ; then
- #einfo "Running preinst sanity tests..."
- #"$test_runner" || die "preinst sanity tests failed"
- #fi
- #fi
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
- fi
-}
diff --git a/sys-apps/portage/portage-2.3.84.ebuild b/sys-apps/portage/portage-3.0.1.ebuild
similarity index 70%
rename from sys-apps/portage/portage-2.3.84.ebuild
rename to sys-apps/portage/portage-3.0.1.ebuild
index 083ed2521d..cf3cc74f4b 100644
--- a/sys-apps/portage/portage-2.3.84.ebuild
+++ b/sys-apps/portage/portage-3.0.1.ebuild
@@ -1,46 +1,49 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=5
+EAPI=7
-PYTHON_COMPAT=(
- pypy3
- python3_6 python3_7
- python2_7
-)
+DISTUTILS_USE_SETUPTOOLS=no
+PYTHON_COMPAT=( pypy3 python3_{6..9} )
PYTHON_REQ_USE='bzip2(+),threads(+)'
-inherit eutils distutils-r1 multilib
+inherit distutils-r1 linux-info systemd prefix
DESCRIPTION="Portage package manager used in Gentoo Prefix"
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
+
LICENSE="GPL-2"
KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
SLOT="0"
-IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
+IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux xattr"
DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
>=app-arch/tar-1.27
dev-lang/python-exec:2
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )"
+ apidoc? (
+ dev-python/sphinx
+ dev-python/sphinx-epytext
+ )"
# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] (bug #425046).
# For compgen, require bash[readline] (bug #445576).
+# app-portage/gemato goes without PYTHON_USEDEP since we're calling
+# the executable.
RDEPEND="
+ app-arch/zstd
>=app-arch/tar-1.27
dev-lang/python-exec:2
!build? (
>=sys-apps/sed-4.0.5
app-shells/bash:0[readline]
>=app-admin/eselect-1.2
- $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
- python{2_7,3_4,3_5} pypy)
+ rsync-verify? (
+ >=app-portage/gemato-14[${PYTHON_USEDEP}]
+ >=app-crypt/openpgp-keys-gentoo-release-20180706
+ >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
+ )
)
elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
@@ -53,10 +56,10 @@ RDEPEND="
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3
- $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
- python2_7 pypy)
) )
- !<app-admin/logrotate-3.8.0"
+ !<app-admin/logrotate-3.8.0
+ !<app-portage/gentoolkit-0.4.6
+ !<app-portage/repoman-2.3.10"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
@@ -65,8 +68,6 @@ PDEPEND="
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
-REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
-
SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
prefix_src_archives() {
@@ -84,15 +85,27 @@ SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-pkg_setup() {
- use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
+pkg_pretend() {
+ local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
+
+ check_extra_config
}
python_prepare_all() {
distutils-r1_python_prepare_all
- epatch "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
+ eapply "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
+ eapply "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
+ if use gentoo-dev; then
+ einfo "Disabling --dynamic-deps by default for gentoo-dev..."
+ sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \
+ -i lib/_emerge/create_depgraph_params.py || \
+ die "failed to patch create_depgraph_params.py"
+
+ einfo "Enabling additional FEATURES for gentoo-dev..."
+ echo 'FEATURES="${FEATURES} strict-keepdir"' \
+ >> cnf/make.globals || die
+ fi
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
@@ -112,6 +125,12 @@ python_prepare_all() {
|| die "failed to append to make.globals"
fi
+ if use build || ! use rsync-verify; then
+ sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \
+ -e '/^sync-webrsync-verify-signature/s|yes|no|' \
+ -i cnf/repos.conf || die "sed failed"
+ fi
+
if [[ -n ${EPREFIX} ]] ; then
# PREFIX LOCAL: only hack const_autotool
local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
@@ -157,7 +176,7 @@ python_prepare_all() {
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
- done < <(find . -type f -print0)
+ done < <(find . -type f ! -name etc-update -print0)
einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
@@ -187,7 +206,7 @@ python_prepare_all() {
python_compile_all() {
local targets=()
use doc && targets+=( docbook )
- use epydoc && targets+=( epydoc )
+ use apidoc && targets+=( apidoc )
if [[ ${targets[@]} ]]; then
esetup.py "${targets[@]}"
@@ -220,8 +239,8 @@ python_install_all() {
install_docbook
--htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
)
- use epydoc && targets+=(
- install_epydoc
+ use apidoc && targets+=(
+ install_apidoc
--htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
)
@@ -230,6 +249,8 @@ python_install_all() {
esetup.py "${targets[@]}"
fi
+ systemd_dotmpfilesd "${FILESDIR}"/portage-ccache.conf
+
# Due to distutils/python-exec limitations
# these must be installed to /usr/bin.
local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
@@ -237,28 +258,42 @@ python_install_all() {
dodir /usr/sbin
for target in ${sbin_relocations}; do
einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
+ mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
done
}
pkg_preinst() {
- # comment out sanity test until it is fixed to work
- # with the new PORTAGE_PYM_PATH
- #if [[ $ROOT == / ]] ; then
- ## Run some minimal tests as a sanity check.
- #local test_runner=$(find "${ED}" -name runTests)
- #if [[ -n $test_runner && -x $test_runner ]] ; then
- #einfo "Running preinst sanity tests..."
- #"$test_runner" || die "preinst sanity tests failed"
- #fi
- #fi
+ python_setup
+ local sitedir=$(python_get_sitedir)
+ [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
+ env -u DISTDIR \
+ -u PORTAGE_OVERRIDE_EPREFIX \
+ -u PORTAGE_REPOSITORIES \
+ -u PORTDIR \
+ -u PORTDIR_OVERLAY \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.default_locations || die
+
+ env -u BINPKG_COMPRESS \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
+ if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
+ chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
+ fi
+
+ if has_version "<${CATEGORY}/${PN}-2.3.77"; then
+ elog "The emerge --autounmask option is now disabled by default, except for"
+ elog "portions of behavior which are controlled by the --autounmask-use and"
+ elog "--autounmask-license options. For backward compatibility, previous"
+ elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
+ elog "Users can get the old behavior simply by adding --autounmask to the"
+ elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
+ elog "change, see https://bugs.gentoo.org/658648."
fi
}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2020-12-04 11:44 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2020-12-04 11:44 UTC (permalink / raw
To: gentoo-commits
commit: a425220505c4e94abe9df6c7d7f64a9ee71764d3
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 4 11:44:02 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Dec 4 11:44:02 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a4252205
sys-apps/portage-3.0.10.3-r1: use correct multiprocessing patch
Package-Manager: Portage-3.0.10.3-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
.../portage-3.0.10-multiprocessing-no-spawn.patch | 32 +++++++++++-----------
...-3.0.10.3.ebuild => portage-3.0.10.3-r1.ebuild} | 0
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sys-apps/portage/files/portage-3.0.10-multiprocessing-no-spawn.patch b/sys-apps/portage/files/portage-3.0.10-multiprocessing-no-spawn.patch
index 19ae16b5ac..e93d2fc046 100644
--- a/sys-apps/portage/files/portage-3.0.10-multiprocessing-no-spawn.patch
+++ b/sys-apps/portage/files/portage-3.0.10-multiprocessing-no-spawn.patch
@@ -1,4 +1,4 @@
-Alteration of the original patch to force fork mode iso spawn
+Alteration of the following patch to force fork mode iso spawn
From f093da4a3a457d539e5682ccecdf91f254addd8c Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gentoo.org>
@@ -10,23 +10,23 @@ Force fork mode because spawn mode requires all argument to be
pickle-able, which currently is not the case. This is an issue because
Python 3.8 changed the default from fork to spawn on macOS.
-diff --git a/lib/portage/tests/runTests.py b/lib/portage/tests/runTests.py
-index 9514abebe0..6e33077aef 100755
---- a/lib/portage/tests/runTests.py
-+++ b/lib/portage/tests/runTests.py
-@@ -4,6 +4,7 @@
+diff --git a/bin/emerge b/bin/emerge
+index 8f1db61a6..3731a9081 100755
+--- a/bin/emerge
++++ b/bin/emerge
+@@ -2,6 +2,7 @@
+ # Copyright 2006-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
- import grp
+import multiprocessing
- import os
- import os.path as osp
import platform
-@@ -60,6 +61,7 @@ def debug_signal(signum, frame):
- os.environ["PATH"] = ":".join(path)
+ import signal
+ import sys
+@@ -44,6 +45,7 @@ try:
+ from _emerge.main import emerge_main
- if __name__ == "__main__":
-+ multiprocessing.set_start_method('fork')
- try:
- sys.exit(tests.main())
- finally:
+ if __name__ == "__main__":
++ multiprocessing.set_start_method('fork')
+ from portage.exception import IsADirectory, ParseError, \
+ PermissionDenied
+ portage.process.sanitize_fds()
diff --git a/sys-apps/portage/portage-3.0.10.3.ebuild b/sys-apps/portage/portage-3.0.10.3-r1.ebuild
similarity index 100%
rename from sys-apps/portage/portage-3.0.10.3.ebuild
rename to sys-apps/portage/portage-3.0.10.3-r1.ebuild
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2023-11-24 20:57 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2023-11-24 20:57 UTC (permalink / raw
To: gentoo-commits
commit: 108f1b7b98ffb347d4f55d18eacdc86d233c98be
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 24 20:57:01 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Nov 24 20:57:01 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=108f1b7b
sys-apps/portage-3.0.55: version bump
This version is meson-based, unforseen problems may arise...
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 1 +
sys-apps/portage/files/portage-tmpdir.conf | 2 +
sys-apps/portage/portage-3.0.55.ebuild | 296 +++++++++++++++++++++++++++++
3 files changed, 299 insertions(+)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index f2df550c6d..a4e5776821 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -2,3 +2,4 @@ DIST prefix-portage-3.0.21.tar.bz2 1339211 BLAKE2B 019cf0f3d2d1c45e7849221fc40b4
DIST prefix-portage-3.0.30.1.tar.bz2 1476396 BLAKE2B 955db5832b1d7d19e25c4ee644f7daa0dbfc7a259ea7018f207865aa8cf5eb8e1e8e2a31c90578162e181af6c043590f239b042e652c3eb2cba9f442bbfc0476 SHA512 1ff8afbee4b204488eb0ecb4bdd216bf754ae015a3bcd298d7b6fb0dd7a671ccbf31d9a4a49be8e3182708641abe008f25df5319e135aa25363b979d49517506
DIST prefix-portage-3.0.34.2.tar.bz2 1498499 BLAKE2B 47f53e4917bdf204eb23dadd9dc821c06da07d2e5c68cf0a3de908089e4121d45542e2120e57744db1c808a156595624915956e77f547ab671b1584b2c67cf0b SHA512 121dd885a73153e780e28c2e514d4b3babc44368aa6915b2009ed0b205051c2f6c37dd3ccfe8be5ea567e7bab2f9f9b0c5c5b81c49990fbac7360261721a5bb7
DIST prefix-portage-3.0.49.tar.bz2 1421955 BLAKE2B ac6e5b512f943826d0bf06225037885a138f3810db973a60c6dbca4f80d516e3aef3054b532f42a143b35702661a3d35ee59945f745b849dcd6fefbd4ff8f3cc SHA512 dee0035e048b1bfde5859b809bf6ffa3ca0674cd1d59d9cfcc14a279d87215223a6b4497274db7e443f27fd6dd05eadb043ae6872feb8fa8523994d9946b6879
+DIST prefix-portage-3.0.55.tar.bz2 1460532 BLAKE2B 840ce4036eddfba2b1a5c8e4c510174a5b4bcee72b00a3acdc8546b7778e0d0838e4aa75887fd8501bf1f811e74c0bf96c264569c28ce007a3705f1a22d8f1aa SHA512 00e5f9783a30d5da60da3686f616b23f4ec2413038bd8e8ee34665cc56ff2a2b0b0d0da8744a4d6dd6b99e20549e8031347a5db68d92d50ba5012c2cef782442
diff --git a/sys-apps/portage/files/portage-tmpdir.conf b/sys-apps/portage/files/portage-tmpdir.conf
new file mode 100644
index 0000000000..4f6e20ccb5
--- /dev/null
+++ b/sys-apps/portage/files/portage-tmpdir.conf
@@ -0,0 +1,2 @@
+d /var/tmp/portage 0775 portage portage
+d /tmp/portage 0775 portage portage
diff --git a/sys-apps/portage/portage-3.0.55.ebuild b/sys-apps/portage/portage-3.0.55.ebuild
new file mode 100644
index 0000000000..de98eda274
--- /dev/null
+++ b/sys-apps/portage/portage-3.0.55.ebuild
@@ -0,0 +1,296 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( pypy3 python3_{10..12} )
+PYTHON_REQ_USE='bzip2(+),threads(+)'
+TMPFILES_OPTIONAL=1
+
+inherit meson linux-info multiprocessing python-r1 tmpfiles
+
+DESCRIPTION="The package management and distribution system for Gentoo Prefix"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
+
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="
+ https://anongit.gentoo.org/git/proj/portage.git
+ https://github.com/gentoo/portage.git
+ "
+ inherit git-r3
+else
+ SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2"
+ KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="apidoc build doc gentoo-dev +ipc +native-extensions +rsync-verify selinux test xattr"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
+
+# setuptools is still needed as a workaround for Python 3.12+ for now.
+# https://github.com/mesonbuild/meson/issues/7702
+#
+# >=meson-1.2.1-r1 for bug #912051
+BDEPEND="
+ ${PYTHON_DEPS}
+ >=dev-util/meson-1.2.1-r1
+ $(python_gen_cond_dep '
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ ' python3_12)
+ test? (
+ dev-python/pytest-xdist[${PYTHON_USEDEP}]
+ dev-vcs/git
+ )
+"
+DEPEND="
+ ${PYTHON_DEPS}
+ >=app-arch/tar-1.27
+ dev-lang/python-exec:2
+ >=sys-apps/sed-4.0.5
+ sys-devel/patch
+ !build? ( $(python_gen_impl_dep 'ssl(+)') )
+ apidoc? (
+ dev-python/sphinx[${PYTHON_USEDEP}]
+ dev-python/sphinx-epytext[${PYTHON_USEDEP}]
+ )
+ doc? (
+ ~app-text/docbook-xml-dtd-4.4
+ app-text/xmlto
+ )
+"
+# Require sandbox-2.2 for bug #288863.
+# For whirlpool hash, require python[ssl] (bug #425046).
+RDEPEND="
+ ${PYTHON_DEPS}
+ !prefix? ( acct-user/portage )
+ >=app-arch/tar-1.27
+ app-arch/zstd
+ >=app-misc/pax-utils-0.1.17
+ dev-lang/python-exec:2
+ >=sys-apps/baselayout-2.9
+ >=sys-apps/findutils-4.4
+ !build? (
+ >=app-admin/eselect-1.2
+ app-portage/getuto
+ >=app-shells/bash-5.0:0
+ >=sec-keys/openpgp-keys-gentoo-release-20230329
+ >=sys-apps/sed-4.0.5
+ rsync-verify? (
+ >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
+ >=app-portage/gemato-14.5[${PYTHON_USEDEP}]
+ )
+ )
+ elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
+ elibc_musl? ( >=sys-apps/sandbox-2.2 )
+ kernel_linux? ( sys-apps/util-linux )
+ selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
+ xattr? ( kernel_linux? (
+ >=sys-apps/install-xattr-0.3
+ ) )
+ !<app-admin/logrotate-3.8.0
+ !<app-portage/gentoolkit-0.4.6
+ !<app-portage/repoman-2.3.10
+ !~app-portage/repoman-3.0.0
+"
+# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
+# NOTE: FEATURES=installsources requires debugedit and rsync
+PDEPEND="
+ !build? (
+ >=net-misc/rsync-2.6.4
+ >=sys-apps/coreutils-6.4
+ >=sys-apps/file-5.44-r3
+ )
+"
+
+S="${WORKDIR}"/prefix-${P}
+
+pkg_pretend() {
+ local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
+
+ check_extra_config
+}
+
+src_prepare() {
+ default
+
+ if use prefix-guest; then
+ sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \
+ -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \
+ -e "s|^\(sync-uri = \).*|\\1rsync://rsync.prefix.bitzolder.nl/gentoo-portage-prefix|" \
+ -i cnf/repos.conf || die "sed failed"
+
+ # PREFIX LOCAL: only hack const_autotool
+ local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
+ # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
+ # tend not to update that often, as long as we are a separate ebuild
+ # we can assume when unset, it's time for some older trick
+ if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
+ PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
+ fi
+ # We need to probe for bash in the Prefix, because it may not
+ # exist, in which case we fall back to the currently in use
+ # bash. This logic is necessary in particular during bootstrap,
+ # where we pull ourselves out of a temporary place with tools
+ local bash="${EPREFIX}/bin/bash"
+ [[ ! -x ${bash} ]] && bash=${BASH}
+
+ einfo "Adjusting sources for ${EPREFIX}"
+ find . -type f -exec \
+ sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
+ -e "s|@PORTAGE_MV@|$(type -P mv)|" \
+ -e "s|@PORTAGE_BASH@|${bash}|" \
+ -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
+ -e "s|@EXTRA_PATH@|${extrapath}|" \
+ -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
+ -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
+ -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
+ -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
+ -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
+ -e "s|@sysconfdir@|${EPREFIX}/etc|" \
+ -e "1s|/usr/bin/env |${EPREFIX}/usr/bin/|" \
+ -i '{}' + || \
+ die "Failed to patch sources"
+
+ # remove Makefiles, or else they will get installed
+ find . -name "Makefile.*" -delete
+
+ einfo "Prefixing shebangs ..."
+ find . -type f ! -name etc-update | \
+ while read -r line; do
+ [[ -x ${line} || ${line} == *".py" ]] || continue;
+ local shebang=$(head -n1 "${line}")
+ if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ;
+ then
+ sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "${line}" || \
+ die "sed failed"
+ fi
+ done
+
+ einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
+ sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
+ bin/emerge-webrsync || die
+
+ einfo "Making absent gemato non-fatal"
+ sed -i -e '/exitcode = 127/d' \
+ lib/portage/sync/modules/rsync/rsync.py || die
+ # END PREFIX LOCAL
+ fi
+}
+
+src_configure() {
+ local code_only=false
+ python_foreach_impl my_src_configure
+}
+
+my_src_configure() {
+ local emesonargs=(
+ -Dcode-only=${code_only}
+ -Deprefix="${EPREFIX}"
+ -Dportage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}"
+ -Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
+ $(meson_use doc)
+ $(meson_use apidoc)
+ $(meson_use gentoo-dev)
+ $(meson_use ipc)
+ $(meson_use xattr)
+ )
+
+ if use native-extensions && [[ "${EPYTHON}" != "pypy3" ]] ; then
+ emesonargs+=( -Dnative-extensions=true )
+ else
+ emesonargs+=( -Dnative-extensions=false )
+ fi
+
+ if use build; then
+ emesonargs+=( -Drsync-verify=false )
+ else
+ emesonargs+=( $(meson_use rsync-verify) )
+ fi
+
+ meson_src_configure
+ code_only=true
+}
+
+src_compile() {
+ python_foreach_impl meson_src_compile
+}
+
+src_test() {
+ local -x PYTEST_ADDOPTS="-vv -ra -l -o console_output_style=count -n $(makeopts_jobs) --dist=worksteal"
+
+ python_foreach_impl meson_src_test --no-rebuild --verbose
+}
+
+src_install() {
+ python_foreach_impl my_src_install
+ dotmpfiles "${FILESDIR}"/portage-{ccache,tmpdir}.conf
+
+ local scripts
+ mapfile -t scripts < <(awk '/^#!.*python/ {print FILENAME} {nextfile}' "${ED}"/usr/{bin,sbin}/* || die)
+ python_replicate_script "${scripts[@]}"
+}
+
+my_src_install() {
+ local pydirs=(
+ "${D}$(python_get_sitedir)"
+ "${ED}/usr/lib/portage/${EPYTHON}"
+ )
+
+ meson_src_install
+ python_optimize "${pydirs[@]}"
+ python_fix_shebang "${pydirs[@]}"
+}
+
+pkg_preinst() {
+ if ! use build && [[ -z ${ROOT} ]]; then
+ python_setup
+ local sitedir=$(python_get_sitedir)
+ [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
+ env -u DISTDIR \
+ -u PORTAGE_OVERRIDE_EPREFIX \
+ -u PORTAGE_REPOSITORIES \
+ -u PORTDIR \
+ -u PORTDIR_OVERLAY \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.default_locations || die
+
+ env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
+
+ env -u FEATURES -u PORTAGE_REPOSITORIES \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
+ fi
+
+ # elog dir must exist to avoid logrotate error for bug #415911.
+ # This code runs in preinst in order to bypass the mapping of
+ # portage:portage to root:root which happens after src_install.
+ keepdir /var/log/portage/elog
+ # This is allowed to fail if the user/group are invalid for prefix users.
+ if chown portage:portage "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
+ chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
+ fi
+
+ if has_version "<${CATEGORY}/${PN}-2.3.77"; then
+ elog "The emerge --autounmask option is now disabled by default, except for"
+ elog "portions of behavior which are controlled by the --autounmask-use and"
+ elog "--autounmask-license options. For backward compatibility, previous"
+ elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
+ elog "Users can get the old behavior simply by adding --autounmask to the"
+ elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
+ elog "change, see https://bugs.gentoo.org/658648."
+ fi
+}
+
+pkg_postinst() {
+ # Warn about obsolete "enotice" script, bug #867010
+ local bashrc=${EROOT}/etc/portage/profile/profile.bashrc
+ if [[ -e ${bashrc} ]] && grep -q enotice "${bashrc}"; then
+ eerror "Obsolete 'enotice' script detected!"
+ eerror "Please remove this from ${bashrc} to avoid problems."
+ eerror "See bug 867010 for more details."
+ fi
+}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/
@ 2023-12-03 10:19 Fabian Groffen
0 siblings, 0 replies; 14+ messages in thread
From: Fabian Groffen @ 2023-12-03 10:19 UTC (permalink / raw
To: gentoo-commits
commit: 213ae19a34cd7a54b9548d7bcedc34c1eba1a4e4
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 3 09:55:35 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec 3 09:55:35 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=213ae19a
sys-apps/portage: cleanup + update interrevisions patch
Bug: https://bugs.gentoo.org/918717
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 2 -
.../portage/files/portage-2.3.45-ebuildshell.patch | 354 ---------------------
...patch => portage-3.0.55.1-interrevisions.patch} | 10 +-
sys-apps/portage/portage-3.0.21.ebuild | 307 ------------------
sys-apps/portage/portage-3.0.30.1-r1.ebuild | 305 ------------------
sys-apps/portage/portage-3.0.30.1.ebuild | 308 ------------------
sys-apps/portage/portage-3.0.55.1.ebuild | 4 +
7 files changed, 9 insertions(+), 1281 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 996a88e823..2abec9a5f7 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,5 +1,3 @@
-DIST prefix-portage-3.0.21.tar.bz2 1339211 BLAKE2B 019cf0f3d2d1c45e7849221fc40b49e2c84949b74c8a8c74fbd2ca451a2dd075fb7b8bfec121a173ca0848c57a5a57a62d465b2957c4eb4d87f6a180299da91e SHA512 0aff5004ae80e2cd9dce740c56c3c2643ef390510c3b3821d893e5c76733d3a8d4e7648963febb29479b9ee155868ec11526a393beb3b383e741451178f39e5a
-DIST prefix-portage-3.0.30.1.tar.bz2 1476396 BLAKE2B 955db5832b1d7d19e25c4ee644f7daa0dbfc7a259ea7018f207865aa8cf5eb8e1e8e2a31c90578162e181af6c043590f239b042e652c3eb2cba9f442bbfc0476 SHA512 1ff8afbee4b204488eb0ecb4bdd216bf754ae015a3bcd298d7b6fb0dd7a671ccbf31d9a4a49be8e3182708641abe008f25df5319e135aa25363b979d49517506
DIST prefix-portage-3.0.34.2.tar.bz2 1498499 BLAKE2B 47f53e4917bdf204eb23dadd9dc821c06da07d2e5c68cf0a3de908089e4121d45542e2120e57744db1c808a156595624915956e77f547ab671b1584b2c67cf0b SHA512 121dd885a73153e780e28c2e514d4b3babc44368aa6915b2009ed0b205051c2f6c37dd3ccfe8be5ea567e7bab2f9f9b0c5c5b81c49990fbac7360261721a5bb7
DIST prefix-portage-3.0.49.tar.bz2 1421955 BLAKE2B ac6e5b512f943826d0bf06225037885a138f3810db973a60c6dbca4f80d516e3aef3054b532f42a143b35702661a3d35ee59945f745b849dcd6fefbd4ff8f3cc SHA512 dee0035e048b1bfde5859b809bf6ffa3ca0674cd1d59d9cfcc14a279d87215223a6b4497274db7e443f27fd6dd05eadb043ae6872feb8fa8523994d9946b6879
DIST prefix-portage-3.0.55.1.tar.bz2 1460599 BLAKE2B 07982a1e6af0df7c7849aeab7ed2479bb2fe7ede16183bddba93d25d8839224f87967b0aa776c2cbc124f322b69a275e628e2817c7f3e01c9353a0eeda38fea8 SHA512 5f87c84baa9d13f0ad5aa534013ef7bf8219d742f940cad8a07bfea8630615885950aa6d7cf030fe6012061504d1eeee77a3e024a1bdc2da3a02bed550816805
diff --git a/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch
deleted file mode 100644
index e495ee4c24..0000000000
--- a/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-From 8c6b115fa0325b5bed2e1a9c4c8e8af45cdecc2e Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH 1/2] Add ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 55 +++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- lib/_emerge/AbstractEbuildProcess.py | 1 +
- lib/portage/const.py | 1 +
- 6 files changed, 194 insertions(+), 17 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f76a48d8e..683a4e9c1 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -121,7 +121,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -547,6 +547,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
-+
-+ env -i HOME=~ ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index 06cac7214..5590dbfc4 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -12,7 +12,8 @@ func_end_re = re.compile(br'^\}$')
-
- var_assign_re = re.compile(br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(br'(\\"|"|\')\s*$')
--readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(br'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(br'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -27,7 +28,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = b''
-@@ -35,14 +36,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ getattr(sys.stderr, 'buffer', sys.stderr).write(var + b'\n')
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += b'r'
- if declare_opts:
- line = b'declare -' + declare_opts + \
-- b' ' + line[readonly_match.end():]
-+ b' ' + var + line[readonly_match.end():]
- else:
-- line = b'declare ' + line[readonly_match.end():]
-+ line = b'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -66,6 +72,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -75,7 +83,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace(b"\1", b""))
- continue
- else:
-@@ -84,8 +92,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -122,13 +132,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -151,5 +176,5 @@ if __name__ == "__main__":
-
- var_pattern = b'^(' + b'|'.join(var_pattern) + b')$'
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index bb17382d4..af35a3327 100755
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index b0c1aa4f2..568f350a0 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/lib/_emerge/AbstractEbuildProcess.py b/lib/_emerge/AbstractEbuildProcess.py
-index 370cac529..a521596e5 100644
---- a/lib/_emerge/AbstractEbuildProcess.py
-+++ b/lib/_emerge/AbstractEbuildProcess.py
-@@ -181,6 +181,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/lib/portage/const.py b/lib/portage/const.py
-index 3c23c85ed..d9c57f300 100644
---- a/lib/portage/const.py
-+++ b/lib/portage/const.py
-@@ -161,6 +161,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.16.1
-
diff --git a/sys-apps/portage/files/portage-3.0.30-interrevisions.patch b/sys-apps/portage/files/portage-3.0.55.1-interrevisions.patch
similarity index 92%
rename from sys-apps/portage/files/portage-3.0.30-interrevisions.patch
rename to sys-apps/portage/files/portage-3.0.55.1-interrevisions.patch
index e53fbd233a..7a3e777924 100644
--- a/sys-apps/portage/files/portage-3.0.30-interrevisions.patch
+++ b/sys-apps/portage/files/portage-3.0.55.1-interrevisions.patch
@@ -1,11 +1,11 @@
-https://bugs.gentoo.org/832062
+https://bugs.gentoo.org/918717
-add (back) inter-revision support for Prefix Portage
+allow r0X.Y revision numbers in prefix
--- a/lib/portage/versions.py
+++ b/lib/portage/versions.py
@@ -53,7 +53,9 @@
- }
+ _pkg = r"[\w+][\w+-]*?"
_v = r"(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)"
-_rev = r"\d+"
@@ -14,8 +14,8 @@ add (back) inter-revision support for Prefix Portage
+# END_PREFIX_LOCAL
_vr = _v + "(-r(" + _rev + "))?"
- _cp = {
-@@ -287,15 +289,47 @@
+ _cp = "(" + _cat + "/" + _pkg + "(-" + _vr + ")?)"
+@@ -252,15 +254,47 @@
if rval:
return rval
diff --git a/sys-apps/portage/portage-3.0.21.ebuild b/sys-apps/portage/portage-3.0.21.ebuild
deleted file mode 100644
index 5bf406162d..0000000000
--- a/sys-apps/portage/portage-3.0.21.ebuild
+++ /dev/null
@@ -1,307 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DISTUTILS_USE_SETUPTOOLS=no
-PYTHON_COMPAT=( pypy3 python3_{9..11} )
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-
-inherit distutils-r1 linux-info systemd prefix
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-
-LICENSE="GPL-2"
-KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
-SLOT="0"
-IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr"
-RESTRICT="!test? ( test )"
-
-BDEPEND="
- app-arch/xz-utils
- test? ( dev-vcs/git )"
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- apidoc? (
- dev-python/sphinx
- dev-python/sphinx-epytext
- )"
-# Require sandbox-2.2 for bug #288863.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-# app-portage/gemato goes without PYTHON_USEDEP since we're calling
-# the executable.
-RDEPEND="
- !prefix? ( acct-user/portage )
- app-arch/zstd
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/findutils-4.4
- !build? (
- >=sys-apps/sed-4.0.5
- >=app-shells/bash-5.0:0[readline]
- >=app-admin/eselect-1.2
- rsync-verify? (
- >=app-portage/gemato-14.5[${PYTHON_USEDEP}]
- >=sec-keys/openpgp-keys-gentoo-release-20180706
- >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
- )
- )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_musl? ( >=sys-apps/sandbox-2.2 )
- kernel_linux? ( sys-apps/util-linux )
- >=app-misc/pax-utils-0.1.18
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- ) )
- !<app-admin/logrotate-3.8.0
- !<app-portage/gentoolkit-0.4.6
- !<app-portage/repoman-2.3.10
- !~app-portage/repoman-3.0.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- >=sys-apps/file-5.41
- >=sys-apps/coreutils-6.4
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-TARBALL_PV=${PV}
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-
-pkg_pretend() {
- local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
-
- check_extra_config
-}
-
-python_prepare_all() {
- distutils-r1_python_prepare_all
-
- eapply "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- eapply "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
- if use gentoo-dev; then
- einfo "Disabling --dynamic-deps by default for gentoo-dev..."
- sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \
- -i lib/_emerge/create_depgraph_params.py || \
- die "failed to patch create_depgraph_params.py"
-
- einfo "Enabling additional FEATURES for gentoo-dev..."
- echo 'FEATURES="${FEATURES} strict-keepdir"' \
- >> cnf/make.globals || die
- fi
-
- if use native-extensions; then
- printf "[build_ext]\nportage_ext_modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if use build || ! use rsync-verify; then
- sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \
- -e '/^sync-webrsync-verify-signature/s|yes|no|' \
- -i cnf/repos.conf || die "sed failed"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f ! -name etc-update -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use apidoc && targets+=( apidoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use apidoc && targets+=(
- install_apidoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- dotmpfiles "${FILESDIR}"/portage-ccache.conf
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- python_setup
- local sitedir=$(python_get_sitedir)
- [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
- env -u DISTDIR \
- -u PORTAGE_OVERRIDE_EPREFIX \
- -u PORTAGE_REPOSITORIES \
- -u PORTDIR \
- -u PORTDIR_OVERLAY \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.default_locations || die
-
- env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
-
- env -u FEATURES -u PORTAGE_REPOSITORIES \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
- fi
-
- if has_version "<${CATEGORY}/${PN}-2.3.77"; then
- elog "The emerge --autounmask option is now disabled by default, except for"
- elog "portions of behavior which are controlled by the --autounmask-use and"
- elog "--autounmask-license options. For backward compatibility, previous"
- elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
- elog "Users can get the old behavior simply by adding --autounmask to the"
- elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
- elog "change, see https://bugs.gentoo.org/658648."
- fi
-}
diff --git a/sys-apps/portage/portage-3.0.30.1-r1.ebuild b/sys-apps/portage/portage-3.0.30.1-r1.ebuild
deleted file mode 100644
index 6e0cfe4038..0000000000
--- a/sys-apps/portage/portage-3.0.30.1-r1.ebuild
+++ /dev/null
@@ -1,305 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( pypy3 python3_{9..11} )
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-TMPFILES_OPTIONAL=1
-
-inherit distutils-r1 linux-info toolchain-funcs tmpfiles prefix
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-SRC_URI="https://dev.gentoo.org/~grobian/distfiles/prefix-${P}.tar.bz2"
-
-LICENSE="GPL-2"
-KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
-SLOT="0"
-IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr"
-RESTRICT="!test? ( test )"
-
-BDEPEND="
- app-arch/xz-utils
- test? ( dev-vcs/git )"
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- apidoc? (
- dev-python/sphinx[${PYTHON_USEDEP}]
- dev-python/sphinx-epytext[${PYTHON_USEDEP}]
- )"
-# Require sandbox-2.2 for bug #288863.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-# app-portage/gemato goes without PYTHON_USEDEP since we're calling
-# the executable.
-RDEPEND="
- !prefix? ( acct-user/portage )
- app-arch/zstd
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/findutils-4.4
- !build? (
- >=sys-apps/sed-4.0.5
- >=app-shells/bash-5.0:0[readline]
- >=app-admin/eselect-1.2
- rsync-verify? (
- >=app-portage/gemato-14.5[${PYTHON_USEDEP}]
- >=sec-keys/openpgp-keys-gentoo-release-20180706
- >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
- )
- )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_musl? ( >=sys-apps/sandbox-2.2 )
- kernel_linux? ( sys-apps/util-linux )
- >=app-misc/pax-utils-0.1.18
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- ) )
- !<app-admin/logrotate-3.8.0
- !<app-portage/gentoolkit-0.4.6
- !<app-portage/repoman-2.3.10
- !~app-portage/repoman-3.0.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- >=sys-apps/file-5.41
- >=sys-apps/coreutils-6.4
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-S="${WORKDIR}"/prefix-${P}
-
-pkg_pretend() {
- local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
-
- if use native-extensions && tc-is-cross-compiler; then
- einfo "Disabling USE=native-extensions for cross-compilation (bug #612158)"
- fi
-
- check_extra_config
-}
-
-python_prepare_all() {
- local PATCHES=(
- "${FILESDIR}"/${PN}-3.0.30-prefix-stack.patch # 658572
- "${FILESDIR}"/${PN}-3.0.30-ebuildshell.patch # 155161
- "${FILESDIR}"/${PN}-3.0.30-interrevisions.patch # 832062
- )
-
- distutils-r1_python_prepare_all
-
- sed -e "s:^VERSION = \"HEAD\"$:VERSION = \"${PV}\":" -i lib/portage/__init__.py || die
-
- if use gentoo-dev; then
- einfo "Disabling --dynamic-deps by default for gentoo-dev..."
- sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \
- -i lib/_emerge/create_depgraph_params.py || \
- die "failed to patch create_depgraph_params.py"
-
- einfo "Enabling additional FEATURES for gentoo-dev..."
- echo 'FEATURES="${FEATURES} ipc-sandbox network-sandbox strict-keepdir"' \
- >> cnf/make.globals || die
- fi
-
- if use native-extensions && ! tc-is-cross-compiler; then
- printf "[build_ext]\nportage_ext_modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if use build || ! use rsync-verify; then
- sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \
- -e '/^sync-webrsync-verify-signature/s|yes|no|' \
- -i cnf/repos.conf || die "sed failed"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f ! -name etc-update -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use apidoc && targets+=( apidoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use apidoc && targets+=(
- install_apidoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- dotmpfiles "${FILESDIR}"/portage-ccache.conf
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- if ! use build; then
- python_setup
- local sitedir=$(python_get_sitedir)
- [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
- env -u DISTDIR \
- -u PORTAGE_OVERRIDE_EPREFIX \
- -u PORTAGE_REPOSITORIES \
- -u PORTDIR \
- -u PORTDIR_OVERLAY \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.default_locations || die
-
- env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
-
- env -u FEATURES -u PORTAGE_REPOSITORIES \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
- fi
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
- fi
-
- if has_version "<${CATEGORY}/${PN}-2.3.77"; then
- elog "The emerge --autounmask option is now disabled by default, except for"
- elog "portions of behavior which are controlled by the --autounmask-use and"
- elog "--autounmask-license options. For backward compatibility, previous"
- elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
- elog "Users can get the old behavior simply by adding --autounmask to the"
- elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
- elog "change, see https://bugs.gentoo.org/658648."
- fi
-}
diff --git a/sys-apps/portage/portage-3.0.30.1.ebuild b/sys-apps/portage/portage-3.0.30.1.ebuild
deleted file mode 100644
index e9c8d3257e..0000000000
--- a/sys-apps/portage/portage-3.0.30.1.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DISTUTILS_USE_SETUPTOOLS=no
-PYTHON_COMPAT=( pypy3 python3_{9..11} )
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-
-inherit distutils-r1 linux-info systemd prefix
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-
-LICENSE="GPL-2"
-KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
-SLOT="0"
-IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux test xattr"
-RESTRICT="!test? ( test )"
-
-BDEPEND="
- app-arch/xz-utils
- test? ( dev-vcs/git )"
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- apidoc? (
- dev-python/sphinx
- dev-python/sphinx-epytext
- )"
-# Require sandbox-2.2 for bug #288863.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-# app-portage/gemato goes without PYTHON_USEDEP since we're calling
-# the executable.
-RDEPEND="
- !prefix? ( acct-user/portage )
- app-arch/zstd
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/findutils-4.4
- !build? (
- >=sys-apps/sed-4.0.5
- >=app-shells/bash-5.0:0[readline]
- >=app-admin/eselect-1.2
- rsync-verify? (
- >=app-portage/gemato-14.5[${PYTHON_USEDEP}]
- >=sec-keys/openpgp-keys-gentoo-release-20180706
- >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
- )
- )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_musl? ( >=sys-apps/sandbox-2.2 )
- kernel_linux? ( sys-apps/util-linux )
- >=app-misc/pax-utils-0.1.18
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- ) )
- !<app-admin/logrotate-3.8.0
- !<app-portage/gentoolkit-0.4.6
- !<app-portage/repoman-2.3.10
- !~app-portage/repoman-3.0.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- >=sys-apps/file-5.41
- >=sys-apps/coreutils-6.4
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-TARBALL_PV=${PV}
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-
-pkg_pretend() {
- local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
-
- check_extra_config
-}
-
-python_prepare_all() {
- distutils-r1_python_prepare_all
-
- eapply "${FILESDIR}"/${PN}-3.0.30-prefix-stack.patch # 658572
- eapply "${FILESDIR}"/${PN}-3.0.30-ebuildshell.patch # 155161
- eapply "${FILESDIR}"/${PN}-3.0.30-interrevisions.patch # 832062
- if use gentoo-dev; then
- einfo "Disabling --dynamic-deps by default for gentoo-dev..."
- sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \
- -i lib/_emerge/create_depgraph_params.py || \
- die "failed to patch create_depgraph_params.py"
-
- einfo "Enabling additional FEATURES for gentoo-dev..."
- echo 'FEATURES="${FEATURES} strict-keepdir"' \
- >> cnf/make.globals || die
- fi
-
- if use native-extensions; then
- printf "[build_ext]\nportage_ext_modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if use build || ! use rsync-verify; then
- sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \
- -e '/^sync-webrsync-verify-signature/s|yes|no|' \
- -i cnf/repos.conf || die "sed failed"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f ! -name etc-update -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use apidoc && targets+=( apidoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use apidoc && targets+=(
- install_apidoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- dotmpfiles "${FILESDIR}"/portage-ccache.conf
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- python_setup
- local sitedir=$(python_get_sitedir)
- [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
- env -u DISTDIR \
- -u PORTAGE_OVERRIDE_EPREFIX \
- -u PORTAGE_REPOSITORIES \
- -u PORTDIR \
- -u PORTDIR_OVERLAY \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.default_locations || die
-
- env -u BINPKG_COMPRESS -u PORTAGE_REPOSITORIES \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
-
- env -u FEATURES -u PORTAGE_REPOSITORIES \
- PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
- "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
- fi
-
- if has_version "<${CATEGORY}/${PN}-2.3.77"; then
- elog "The emerge --autounmask option is now disabled by default, except for"
- elog "portions of behavior which are controlled by the --autounmask-use and"
- elog "--autounmask-license options. For backward compatibility, previous"
- elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
- elog "Users can get the old behavior simply by adding --autounmask to the"
- elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
- elog "change, see https://bugs.gentoo.org/658648."
- fi
-}
diff --git a/sys-apps/portage/portage-3.0.55.1.ebuild b/sys-apps/portage/portage-3.0.55.1.ebuild
index c64c5d2776..3f24547b1e 100644
--- a/sys-apps/portage/portage-3.0.55.1.ebuild
+++ b/sys-apps/portage/portage-3.0.55.1.ebuild
@@ -106,6 +106,10 @@ PDEPEND="
S="${WORKDIR}"/prefix-${P}
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.0.55.1-interrevisions.patch
+)
+
pkg_pretend() {
local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-12-03 10:19 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-02 11:43 [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/files/, sys-apps/portage/ Fabian Groffen
-- strict thread matches above, loose matches on Subject: below --
2023-12-03 10:19 Fabian Groffen
2023-11-24 20:57 Fabian Groffen
2020-12-04 11:44 Fabian Groffen
2018-06-25 8:41 Fabian Groffen
2018-06-22 14:34 Michael Haubenwallner
2018-05-28 16:44 Michael Haubenwallner
2017-12-29 13:06 Fabian Groffen
2017-09-29 8:19 Michael Haubenwallner
2017-09-18 14:08 Michael Haubenwallner
2016-05-13 11:39 Michael Haubenwallner
2016-05-03 15:33 Michael Haubenwallner
2016-05-02 11:15 Michael Haubenwallner
2016-04-18 7:36 Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox