* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2016-04-27 13:10 Michael Haubenwallner
0 siblings, 0 replies; 8+ messages in thread
From: Michael Haubenwallner @ 2016-04-27 13:10 UTC (permalink / raw
To: gentoo-commits
commit: 8c67d8b37ea1f8ce7e29233e80229fc8fbf9fd35
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Wed Apr 27 13:03:36 2016 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Wed Apr 27 13:03:36 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=8c67d8b3
prefix-portage: bump ebuildshell patch, bug#155161
.../portage/files/portage-2.2.28-ebuildshell.patch | 311 +++++++++++++++++++++
sys-apps/portage/portage-2.2.28-r1.ebuild | 259 +++++++++++++++++
2 files changed, 570 insertions(+)
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
new file mode 100644
index 0000000..7e7e71d
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.2.28-ebuildshell.patch
@@ -0,0 +1,311 @@
+From 096a74009cea9c79bcc2729d18a3cbcb99783aeb 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/save-ebuild-env.sh | 2 +-
+ man/make.conf.5 | 6 +++
+ pym/_emerge/AbstractEbuildProcess.py | 1 +
+ pym/portage/const.py | 1 +
+ 6 files changed, 159 insertions(+), 18 deletions(-)
+
+diff --git a/bin/ebuild.sh b/bin/ebuild.sh
+index f1586b2..06c90df 100755
+--- a/bin/ebuild.sh
++++ b/bin/ebuild.sh
+@@ -130,7 +130,7 @@ __qa_source() {
+ __qa_call() {
+ local shopts=$(shopt) OLDIFS="$IFS"
+ local retval
+- "$@"
++ __call-ebuildshell "$@"
+ retval=$?
+ set +e
+ [[ $shopts != $(shopt) ]] &&
+@@ -537,6 +537,106 @@ 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 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}
++ (
++ (
++ 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"
++ )
++ # 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
++ echo "WANTED: \$@"
++ echo "or use: \"\\\$@\""
++ # 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
++ # at exit, dump the current environment
++ trap "
++ rm -f '${__ebuildshell_tmpf}.return-'*
++ (
++ (
++ declare -p
++ declare -fp
++ shopt -p | grep -v 'extdebug$'
++ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
++ ) |
++ (
++ # 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}' \
++ '${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}' \\
++ || 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
++ 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=$?
++ source "${__ebuildshell_tmpf}.return-env"
++ # 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}
++}
++
+ # 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..a710e93 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]+)')
++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):
+ 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,29 @@ 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 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):
+ 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):
+ 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__":
+ "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'.",
++ '--export-into-global-scope':
++ "Add the '-g' flag to 'declare -x'.",
++ }
++ 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 +187,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 ddef1fd..7264ced 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 26bbf06..865ede9 100644
+--- a/man/make.conf.5
++++ b/man/make.conf.5
+@@ -382,6 +382,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 814d7f4..d84f9bf 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.7.3
+
diff --git a/sys-apps/portage/portage-2.2.28-r1.ebuild b/sys-apps/portage/portage-2.2.28-r1.ebuild
new file mode 100644
index 0000000..672b9da
--- /dev/null
+++ b/sys-apps/portage/portage-2.2.28-r1.ebuild
@@ -0,0 +1,259 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=(
+ pypy
+ python3_3 python3_4 python3_5
+ python2_7
+)
+PYTHON_REQ_USE='bzip2(+)'
+
+inherit eutils distutils-r1 multilib
+
+DESCRIPTION="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 selinux xattr prefix-chaining"
+
+DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
+ >=sys-devel/make-3.82
+ >=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
+ )
+ 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 )
+ 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)
+ ) )
+ !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
+
+REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
+
+SRC_ARCHIVES="https://dev.gentoo.org/~dolsen/releases/portage 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
+}
+
+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.2.28-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'/" \
+ setup.py || die
+
+ 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
+
+ if [[ -n ${EPREFIX} ]] ; then
+ # PREFIX LOCAL: only hack const_autotool
+ 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
+ local defaultpath="${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin"
+ # 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|@DEFAULT_PATH@|${defaultpath}|" \
+ -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 deal 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)
+ # 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.${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
+}
+
+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 )
+ use epydoc && targets+=( install_epydoc )
+
+ # 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
+}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2018-12-06 13:49 Fabian Groffen
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2018-12-06 13:49 UTC (permalink / raw
To: gentoo-commits
commit: f88f91600be7bd6772d19885d117b29096110001
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 6 13:49:23 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Dec 6 13:49:23 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f88f9160
sys-apps/portage: small version bump to allow newer repoman
Package-Manager: Portage-2.3.45-prefix, Repoman-2.3.12
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 1 +
.../portage/files/portage-2.3.45-ebuildshell.patch | 354 +++++++++++++++++++++
sys-apps/portage/portage-2.3.45.ebuild | 274 ++++++++++++++++
3 files changed, 629 insertions(+)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 61a3d79f0d..f2ff336e7c 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -2,3 +2,4 @@ DIST prefix-portage-2.2.28.tar.bz2 1187416 BLAKE2B 1ec27def0b427f60b38dc60178461
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.3.tar.bz2 1253190 BLAKE2B 53e60b561e1f9b2a5367a1a23a74ba315358b8e7eb05eead2a46078198b92786745dbd07ab1bf69587866f462955a5dd6c0bc3eb51dbe507bfbff31d899c5f45 SHA512 67c2d7554c9236748b25a8b9f0f60736beda535298395ba2eb86dd5634b6520d645df193914f079d2c61cfa0d8f263f67c3476828319e2395dec2e45cf4b9b14
+DIST prefix-portage-2.3.45.tar.bz2 1255719 BLAKE2B 2a53b526418747edc02ab4cc8127425b92e8ae0f7fdc27af730f991f7cb6074aac51cdfd0ca75f7e6376c8059df1e02817963a0386cf1b1986eb798f21b8cf8c SHA512 dfea0774b5d801b3ca02fdd570c89c08b78f4e02e57c1b897a50af0056d4ed4522c6d236dcaf98ea3f1c446b0164abd1b45fd2cae12ed5ef6c34c83668894b5b
diff --git a/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch
new file mode 100644
index 0000000000..e495ee4c24
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.3.45-ebuildshell.patch
@@ -0,0 +1,354 @@
+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/portage-2.3.45.ebuild b/sys-apps/portage/portage-2.3.45.ebuild
new file mode 100644
index 0000000000..ee4c5d27f7
--- /dev/null
+++ b/sys-apps/portage/portage-2.3.45.ebuild
@@ -0,0 +1,274 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+PYTHON_COMPAT=(
+ pypy
+ python3_4 python3_5 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 prefix-chaining"
+
+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.45-ebuildshell.patch # 155161
+ use prefix-chaining && # maybe useful even with stacked-prefix
+ epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
+
+ 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
+ local defaultpath="${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin"
+ # 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|@DEFAULT_PATH@|${defaultpath}|" \
+ -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
+
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+ # asyncio triggers some python bug, not worth fixing on
+ # ppc-macos, bug #656830
+ sed -i -e '/^_asyncio_enabled/s/=.*$/= False/' \
+ lib/portage/util/_eventloop/global_event_loop.py || die
+ fi
+ # 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
+}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2019-03-25 14:20 Michael Haubenwallner
0 siblings, 0 replies; 8+ messages in thread
From: Michael Haubenwallner @ 2019-03-25 14:20 UTC (permalink / raw
To: gentoo-commits
commit: beae731778eee1216ad4d94d52935617598320ae
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 22 16:30:51 2019 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 25 12:01:32 2019 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=beae7317
sys-apps/portage: replace prefix-chaining patch
All the prefix-chaining patches do not apply any more. This has
switched over to FEATURES=stacked-prefix, and again switched over to
USE=prefix-stack. Current prefix-portage is at FEATURES=stacked-prefix,
so there still is a patch necessary, although unconditionally now.
Bug: https://bugs.gentoo.org/658572
Package-Manager: Portage-2.3.62-prefix, Repoman-2.3.12
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>
.../files/portage-2.2.14-prefix-chaining.patch | 873 -------------------
.../files/portage-2.3.18-prefix-chaining.patch | 927 ---------------------
.../files/portage-2.3.40-prefix-chaining.patch | 921 --------------------
.../files/portage-2.3.62-prefix-stack.patch | 80 ++
.../files/portage-2.3.8-prefix-chaining.patch | 927 ---------------------
sys-apps/portage/metadata.xml | 1 -
sys-apps/portage/portage-2.3.52.2.ebuild | 6 +-
sys-apps/portage/portage-2.3.55.1.ebuild | 4 +-
...2.3.55.1.ebuild => portage-2.3.62-r00.1.ebuild} | 5 +-
sys-apps/portage/portage-2.3.62.ebuild | 4 +-
10 files changed, 86 insertions(+), 3662 deletions(-)
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
deleted file mode 100644
index 5c38795bb2..0000000000
--- a/sys-apps/portage/files/portage-2.2.14-prefix-chaining.patch
+++ /dev/null
@@ -1,873 +0,0 @@
-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/files/portage-2.3.18-prefix-chaining.patch b/sys-apps/portage/files/portage-2.3.18-prefix-chaining.patch
deleted file mode 100644
index 728b3261ba..0000000000
--- a/sys-apps/portage/files/portage-2.3.18-prefix-chaining.patch
+++ /dev/null
@@ -1,927 +0,0 @@
-From 2ce322b10b0f1971b174067ca9dac373322e4035 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 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 2cac6f426..b7b5c8ce6 100644
---- a/bin/phase-helpers.sh
-+++ b/bin/phase-helpers.sh
-@@ -868,6 +868,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}
-@@ -927,6 +931,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}
-@@ -1167,6 +1175,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)
-@@ -1198,6 +1210,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)
-@@ -1228,6 +1244,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)
-@@ -1258,6 +1278,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
-@@ -1289,6 +1313,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 1d37d0ece..2b185ef73 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 8d00f93df..fe317f119 100644
---- a/pym/_emerge/depgraph.py
-+++ b/pym/_emerge/depgraph.py
-@@ -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,
- 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)),
-@@ -3255,7 +3255,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:
-@@ -3293,7 +3294,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)
-@@ -3308,14 +3309,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
-@@ -3324,7 +3325,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
-
-@@ -3360,7 +3361,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:
-@@ -3384,7 +3385,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)
-@@ -3691,7 +3692,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
-@@ -3700,33 +3701,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
-
-@@ -4579,7 +4580,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."""
-
-@@ -4602,6 +4603,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:
-@@ -4633,7 +4641,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
-@@ -4709,6 +4717,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 e993ce17d..32a942c73 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 dd4657835..6be443082 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",
-@@ -239,6 +240,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 d2c35f9e3..79d612b2d 100644
---- a/pym/portage/dbapi/vartree.py
-+++ b/pym/portage/dbapi/vartree.py
-@@ -195,8 +195,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:
-@@ -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
-+ 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
-@@ -500,6 +514,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:
-@@ -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)))
-+
-+ _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
-
-@@ -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,
-- settings=None):
-+ settings=None, kill_eprefix=None):
-
- if settings is None:
- settings = portage.settings
-@@ -1466,6 +1489,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 2bb9dc339..cc017a2a7 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')
-
-+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.
-@@ -695,7 +784,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).
-@@ -796,6 +885,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 55b8c089a..32e969ed7 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 d013b0d5c..fdb1552e9 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()
-@@ -2813,6 +2871,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 a24f8fec8..82fcba9e2 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 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.13.6
-
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
deleted file mode 100644
index 8e0864990d..0000000000
--- a/sys-apps/portage/files/portage-2.3.40-prefix-chaining.patch
+++ /dev/null
@@ -1,921 +0,0 @@
-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/files/portage-2.3.62-prefix-stack.patch b/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch
new file mode 100644
index 0000000000..b0bdf2a20e
--- /dev/null
+++ b/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch
@@ -0,0 +1,80 @@
+From 1fe30e79c368ce71e024d70c3ec07a6aed3ef262 Mon Sep 17 00:00:00 2001
+From: Michael Haubenwallner <haubi@gentoo.org>
+Date: Fri, 22 Mar 2019 17:52:05 +0100
+Subject: [PATCH] from FEATURES=stacked-prefix to USE=prefix-stack
+
+Rather than telling the base prefix' portage to support stacked prefix,
+be explicit in the stacked prefix about to USE that feature.
+Bug: https://bugs.gentoo.org/658572
+---
+ bin/install-qa-check.d/05prefix | 10 +++-------
+ bin/phase-helpers.sh | 12 ++++--------
+ lib/portage/const.py | 1 -
+ 3 files changed, 7 insertions(+), 16 deletions(-)
+
+diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
+index 03da3bbce..4f48e4216 100644
+--- a/bin/install-qa-check.d/05prefix
++++ b/bin/install-qa-check.d/05prefix
+@@ -36,16 +36,12 @@ install_qa_check_prefix() {
+ local WHITELIST=" /usr/bin/env "
+ # shebang can be an absolutised path, bug #342929
+ local eprefix=$(canonicalize ${EPREFIX})
+- # Without the stacked-prefix feature, tests using BPREFIX
+- # are redundant to EPREFIX, but run only if we will fail.
++ # Without USE=prefix-stack, tests using BPREFIX are
++ # redundant to EPREFIX, but run only if we will fail.
+ # Otherways, BPREFIX really is BROOT (the EAPI 7 one).
+ local BPREFIX=${EPREFIX}
+ local bprefix=${eprefix}
+- if has stacked-prefix ${FEATURES} &&
+- [[ -z ${ROOT%/} ]] &&
+- [[ ${CBUILD} == ${CHOST} ]] &&
+- [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] &&
+- :; then
++ if has prefix-stack ${USE} ; then
+ BPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}
+ bprefix=$(canonicalize ${BPREFIX})
+ fi
+diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
+index 606b1cdfd..c64f1106b 100644
+--- a/bin/phase-helpers.sh
++++ b/bin/phase-helpers.sh
+@@ -932,18 +932,14 @@ ___best_version_and_has_version_common() {
+ fi ;;
+ esac
+
+- # PREFIX LOCAL: stacked-prefix feature
++ # PREFIX LOCAL: prefix-stack feature
+ if ___eapi_has_prefix_variables &&
+ has "${root_arg}" '--host-root' '-b' &&
+- has stacked-prefix ${FEATURES} &&
++ has prefix-stack ${USE} &&
+ [[ -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.
++ # When we merge into "stacked" EPREFIX, but not into some ROOT, build
++ # tools found in EPREFIX perfectly work for current build environment.
+ "${FUNCNAME[1]}" "${atom}" && return 0
+ fi
+ # END PREFIX LOCAL
+diff --git a/lib/portage/const.py b/lib/portage/const.py
+index eddce377d..db02cbc56 100644
+--- a/lib/portage/const.py
++++ b/lib/portage/const.py
+@@ -207,7 +207,6 @@ SUPPORTED_FEATURES = frozenset([
+ "splitdebug",
+ "split-elog",
+ "split-log",
+- "stacked-prefix", # PREFIX LOCAL
+ "strict",
+ "strict-keepdir",
+ "stricter",
+--
+2.19.2
+
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
deleted file mode 100644
index 036d022191..0000000000
--- a/sys-apps/portage/files/portage-2.3.8-prefix-chaining.patch
+++ /dev/null
@@ -1,927 +0,0 @@
-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/metadata.xml b/sys-apps/portage/metadata.xml
index 1e859c1071..c66241962c 100644
--- a/sys-apps/portage/metadata.xml
+++ b/sys-apps/portage/metadata.xml
@@ -23,6 +23,5 @@
<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.3.52.2.ebuild b/sys-apps/portage/portage-2.3.52.2.ebuild
index 9797e183cd..e2ca476f68 100644
--- a/sys-apps/portage/portage-2.3.52.2.ebuild
+++ b/sys-apps/portage/portage-2.3.52.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
@@ -17,7 +17,7 @@ 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 prefix-chaining"
+IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
>=app-arch/tar-1.27
@@ -92,8 +92,6 @@ python_prepare_all() {
distutils-r1_python_prepare_all
epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
- use prefix-chaining && # maybe useful even with stacked-prefix
- epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
diff --git a/sys-apps/portage/portage-2.3.55.1.ebuild b/sys-apps/portage/portage-2.3.55.1.ebuild
index 9528084055..e2ca476f68 100644
--- a/sys-apps/portage/portage-2.3.55.1.ebuild
+++ b/sys-apps/portage/portage-2.3.55.1.ebuild
@@ -17,7 +17,7 @@ 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 prefix-chaining"
+IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
>=app-arch/tar-1.27
@@ -92,8 +92,6 @@ python_prepare_all() {
distutils-r1_python_prepare_all
epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
- use prefix-chaining && # maybe useful even with stacked-prefix
- epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
diff --git a/sys-apps/portage/portage-2.3.55.1.ebuild b/sys-apps/portage/portage-2.3.62-r00.1.ebuild
similarity index 97%
copy from sys-apps/portage/portage-2.3.55.1.ebuild
copy to sys-apps/portage/portage-2.3.62-r00.1.ebuild
index 9528084055..8dab4da44e 100644
--- a/sys-apps/portage/portage-2.3.55.1.ebuild
+++ b/sys-apps/portage/portage-2.3.62-r00.1.ebuild
@@ -17,7 +17,7 @@ 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 prefix-chaining"
+IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
>=app-arch/tar-1.27
@@ -91,9 +91,8 @@ pkg_setup() {
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
- use prefix-chaining && # maybe useful even with stacked-prefix
- epatch "${FILESDIR}"/${PN}-2.3.40-prefix-chaining.patch
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
diff --git a/sys-apps/portage/portage-2.3.62.ebuild b/sys-apps/portage/portage-2.3.62.ebuild
index 9528084055..e2ca476f68 100644
--- a/sys-apps/portage/portage-2.3.62.ebuild
+++ b/sys-apps/portage/portage-2.3.62.ebuild
@@ -17,7 +17,7 @@ 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 prefix-chaining"
+IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
>=app-arch/tar-1.27
@@ -92,8 +92,6 @@ python_prepare_all() {
distutils-r1_python_prepare_all
epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
- use prefix-chaining && # maybe useful even with stacked-prefix
- 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] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2020-12-04 10:38 Fabian Groffen
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2020-12-04 10:38 UTC (permalink / raw
To: gentoo-commits
commit: c6672f91217e0b0ec7739faebbdfba76fd6e83e5
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 4 10:34:49 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Dec 4 10:37:54 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c6672f91
sys-apps/portage-3.0.10.3: fix Python 3.8 on macOS interaction
- added patch to temp force fork mode, to ensure we can run Portage with
Python 3.8 (the only configured target nowadays) on Darwin
- this release includes a fix for Linux/Solaris users (ELF-targets) to
silence invalid soname dependencies warnings about missing
host-provided libs
Bug: https://bugs.gentoo.org/758230
Package-Manager: Portage-3.0.10.3-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 3 +-
.../portage-3.0.10-multiprocessing-no-spawn.patch | 32 +++
...age-3.0.10.2.ebuild => portage-3.0.10.3.ebuild} | 3 +
sys-apps/portage/portage-3.0.8.ebuild | 299 ---------------------
4 files changed, 36 insertions(+), 301 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 18b009f14a..a2010f89eb 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-3.0.10.2.tar.bz2 1332430 BLAKE2B cade8c882fa67abf1f1cd3f8589dc7976ac4d555aa92733cc4d360b1669467c81b18a27140f6255d34f7efbca0e92103e791144e6fec6a7de8285958c7491fc5 SHA512 ce13c8b93aec5bad9febdfd7911b2169c6418ddf351cbe6fb5226f01236c51607b7ad2cc0bf0b31bf3ba8aa78c3eaa05fbcffb81da59820d4040e98f79f50e6f
-DIST prefix-portage-3.0.8.tar.bz2 1360204 BLAKE2B b4d3046e4a2ac7ae611a54b1a669d3d13b337aa29a9adb540f6da5104b47ca8d41798cc268bc4ab464f553bb280173a598127b5b290871ba0bf57f2fbd15bf58 SHA512 fb532b4145952f9467e1a86349e753e80d20b8b35d17d2d99ede590ff5aa6d367f16be41f2335738ed01c82238e2f93179e9b35d588ad92859f4b1f135539a00
+DIST prefix-portage-3.0.10.3.tar.bz2 1316420 BLAKE2B 296a26cd39f84f477434fc125a53ea0569b43c78f30d3aba6a59f07a112f7d55d6f1286f596c0cc4dcce5c1154cf20e78432fc50b04f7f5b92969c5f81cddc89 SHA512 1ebc43be3a6108bccc8bd8f3fa2c781402d0a73f18e012b341959fff5fc52603e27d5a8bd8fe08b82188d6694f041381654a0d3cd566e3f05b559d83ccbddbee
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
new file mode 100644
index 0000000000..19ae16b5ac
--- /dev/null
+++ b/sys-apps/portage/files/portage-3.0.10-multiprocessing-no-spawn.patch
@@ -0,0 +1,32 @@
+Alteration of the original patch to force fork mode iso spawn
+
+From f093da4a3a457d539e5682ccecdf91f254addd8c Mon Sep 17 00:00:00 2001
+From: Zac Medico <zmedico@gentoo.org>
+Date: Thu, 3 Dec 2020 21:37:39 -0800
+Subject: [PATCH] runTests.py: multiprocessing.set_start_method('spawn') for
+ debugging bug 758230
+
+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 @@
+ # 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)
+
+ if __name__ == "__main__":
++ multiprocessing.set_start_method('fork')
+ try:
+ sys.exit(tests.main())
+ finally:
diff --git a/sys-apps/portage/portage-3.0.10.2.ebuild b/sys-apps/portage/portage-3.0.10.3.ebuild
similarity index 98%
rename from sys-apps/portage/portage-3.0.10.2.ebuild
rename to sys-apps/portage/portage-3.0.10.3.ebuild
index cf3cc74f4b..c3bac2e8fc 100644
--- a/sys-apps/portage/portage-3.0.10.2.ebuild
+++ b/sys-apps/portage/portage-3.0.10.3.ebuild
@@ -94,6 +94,9 @@ pkg_pretend() {
python_prepare_all() {
distutils-r1_python_prepare_all
+ # drop this patch when bug 758230 gets resolved
+ eapply "${FILESDIR}"/${PN}-3.0.10-multiprocessing-no-spawn.patch # 758230
+
eapply "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
eapply "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
if use gentoo-dev; then
diff --git a/sys-apps/portage/portage-3.0.8.ebuild b/sys-apps/portage/portage-3.0.8.ebuild
deleted file mode 100644
index cf3cc74f4b..0000000000
--- a/sys-apps/portage/portage-3.0.8.ebuild
+++ /dev/null
@@ -1,299 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DISTUTILS_USE_SETUPTOOLS=no
-PYTHON_COMPAT=( pypy3 python3_{6..9} )
-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="~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="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 )
- 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="
- 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
- 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 ) )
- 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
- ) )
- !<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
- 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="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
-
- 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'
- 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 \
- 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}
- 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] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2020-12-07 17:39 Fabian Groffen
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2020-12-07 17:39 UTC (permalink / raw
To: gentoo-commits
commit: f2225a34eaa02778907b77103bb920f2cd88a8de
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 7 17:38:50 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Dec 7 17:38:50 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f2225a34
sys-apps/portage-3.0.12: version bump
Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 2 +-
.../portage-3.0.10-multiprocessing-no-spawn.patch | 32 ----------------------
...ge-3.0.10.3-r1.ebuild => portage-3.0.12.ebuild} | 3 --
3 files changed, 1 insertion(+), 36 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index a2010f89eb..32f96fef4f 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,2 +1,2 @@
DIST prefix-portage-2.3.100.tar.bz2 1331695 BLAKE2B 165f113041da8ad1150cc59d25a420effaa163a7694ba8ff36ce1e5fa75669b8fde31ad74594b28b987f9ec5685b9a31aa5228419afd476726ba17ec8f7575db SHA512 8163bfd4e83e48d560dd07150dd468d3b4a63d1507d23226107479bd5de9da3cd94308851b64c63851572288877cb2774f986f8c1a5163521a341ce4c72fbf0c
-DIST prefix-portage-3.0.10.3.tar.bz2 1316420 BLAKE2B 296a26cd39f84f477434fc125a53ea0569b43c78f30d3aba6a59f07a112f7d55d6f1286f596c0cc4dcce5c1154cf20e78432fc50b04f7f5b92969c5f81cddc89 SHA512 1ebc43be3a6108bccc8bd8f3fa2c781402d0a73f18e012b341959fff5fc52603e27d5a8bd8fe08b82188d6694f041381654a0d3cd566e3f05b559d83ccbddbee
+DIST prefix-portage-3.0.12.tar.bz2 1309809 BLAKE2B 04b037b7d2d5077845f7d37d8dcedc03758191804d2dd44af4d87b5bbd94c8108ea673f9e06fce45342a5f8c26890bf2aa2dd482103fecb774cb14e314351d4c SHA512 8fc179f571c6094b12fabca5e371e7d91d86d2799d282bc4ce2acf096950b18462a0c8dc766e7f4dc29ebba5f188c66375573f8539f8d1d0b1edf385a1d4078e
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
deleted file mode 100644
index e93d2fc046..0000000000
--- a/sys-apps/portage/files/portage-3.0.10-multiprocessing-no-spawn.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-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>
-Date: Thu, 3 Dec 2020 21:37:39 -0800
-Subject: [PATCH] runTests.py: multiprocessing.set_start_method('spawn') for
- debugging bug 758230
-
-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/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 multiprocessing
- import platform
- import signal
- import sys
-@@ -44,6 +45,7 @@ try:
- from _emerge.main import emerge_main
-
- 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-r1.ebuild b/sys-apps/portage/portage-3.0.12.ebuild
similarity index 98%
rename from sys-apps/portage/portage-3.0.10.3-r1.ebuild
rename to sys-apps/portage/portage-3.0.12.ebuild
index c3bac2e8fc..cf3cc74f4b 100644
--- a/sys-apps/portage/portage-3.0.10.3-r1.ebuild
+++ b/sys-apps/portage/portage-3.0.12.ebuild
@@ -94,9 +94,6 @@ pkg_pretend() {
python_prepare_all() {
distutils-r1_python_prepare_all
- # drop this patch when bug 758230 gets resolved
- eapply "${FILESDIR}"/${PN}-3.0.10-multiprocessing-no-spawn.patch # 758230
-
eapply "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
eapply "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
if use gentoo-dev; then
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2022-01-14 12:28 Fabian Groffen
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2022-01-14 12:28 UTC (permalink / raw
To: gentoo-commits
commit: c6c1c09765855d9a1984b358066b4cadfb3c92da
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 14 12:28:16 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Jan 14 12:28:16 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c6c1c097
sys-apps/portage-3.0.30: version bump
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 1 +
.../portage/files/portage-3.0.30-ebuildshell.patch | 349 +++++++++++++++++++++
.../files/portage-3.0.30-prefix-stack.patch | 81 +++++
sys-apps/portage/portage-3.0.30.ebuild | 307 ++++++++++++++++++
4 files changed, 738 insertions(+)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 13a1d23d2a..59b77c8363 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1 +1,2 @@
DIST prefix-portage-3.0.21.tar.bz2 1339211 BLAKE2B 019cf0f3d2d1c45e7849221fc40b49e2c84949b74c8a8c74fbd2ca451a2dd075fb7b8bfec121a173ca0848c57a5a57a62d465b2957c4eb4d87f6a180299da91e SHA512 0aff5004ae80e2cd9dce740c56c3c2643ef390510c3b3821d893e5c76733d3a8d4e7648963febb29479b9ee155868ec11526a393beb3b383e741451178f39e5a
+DIST prefix-portage-3.0.30.tar.bz2 1465506 BLAKE2B 5a575bc6c6c537518a1d4738f59d6f5eec467c834d434493e83cb0262c9c121b0e55906b9f1b877b6e68b4b78f69548df03d8901a619ce1c69d9ffe5f2623e55 SHA512 52bb91057c8c983f227f1d30dcda1bdf915aecc1de89375b2af648e7bfc5543a30f9b670b3d7720724f8277f3e65745a22dfe670038222d61e939fd75c9b7bfd
diff --git a/sys-apps/portage/files/portage-3.0.30-ebuildshell.patch b/sys-apps/portage/files/portage-3.0.30-ebuildshell.patch
new file mode 100644
index 0000000000..20f0aab813
--- /dev/null
+++ b/sys-apps/portage/files/portage-3.0.30-ebuildshell.patch
@@ -0,0 +1,349 @@
+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
+@@ -14,7 +14,8 @@
+ 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*$")
+
+@@ -30,7 +31,7 @@
+ 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""
+@@ -38,14 +39,19 @@
+ 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() :]
++ line = b"declare -" + declare_opts + 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
+@@ -68,6 +74,8 @@
+ if var_assign_match is not None:
+ 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
+@@ -78,7 +86,7 @@
+ 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:
+@@ -86,8 +94,10 @@
+ if declare_match is not None:
+ # 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
+
+@@ -127,8 +137,28 @@
+ + "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:]
++ 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 "-h" in args or "--help" in args:
+ sys.stdout.write(usage + "\n")
+@@ -150,5 +180,5 @@
+ var_pattern.append(br".*\W.*")
+
+ var_pattern = b"^(" + b"|".join(var_pattern) + b")$"
+- filter_bash_environment(re.compile(var_pattern), file_in, file_out)
++ filter_bash_environment(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 @@
+ 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
+@@ -234,6 +234,7 @@
+ 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()
+ ):
+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
+@@ -172,6 +172,7 @@
+ "distlocks",
+ "downgrade-backup",
+ "ebuild-locks",
++ "ebuildshell",
+ "fail-clean",
+ "fakeroot",
+ "fixlafiles",
+--
+2.16.1
+
diff --git a/sys-apps/portage/files/portage-3.0.30-prefix-stack.patch b/sys-apps/portage/files/portage-3.0.30-prefix-stack.patch
new file mode 100644
index 0000000000..c49c473ea3
--- /dev/null
+++ b/sys-apps/portage/files/portage-3.0.30-prefix-stack.patch
@@ -0,0 +1,81 @@
+From 1fe30e79c368ce71e024d70c3ec07a6aed3ef262 Mon Sep 17 00:00:00 2001
+From: Michael Haubenwallner <haubi@gentoo.org>
+Date: Fri, 22 Mar 2019 17:52:05 +0100
+Subject: [PATCH] from FEATURES=stacked-prefix to USE=prefix-stack
+
+Rather than telling the base prefix' portage to support stacked prefix,
+be explicit in the stacked prefix about to USE that feature.
+Bug: https://bugs.gentoo.org/658572
+---
+ bin/install-qa-check.d/05prefix | 10 +++-------
+ bin/phase-helpers.sh | 12 ++++--------
+ lib/portage/const.py | 1 -
+ 3 files changed, 7 insertions(+), 16 deletions(-)
+
+diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
+index 03da3bbce..4f48e4216 100644
+--- a/bin/install-qa-check.d/05prefix
++++ b/bin/install-qa-check.d/05prefix
+@@ -36,16 +36,12 @@ install_qa_check_prefix() {
+ local WHITELIST=" /usr/bin/env "
+ # shebang can be an absolutised path, bug #342929
+ local eprefix=$(canonicalize ${EPREFIX})
+- # Without the stacked-prefix feature, tests using BPREFIX
+- # are redundant to EPREFIX, but run only if we will fail.
++ # Without USE=prefix-stack, tests using BPREFIX are
++ # redundant to EPREFIX, but run only if we will fail.
+ # Otherways, BPREFIX really is BROOT (the EAPI 7 one).
+ local BPREFIX=${EPREFIX}
+ local bprefix=${eprefix}
+- if has stacked-prefix ${FEATURES} &&
+- [[ -z ${ROOT%/} ]] &&
+- [[ ${CBUILD} == ${CHOST} ]] &&
+- [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] &&
+- :; then
++ if has prefix-stack ${USE} ; then
+ BPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}
+ bprefix=$(canonicalize ${BPREFIX})
+ fi
+diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
+index 606b1cdfd..c64f1106b 100644
+--- a/bin/phase-helpers.sh
++++ b/bin/phase-helpers.sh
+@@ -932,18 +932,14 @@ ___best_version_and_has_version_common() {
+ fi ;;
+ esac
+
+- # PREFIX LOCAL: stacked-prefix feature
++ # PREFIX LOCAL: prefix-stack feature
+ if ___eapi_has_prefix_variables &&
+ has "${root_arg}" '--host-root' '-b' &&
+- has stacked-prefix ${FEATURES} &&
++ has prefix-stack ${USE} &&
+ [[ -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.
++ # When we merge into "stacked" EPREFIX, but not into some ROOT, build
++ # tools found in EPREFIX perfectly work for current build environment.
+ "${FUNCNAME[1]}" "${atom}" && return 0
+ fi
+ # END PREFIX LOCAL
+diff --git a/lib/portage/const.py b/lib/portage/const.py
+index eddce377d..db02cbc56 100644
+--- a/lib/portage/const.py
++++ b/lib/portage/const.py
+@@ -207,8 +207,6 @@ SUPPORTED_FEATURES = frozenset([
+ "usersync",
+ "webrsync-gpg",
+ "xattr",
+- # PREFIX LOCAL
+- "stacked-prefix",
+ ]
+ )
+
+--
+2.19.2
+
diff --git a/sys-apps/portage/portage-3.0.30.ebuild b/sys-apps/portage/portage-3.0.30.ebuild
new file mode 100644
index 0000000000..88a5cd8eac
--- /dev/null
+++ b/sys-apps/portage/portage-3.0.30.ebuild
@@ -0,0 +1,307 @@
+# 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_{7..9} )
+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="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-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
+ 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
+}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2022-01-26 7:22 Fabian Groffen
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2022-01-26 7:22 UTC (permalink / raw
To: gentoo-commits
commit: 78bc2780900963532f21545b65fe0c6a91379fa7
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 26 07:21:40 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jan 26 07:21:40 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=78bc2780
sys-apps/portage-3.0.30.1: add interrevisions patch
Closes: https://bugs.gentoo.org/832062
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
.../files/portage-3.0.30-interrevisions.patch | 68 ++++++++++++++++++++++
sys-apps/portage/portage-3.0.30.1.ebuild | 1 +
2 files changed, 69 insertions(+)
diff --git a/sys-apps/portage/files/portage-3.0.30-interrevisions.patch b/sys-apps/portage/files/portage-3.0.30-interrevisions.patch
new file mode 100644
index 0000000000..e53fbd233a
--- /dev/null
+++ b/sys-apps/portage/files/portage-3.0.30-interrevisions.patch
@@ -0,0 +1,68 @@
+https://bugs.gentoo.org/832062
+
+add (back) inter-revision support for Prefix Portage
+
+--- a/lib/portage/versions.py
++++ b/lib/portage/versions.py
+@@ -53,7 +53,9 @@
+ }
+
+ _v = r"(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)"
+-_rev = r"\d+"
++# PREFIX_LOCAL hack: -r(\d+) -> -r(\d+|\d+\.\d+) (see below)
++_rev = r"(\d+|\d+\.\d+)"
++# END_PREFIX_LOCAL
+ _vr = _v + "(-r(" + _rev + "))?"
+
+ _cp = {
+@@ -287,15 +289,47 @@
+ if rval:
+ return rval
+
+- # the suffix part is equal to, so finally check the revision
++ # PREFIX_LOCAL
++ # The suffix part is equal too, so finally check the revision
++ # Prefix hack: historically a revision starting with 0 was an
++ # 'inter-revision', which means that it is possible to create
++ # revisions on revisions. An example is -r01.1 which is the
++ # first revision of -r1. Note that a period (.) is used to
++ # separate the real revision and the secondary revision number.
++ # In the current state, the leading 0 is no longer used, and
++ # versions just can have a dot, which means the version is an
++ # inter-revision.
++ # This trick is in use to allow revision bumps in ebuilds synced
++ # from the main tree for Prefix changes, while still staying in
++ # the main tree versioning scheme. As such it can be used in
++ # any other overlay where ebuilds from the another tree are
++ # shadowed.
+ if match1.group(9):
+- r1 = int(match1.group(9))
++ if '.' in match1.group(9):
++ t = match1.group(9).split(".")
++ r1 = int(t[0])
++ r3 = int(t[1])
++ else:
++ r1 = int(match1.group(9))
++ r3 = 0
+ else:
+ r1 = 0
++ r3 = 0
+ if match2.group(9):
+- r2 = int(match2.group(9))
++ if '.' in match2.group(9):
++ t = match2.group(9).split(".")
++ r2 = int(t[0])
++ r4 = int(t[1])
++ else:
++ r2 = int(match2.group(9))
++ r4 = 0
++ # END_PREFIX_LOCAL
+ else:
+ r2 = 0
++ r4 = 0
++ if r1 == r2 and (r3 != 0 or r4 != 0):
++ r1 = r3
++ r2 = r4
+ rval = (r1 > r2) - (r1 < r2)
+ return rval
+
diff --git a/sys-apps/portage/portage-3.0.30.1.ebuild b/sys-apps/portage/portage-3.0.30.1.ebuild
index 88a5cd8eac..90eda9f188 100644
--- a/sys-apps/portage/portage-3.0.30.1.ebuild
+++ b/sys-apps/portage/portage-3.0.30.1.ebuild
@@ -100,6 +100,7 @@ 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":' \
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/
@ 2024-02-22 7:55 Fabian Groffen
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Groffen @ 2024-02-22 7:55 UTC (permalink / raw
To: gentoo-commits
commit: 468f5ff8c93f28533ca890a29998b4a6941b179c
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 22 07:54:45 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Feb 22 07:54:45 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=468f5ff8
sys-apps/portage-3.0.62: version bump
Closes: https://bugs.gentoo.org/923644
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
sys-apps/portage/Manifest | 2 +-
.../files/portage-2.3.62-prefix-stack.patch | 80 ------
sys-apps/portage/portage-3.0.34.2.ebuild | 311 ---------------------
sys-apps/portage/portage-3.0.62.ebuild | 302 ++++++++++++++++++++
4 files changed, 303 insertions(+), 392 deletions(-)
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index dbd547b19e..529b7d9c4f 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,3 +1,3 @@
-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.56.tar.bz2 1461156 BLAKE2B 2b654c65c5b1e358789774f21e6ee0c6e0dfba0d3d7ca6159f89a6c3d99686f52bbcbace08456d679a4dce62e16547f8b3f85723924e41f0270c644fed16d32c SHA512 10fcf17813dcdf216ac2d31aac9097ca53f4b31a01440c48d53b6d46908fa1c47a31237988b5e583cb7cc26bb8689340f5cf7dc3db0f10e463ed8f6ab375de61
+DIST prefix-portage-3.0.62.tar.bz2 1540010 BLAKE2B 5228459672b9928881fcce58b01c30af4974cf56c5227f6b9a83ae14579821a65b5914a2c538ce3a2e6805a2abde226fb4a9c6b8fb4c8035a5b8a931e813e5b9 SHA512 07bb343c243ada777dd606318b49fb76b436c189d02f086ce069d6a1dbb4ce9fe5539b26c8bb0bb223ea981acaa92397ec43b21a669a8fcea89b4f4fc94d0b1d
diff --git a/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch b/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch
deleted file mode 100644
index b0bdf2a20e..0000000000
--- a/sys-apps/portage/files/portage-2.3.62-prefix-stack.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 1fe30e79c368ce71e024d70c3ec07a6aed3ef262 Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <haubi@gentoo.org>
-Date: Fri, 22 Mar 2019 17:52:05 +0100
-Subject: [PATCH] from FEATURES=stacked-prefix to USE=prefix-stack
-
-Rather than telling the base prefix' portage to support stacked prefix,
-be explicit in the stacked prefix about to USE that feature.
-Bug: https://bugs.gentoo.org/658572
----
- bin/install-qa-check.d/05prefix | 10 +++-------
- bin/phase-helpers.sh | 12 ++++--------
- lib/portage/const.py | 1 -
- 3 files changed, 7 insertions(+), 16 deletions(-)
-
-diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix
-index 03da3bbce..4f48e4216 100644
---- a/bin/install-qa-check.d/05prefix
-+++ b/bin/install-qa-check.d/05prefix
-@@ -36,16 +36,12 @@ install_qa_check_prefix() {
- local WHITELIST=" /usr/bin/env "
- # shebang can be an absolutised path, bug #342929
- local eprefix=$(canonicalize ${EPREFIX})
-- # Without the stacked-prefix feature, tests using BPREFIX
-- # are redundant to EPREFIX, but run only if we will fail.
-+ # Without USE=prefix-stack, tests using BPREFIX are
-+ # redundant to EPREFIX, but run only if we will fail.
- # Otherways, BPREFIX really is BROOT (the EAPI 7 one).
- local BPREFIX=${EPREFIX}
- local bprefix=${eprefix}
-- if has stacked-prefix ${FEATURES} &&
-- [[ -z ${ROOT%/} ]] &&
-- [[ ${CBUILD} == ${CHOST} ]] &&
-- [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] &&
-- :; then
-+ if has prefix-stack ${USE} ; then
- BPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}
- bprefix=$(canonicalize ${BPREFIX})
- fi
-diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
-index 606b1cdfd..c64f1106b 100644
---- a/bin/phase-helpers.sh
-+++ b/bin/phase-helpers.sh
-@@ -932,18 +932,14 @@ ___best_version_and_has_version_common() {
- fi ;;
- esac
-
-- # PREFIX LOCAL: stacked-prefix feature
-+ # PREFIX LOCAL: prefix-stack feature
- if ___eapi_has_prefix_variables &&
- has "${root_arg}" '--host-root' '-b' &&
-- has stacked-prefix ${FEATURES} &&
-+ has prefix-stack ${USE} &&
- [[ -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.
-+ # When we merge into "stacked" EPREFIX, but not into some ROOT, build
-+ # tools found in EPREFIX perfectly work for current build environment.
- "${FUNCNAME[1]}" "${atom}" && return 0
- fi
- # END PREFIX LOCAL
-diff --git a/lib/portage/const.py b/lib/portage/const.py
-index eddce377d..db02cbc56 100644
---- a/lib/portage/const.py
-+++ b/lib/portage/const.py
-@@ -207,7 +207,6 @@ SUPPORTED_FEATURES = frozenset([
- "splitdebug",
- "split-elog",
- "split-log",
-- "stacked-prefix", # PREFIX LOCAL
- "strict",
- "strict-keepdir",
- "stricter",
---
-2.19.2
-
diff --git a/sys-apps/portage/portage-3.0.34.2.ebuild b/sys-apps/portage/portage-3.0.34.2.ebuild
deleted file mode 100644
index 148d1f4259..0000000000
--- a/sys-apps/portage/portage-3.0.34.2.ebuild
+++ /dev/null
@@ -1,311 +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="The package management system for 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=(
- # dropped in 3.0.34: is there anyone but haubi using this?
- # "${FILESDIR}"/${PN}-3.0.30-prefix-stack.patch # 658572
- # disabled in 3.0.24: does not apply, while useful, rarely used if ever
- # "${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|" \
- -e "1s|/usr/bin/env |${EPREFIX}/usr/bin/|" \
- -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 ..."
- 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
-
- # 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.62.ebuild b/sys-apps/portage/portage-3.0.62.ebuild
new file mode 100644
index 0000000000..7f20a5531f
--- /dev/null
+++ b/sys-apps/portage/portage-3.0.62.ebuild
@@ -0,0 +1,302 @@
+# 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-build/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.9
+ !build? (
+ >=app-admin/eselect-1.2
+ !prefix? ( 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? ( !prefix? ( >=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}
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.0.55.1-interrevisions.patch
+)
+
+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
+ # 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}"
+ sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
+ -e "s|@PORTAGE_MV@|$(type -P mv)|" \
+ -e "s|@PORTAGE_BASH@|${bash}|" \
+ -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 \
+ lib/portage/const_autotool.py cnf/make.globals \
+ || die "Failed to patch sources"
+
+ sed -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
+ -i \
+ bin/ebuild-helpers/dohtml bin/ebuild-pyhelper \
+ bin/misc-functions.sh bin/phase-functions.sh \
+ || 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] 8+ messages in thread
end of thread, other threads:[~2024-02-22 7:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27 13:10 [gentoo-commits] repo/proj/prefix:master commit in: sys-apps/portage/, sys-apps/portage/files/ Michael Haubenwallner
-- strict thread matches above, loose matches on Subject: below --
2018-12-06 13:49 Fabian Groffen
2019-03-25 14:20 Michael Haubenwallner
2020-12-04 10:38 Fabian Groffen
2020-12-07 17:39 Fabian Groffen
2022-01-14 12:28 Fabian Groffen
2022-01-26 7:22 Fabian Groffen
2024-02-22 7:55 Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox