summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2020-08-02 13:43:06 +0200
committerFabian Groffen <grobian@gentoo.org>2020-08-02 13:43:06 +0200
commite4209bd2ca1ed72324cac02cd49a0634114c5f10 (patch)
tree8043bdfe2d7dd510ee194f903b0781c10839cab1
parentdev-lang/python: bump for security, drop/mask vulnerable versions (diff)
downloadprefix-e4209bd2ca1ed72324cac02cd49a0634114c5f10.tar.gz
prefix-e4209bd2ca1ed72324cac02cd49a0634114c5f10.tar.bz2
prefix-e4209bd2ca1ed72324cac02cd49a0634114c5f10.zip
sys-apps/portage: cleanup and version bump 3.0.1
Package-Manager: Portage-3.0.1-prefix, Repoman-2.3.23 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--sys-apps/portage/Manifest3
-rw-r--r--sys-apps/portage/files/05portage.envd1
-rw-r--r--sys-apps/portage/files/portage-2.2.28-cygwin.patch16
-rw-r--r--sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch354
-rw-r--r--sys-apps/portage/files/portage-2.3.10-ebuildshell.patch355
-rw-r--r--sys-apps/portage/files/portage-2.3.40-ebuildshell.patch354
-rw-r--r--sys-apps/portage/files/portage-ccache.conf2
-rw-r--r--sys-apps/portage/metadata.xml1
-rw-r--r--sys-apps/portage/portage-2.3.100.ebuild264
-rw-r--r--sys-apps/portage/portage-2.3.84.ebuild264
-rw-r--r--sys-apps/portage/portage-3.0.1.ebuild (renamed from sys-apps/portage/portage-2.3.68.ebuild)117
11 files changed, 79 insertions, 1652 deletions
diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest
index 7e8f3291c5..40b9f12b82 100644
--- a/sys-apps/portage/Manifest
+++ b/sys-apps/portage/Manifest
@@ -1,3 +1,2 @@
DIST prefix-portage-2.3.100.tar.bz2 1331695 BLAKE2B 165f113041da8ad1150cc59d25a420effaa163a7694ba8ff36ce1e5fa75669b8fde31ad74594b28b987f9ec5685b9a31aa5228419afd476726ba17ec8f7575db SHA512 8163bfd4e83e48d560dd07150dd468d3b4a63d1507d23226107479bd5de9da3cd94308851b64c63851572288877cb2774f986f8c1a5163521a341ce4c72fbf0c
-DIST prefix-portage-2.3.68.tar.bz2 1283044 BLAKE2B 81a9462c2b34b64baff78bc046676abf147a6840f7fb2872c9e26eef5a110e2c53b550ac213f734f7c4e70e4b220ea62d885cd99652d9093448f6e5c4633a115 SHA512 7c6124e0b01fd1fdba68a5cb68882baa2301945faf559bb61afd6b632128ca435d7e9a596b1079bd744ed4155041399ba0a3779190c9fa891b5dc815ccb46813
-DIST prefix-portage-2.3.84.tar.bz2 1289922 BLAKE2B 1644b7c1a03b7fbccabe24bfd9c8378d12aeabeda2db35e286372901898d5f572c39e36625fbc2914334ca64e38e1320adca0143a9898fca64223be7d8a877cc SHA512 e243e21405a53e6ff234a7851fc4ef869450dc213acd6ed2168329c7c947289a97c60104aa31bd85319b3fef0abbc2c5759608abd795edc426b06ddea2ce3cdb
+DIST prefix-portage-3.0.1.tar.bz2 1279330 BLAKE2B ac94a2c2b56f23cf35cb229ae8719077e41fe7fb8e74d16beb3542b43d246d6c26dce73b9cec4c126b65b9bf0b4452bc233a83aeb4c873e8dd7c8d5742008221 SHA512 5c141b80e20f11aad6990e5f42fcc2cddb6475e03fc978fd1446773dd6833dd4ccf96b07440e1184cb95e210654218011b383872004907a915164813da22663c
diff --git a/sys-apps/portage/files/05portage.envd b/sys-apps/portage/files/05portage.envd
deleted file mode 100644
index ec949055ca..0000000000
--- a/sys-apps/portage/files/05portage.envd
+++ /dev/null
@@ -1 +0,0 @@
-PYTHONPATH="@GENTOO_PORTAGE_EPREFIX@/usr/lib/portage/pym"
diff --git a/sys-apps/portage/files/portage-2.2.28-cygwin.patch b/sys-apps/portage/files/portage-2.2.28-cygwin.patch
deleted file mode 100644
index 9a9bbec43a..0000000000
--- a/sys-apps/portage/files/portage-2.2.28-cygwin.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- prefix-portage-2.2.28/bin/helper-functions.sh.orig 2016-11-16 15:43:02.338368826 +0100
-+++ prefix-portage-2.2.28/bin/helper-functions.sh 2016-11-16 15:43:21.498359600 +0100
-@@ -21,11 +21,12 @@
- # Setup a pipe for children to write their pids to when they finish.
- # We have to allocate two fd's because POSIX has undefined behavior
- # when you open a FIFO for simultaneous read/write. #487056
-+ # And Cygwin supports just one read/write fd at once. #583962
- local pipe=$(mktemp -t multijob.XXXXXX)
- rm -f "${pipe}"
- mkfifo -m 600 "${pipe}"
-- __redirect_alloc_fd mj_write_fd "${pipe}"
- __redirect_alloc_fd mj_read_fd "${pipe}"
-+ __redirect_alloc_fd mj_write_fd "${pipe}" '>'
- rm -f "${pipe}"
-
- # See how many children we can fork based on the user's settings.
diff --git a/sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch b/sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch
deleted file mode 100644
index 298f0a0b08..0000000000
--- a/sys-apps/portage/files/portage-2.2.28-ebuildshell-r1.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-From bd58cc5f041558ab0885a1bf733319c38a24f24b Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH] Add the ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 145 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 57 ++++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- pym/_emerge/AbstractEbuildProcess.py | 1 +
- pym/portage/const.py | 1 +
- 6 files changed, 194 insertions(+), 18 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index a400ef7..b5a4eaa 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -112,7 +112,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -524,6 +524,149 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+
-+ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index a4cdc54..1c4ad58 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
-
- var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(r'(\\"|"|\')\s*$')
--readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(r'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -29,7 +30,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = ''
-@@ -37,14 +38,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ sys.stderr.write(var + "\n")
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += 'r'
- if declare_opts:
-- line = 'declare -%s %s' % \
-- (declare_opts, line[readonly_match.end():])
-+ line = 'declare -%s %s%s' % \
-+ (declare_opts, var, line[readonly_match.end():])
- else:
-- line = 'declare ' + line[readonly_match.end():]
-+ line = 'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -68,6 +74,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -77,7 +85,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace("\1", ""))
- continue
- else:
-@@ -86,8 +94,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -124,13 +134,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -154,5 +179,5 @@ if __name__ == "__main__":
-
- var_pattern = "^(%s)$" % "|".join(var_pattern)
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index f0bf001..706660d 100644
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index aea189e..46b0aa4 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -380,6 +380,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 8bd30a6..4ff78b4 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -161,6 +161,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 179efce..0a91aaf 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -142,6 +142,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.10.2
-
diff --git a/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
deleted file mode 100644
index d0381a0696..0000000000
--- a/sys-apps/portage/files/portage-2.3.10-ebuildshell.patch
+++ /dev/null
@@ -1,355 +0,0 @@
-From 05a16e4c910f7dc053358d8519c6708d3a4b14ca Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH] Add ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 57 ++++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- pym/_emerge/AbstractEbuildProcess.py | 1 +
- pym/portage/const.py | 1 +
- 6 files changed, 195 insertions(+), 18 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index a60a24d..b592372 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -121,7 +121,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -533,6 +533,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
-+
-+ env -i ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index 029e491..0ddda7c 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -14,7 +14,8 @@ func_end_re = re.compile(r'^\}$')
-
- var_assign_re = re.compile(r'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(r'(\\"|"|\')\s*$')
--readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(r'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(r'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(r'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -29,7 +30,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = ''
-@@ -37,14 +38,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ sys.stderr.write(var + "\n")
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += 'r'
- if declare_opts:
-- line = 'declare -%s %s' % \
-- (declare_opts, line[readonly_match.end():])
-+ line = 'declare -%s %s%s' % \
-+ (declare_opts, var, line[readonly_match.end():])
- else:
-- line = 'declare ' + line[readonly_match.end():]
-+ line = 'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -68,6 +74,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -77,7 +85,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace("\1", ""))
- continue
- else:
-@@ -86,8 +94,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -124,13 +134,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -154,5 +179,5 @@ if __name__ == "__main__":
-
- var_pattern = "^(%s)$" % "|".join(var_pattern)
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index 4c6ca3f..bbb5780 100755
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index 653e8bc..2bb8e71 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 8bd30a6..4ff78b4 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -161,6 +161,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 172c5b1..a0ad1f9 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -160,6 +160,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.10.2
-
diff --git a/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch b/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch
deleted file mode 100644
index 0c1e48a82d..0000000000
--- a/sys-apps/portage/files/portage-2.3.40-ebuildshell.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-From 8c6b115fa0325b5bed2e1a9c4c8e8af45cdecc2e Mon Sep 17 00:00:00 2001
-From: Michael Haubenwallner <michael.haubenwallner@salomon.at>
-Date: Wed, 6 Nov 2013 12:40:05 +0100
-Subject: [PATCH 1/2] Add ebuildshell feature, bug#155161.
-
----
- bin/ebuild.sh | 146 ++++++++++++++++++++++++++++++++++-
- bin/filter-bash-environment.py | 55 +++++++++----
- bin/save-ebuild-env.sh | 2 +-
- man/make.conf.5 | 6 ++
- pym/_emerge/AbstractEbuildProcess.py | 1 +
- pym/portage/const.py | 1 +
- 6 files changed, 194 insertions(+), 17 deletions(-)
-
-diff --git a/bin/ebuild.sh b/bin/ebuild.sh
-index f76a48d8e..683a4e9c1 100755
---- a/bin/ebuild.sh
-+++ b/bin/ebuild.sh
-@@ -121,7 +121,7 @@ __qa_source() {
- __qa_call() {
- local shopts=$(shopt) OLDIFS="$IFS"
- local retval
-- "$@"
-+ __call-ebuildshell "$@"
- retval=$?
- set +e
- [[ $shopts != $(shopt) ]] &&
-@@ -547,6 +547,150 @@ if [[ -n ${QA_INTERCEPTORS} ]] ; then
- unset BIN_PATH BIN BODY FUNC_SRC
- fi
-
-+__call-ebuildshell() {
-+ if ! has ebuildshell ${FEATURES}; then
-+ "$@"
-+ return $?
-+ fi
-+ local __ebuildshell_args=( "$@" )
-+ # These are the variables I have seen 'bash -i' maintaining the values for:
-+ local __ebuildshell_bash_i_vars="__ebuildshell_.*
-+ _ BASH_ARGC BASH_ARGV BASH_COMMAND BASH_LINENO BASH_SOURCE
-+ BASH_VERSINFO BASH_SUBSHELL BASHOPTS BASHPID COMP_WORDBREAKS
-+ DIRSTACK EUID FUNCNAME GROUPS HISTCMD HISTFILE LINENO PIPESTATUS
-+ PPID PS1 PS2 PS3 PS4 PWD RANDOM SECONDS SHELLOPTS UID"
-+ # Allow recursive ebuildshell, for use in multibuild.eclass and similar:
-+ local __ebuildshell_pid=${BASHPID:-$(__bashpid)}
-+ local __ebuildshell_tmpf="${T}/ebuildshell.${__ebuildshell_pid}"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+ (
-+ cat <<-EOE
-+ # local variables of functions using recursive ebuildshell are
-+ # visible to the EXIT trap of that recursive ebuildshell. To
-+ # keep them local, we have to filter them from that recursive
-+ # ebuildshell's return-env. As 'declare -p' is unable to tell
-+ # local-ity of variables, we abuse the trace attribute for local
-+ # variables to filter them from the return-env. So we need the
-+ # local alias active before declaring any functions.
-+ # On a sidehand, this allows for copy&paste of function body
-+ # lines including the local keyword.
-+ alias local='declare -t'
-+ shopt -s expand_aliases
-+ EOE
-+ (
-+ declare -p
-+ declare -fp
-+ shopt -p
-+ [[ ${BASH_VERSINFO[0]} == 3 ]] && export
-+ ) |
-+ (
-+ # we need everything but the bash vars after 'env -i'
-+ 2>"${__ebuildshell_tmpf}.ebuild-rovars" \
-+ "${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}" \
-+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py \
-+ --report-readonly-variables \
-+ --preserve-readonly-attribute \
-+ "${__ebuildshell_bash_i_vars}" \
-+ || die "filter-bash-environment.py failed"
-+ )
-+ # 'declare -g' is available since bash-4.2,
-+ # https://bugs.gentoo.org/show_bug.cgi?id=155161#c35
-+ if (( ${BASH_VERSINFO[0]} > 4 )) ||
-+ (( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} >= 2 ))
-+ then
-+ __ebuildshell_bash42_true=
-+ __ebuildshell_bash42_false='#bash-4.2#'
-+ else
-+ __ebuildshell_bash42_true='#bash-4.2#'
-+ __ebuildshell_bash42_false=
-+ fi
-+ # The already readonly variables, without bash maintained ones:
-+ __ebuildshell_ro_ebuild_vars=$(<"${__ebuildshell_tmpf}.ebuild-rovars")
-+ cat <<-EOE
-+ # properly quote the function arguments
-+ $(declare -p __ebuildshell_args)
-+ set -- "\${__ebuildshell_args[@]}"
-+ unset __ebuildshell_args
-+ # be informative about what to do
-+ PS1="EBUILD ${PN} $1 \$ "
-+ type $1
-+ ${__ebuildshell_bash42_false}echo 'warning: preserving variables across phases requires bash-4.2'
-+ echo "WANTED: \$@"
-+ echo "or use: \"\\\$@\""
-+ # use bash history, but not the 'user's real one
-+ HISTFILE=~/.bash_history
-+ # but do not use history-expansion with '!',
-+ # for copy&paste of function body lines containing: !
-+ set +H
-+ # this is a debugging shell already
-+ shopt -u extdebug
-+ trap - DEBUG
-+ # at exit, dump the current environment
-+ trap "
-+ unalias local
-+ unset -f __call-ebuildshell
-+ rm -f '${__ebuildshell_tmpf}.return-'*
-+ (
-+ (
-+ # declare -p does not tell the -g flag,
-+ # so we add it by aliasing declare.
-+ ${__ebuildshell_bash42_true}echo \"alias declare='declare -g'\"
-+ declare -p
-+ ${__ebuildshell_bash42_true}echo \"unalias declare\"
-+ declare -fp
-+ shopt -p | grep -v '\\(expand_aliases\\|extdebug\\)$'
-+ $([[ ${BASH_VERSINFO[0]} == 3 ]] && echo export)
-+ ) |
-+ (
-+ # We may have more readonly variables now, yet we
-+ # need to filter variables that were readonly before.
-+ # And filter local variables by their trace attribute.
-+ 2>'${__ebuildshell_tmpf}.return-rovars' \\
-+ '${PORTAGE_PYTHON:-/tools/haubi/gentoo/s01en24/usr/bin/python}' \\
-+ '${PORTAGE_BIN_PATH}'/filter-bash-environment.py \\
-+ --report-readonly-variables \\
-+ --preserve-readonly-attribute \\
-+ --filter-traced-variables \\
-+ '${__ebuildshell_bash_i_vars} \
-+ ${__ebuildshell_ro_ebuild_vars}' \\
-+ || die 'filter-bash-environment.py failed'
-+ )
-+ ) > '${__ebuildshell_tmpf}.return-env'
-+ " EXIT
-+ # can do some cleanup right now
-+ rm -f '${__ebuildshell_tmpf}.ebuild-'*
-+ EOE
-+ ) > "${__ebuildshell_tmpf}.ebuild-env"
-+
-+ # pre-fill the history with "$@"
-+ echo '"$@"' >> ~/.bash_history
-+ chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} ~/.bash_history &>/dev/null
-+
-+ env -i HOME=~ ${BASH} --rcfile "${__ebuildshell_tmpf}.ebuild-env" -i
-+
-+ # The environment- and exit-status handling after leaving the ebuildshell
-+ # prompt is expected to be identical as without the ebuildshell prompt.
-+ local __ebuildshell_status=$?
-+
-+ # We might be in a recursive ebuildshell, but do not want
-+ # any aliases being active while sourcing the return-env.
-+ local __ebuildshell_orig_aliases=$(alias)
-+ unalias -a
-+ source "${__ebuildshell_tmpf}.return-env"
-+ unalias -a
-+ eval "${__ebuildshell_orig_aliases}"
-+
-+ # Portage has a whitelist of readonly variables: If an ebuild defines
-+ # additional readonly variables, their readonly attribute is removed
-+ # across ebuild phases. If we ever want to preserve the readonly
-+ # attribute of additional ebuild-defined variables across phases,
-+ # when returning from the ebuildshell their names are in
-+ # "${__ebuildshell_tmpf}.return-rovars"
-+ rm -f "${__ebuildshell_tmpf}."{ebuild,return}-{env,rovars}
-+
-+ return ${__ebuildshell_status}
-+}
-+
- # Subshell/helper die support (must export for the die helper).
- export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)}
- trap 'exit 1' SIGTERM
-diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
-index 06cac7214..5590dbfc4 100755
---- a/bin/filter-bash-environment.py
-+++ b/bin/filter-bash-environment.py
-@@ -12,7 +12,8 @@ func_end_re = re.compile(br'^\}$')
-
- var_assign_re = re.compile(br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$')
- close_quote_re = re.compile(br'(\\"|"|\')\s*$')
--readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+')
-+readonly_re = re.compile(br'^declare\s+-(\S*)r(\S*)\s+([^=\s]+)')
-+trace_re = re.compile(br'^declare\s+-\S*t\S*\s+')
- # declare without assignment
- var_declare_re = re.compile(br'^declare(\s+-\S+)?\s+([^=\s]+)\s*$')
-
-@@ -27,7 +28,7 @@ def have_end_quote(quote, line):
- return close_quote_match is not None and \
- close_quote_match.group(1) == quote
-
--def filter_declare_readonly_opt(line):
-+def filter_declare_readonly_opt(line, options):
- readonly_match = readonly_re.match(line)
- if readonly_match is not None:
- declare_opts = b''
-@@ -35,14 +36,19 @@ def filter_declare_readonly_opt(line):
- group = readonly_match.group(i)
- if group is not None:
- declare_opts += group
-+ var = readonly_match.group(3)
-+ if '--report-readonly-variables' in options:
-+ getattr(sys.stderr, 'buffer', sys.stderr).write(var + b'\n')
-+ if '--preserve-readonly-attribute' in options:
-+ declare_opts += b'r'
- if declare_opts:
- line = b'declare -' + declare_opts + \
-- b' ' + line[readonly_match.end():]
-+ b' ' + var + line[readonly_match.end():]
- else:
-- line = b'declare ' + line[readonly_match.end():]
-+ line = b'declare ' + var + line[readonly_match.end():]
- return line
-
--def filter_bash_environment(pattern, file_in, file_out):
-+def filter_bash_environment(pattern, file_in, file_out, options):
- # Filter out any instances of the \1 character from variable values
- # since this character multiplies each time that the environment
- # is saved (strange bash behavior). This can eventually result in
-@@ -66,6 +72,8 @@ def filter_bash_environment(pattern, file_in, file_out):
- quote = var_assign_match.group(3)
- filter_this = pattern.match(var_assign_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- # Exclude the start quote when searching for the end quote,
- # to ensure that the start quote is not misidentified as the
- # end quote (happens if there is a newline immediately after
-@@ -75,7 +83,7 @@ def filter_bash_environment(pattern, file_in, file_out):
- multi_line_quote = quote
- multi_line_quote_filter = filter_this
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line.replace(b"\1", b""))
- continue
- else:
-@@ -84,8 +92,10 @@ def filter_bash_environment(pattern, file_in, file_out):
- # declare without assignment
- filter_this = pattern.match(declare_match.group(2)) \
- is not None
-+ if not filter_this and '--filter-traced-variables' in options:
-+ filter_this = trace_re.match(line) is not None
- if not filter_this:
-- line = filter_declare_readonly_opt(line)
-+ line = filter_declare_readonly_opt(line, options)
- file_out.write(line)
- continue
-
-@@ -122,13 +132,28 @@ if __name__ == "__main__":
- "while leaving bash function definitions and here-documents " + \
- "intact. The PATTERN is a space separated list of variable names" + \
- " and it supports python regular expression syntax."
-- usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0])
-- args = sys.argv[1:]
--
-- if '-h' in args or '--help' in args:
-- sys.stdout.write(usage + "\n")
-- sys.stdout.flush()
-- sys.exit(os.EX_OK)
-+ usage = "usage: %s [-h|<options>] PATTERN" % os.path.basename(sys.argv[0])
-+ args = []
-+ known_options = {
-+ '--report-readonly-variables':
-+ "Write names of readonly variables to stderr.",
-+ '--preserve-readonly-attribute':
-+ "Preserve the '-r' flag in 'declare -r'.",
-+ '--filter-traced-variables':
-+ "Filter out variables declared with '-t' attribute."
-+ }
-+ options = {}
-+ for arg in sys.argv[1:]:
-+ if arg in known_options.keys():
-+ options[arg] = True
-+ continue
-+ if '-h' == arg or '--help' == arg:
-+ sys.stdout.write(usage + "\n\nKnown <options>:\n\n")
-+ for option, descr in known_options.items():
-+ sys.stdout.write(" " + option + "\t" + descr + "\n")
-+ sys.stdout.flush()
-+ sys.exit(os.EX_OK)
-+ args.append(arg)
-
- if len(args) != 1:
- sys.stderr.write(usage + "\n")
-@@ -151,5 +176,5 @@ if __name__ == "__main__":
-
- var_pattern = b'^(' + b'|'.join(var_pattern) + b')$'
- filter_bash_environment(
-- re.compile(var_pattern), file_in, file_out)
-+ re.compile(var_pattern), file_in, file_out, options)
- file_out.flush()
-diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
-index bb17382d4..af35a3327 100755
---- a/bin/save-ebuild-env.sh
-+++ b/bin/save-ebuild-env.sh
-@@ -53,7 +53,7 @@ __save_ebuild_env() {
- einfo einfon ewarn eerror ebegin __eend eend KV_major \
- KV_minor KV_micro KV_to_int get_KV has \
- __has_phase_defined_up_to \
-- hasv hasq __qa_source __qa_call \
-+ hasv hasq __qa_source __qa_call __call-ebuildshell \
- addread addwrite adddeny addpredict __sb_append_var \
- use usev useq has_version portageq \
- best_version use_with use_enable register_die_hook \
-diff --git a/man/make.conf.5 b/man/make.conf.5
-index b0c1aa4f2..568f350a0 100644
---- a/man/make.conf.5
-+++ b/man/make.conf.5
-@@ -408,6 +408,12 @@ exist). Also see the related \fIunmerge\-backup\fR feature.
- Use locks to ensure that unsandboxed ebuild phases never execute
- concurrently. Also see \fIparallel\-install\fR.
- .TP
-+.B ebuildshell
-+Drop into an interactive shell for each phase function, meant for
-+debugging. Because the shell would normally be used to execute the
-+phase function, commands like src_unpack or epatch are available in the
-+interactive shell. Use `die` to terminate the merge.
-+.TP
- .B fail\-clean
- Clean up temporary files after a build failure. This is particularly useful
- if you have \fBPORTAGE_TMPDIR\fR on tmpfs. If this feature is enabled, you
-diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
-index 370cac529..a521596e5 100644
---- a/pym/_emerge/AbstractEbuildProcess.py
-+++ b/pym/_emerge/AbstractEbuildProcess.py
-@@ -181,6 +181,7 @@ class AbstractEbuildProcess(SpawnProcess):
- self.fd_pipes = {}
- null_fd = None
- if 0 not in self.fd_pipes and \
-+ "ebuildshell" not in self.settings.features and \
- self.phase not in self._phases_interactive_whitelist and \
- "interactive" not in self.settings.get("PROPERTIES", "").split():
- null_fd = os.open('/dev/null', os.O_RDONLY)
-diff --git a/pym/portage/const.py b/pym/portage/const.py
-index 3c23c85ed..d9c57f300 100644
---- a/pym/portage/const.py
-+++ b/pym/portage/const.py
-@@ -161,6 +161,7 @@ SUPPORTED_FEATURES = frozenset([
- "distlocks",
- "downgrade-backup",
- "ebuild-locks",
-+ "ebuildshell",
- "fail-clean",
- "fakeroot",
- "fixlafiles",
---
-2.16.1
-
diff --git a/sys-apps/portage/files/portage-ccache.conf b/sys-apps/portage/files/portage-ccache.conf
new file mode 100644
index 0000000000..37857fde31
--- /dev/null
+++ b/sys-apps/portage/files/portage-ccache.conf
@@ -0,0 +1,2 @@
+# Prevent ccache files from being cleaned
+x /var/tmp/ccache
diff --git a/sys-apps/portage/metadata.xml b/sys-apps/portage/metadata.xml
index 1ffd22f625..062dafe624 100644
--- a/sys-apps/portage/metadata.xml
+++ b/sys-apps/portage/metadata.xml
@@ -11,7 +11,6 @@
<email>dev-portage@gentoo.org</email>
</maintainer>
<use>
- <flag name="epydoc">Build html API documentation with epydoc.</flag>
<flag name="apidoc">Build html API documentation with sphinx-apidoc.</flag>
<flag name="gentoo-dev">Enable features required for Gentoo ebuild development.</flag>
<flag name="ipc">Use inter-process communication between portage and
diff --git a/sys-apps/portage/portage-2.3.100.ebuild b/sys-apps/portage/portage-2.3.100.ebuild
deleted file mode 100644
index a651d7eeb5..0000000000
--- a/sys-apps/portage/portage-2.3.100.ebuild
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=(
- pypy3
- python3_{6,7,8,9}
- python2_7
-)
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-
-inherit eutils distutils-r1 multilib
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-LICENSE="GPL-2"
-KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="0"
-IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
-
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )"
-# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-RDEPEND="
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- !build? (
- >=sys-apps/sed-4.0.5
- app-shells/bash:0[readline]
- >=app-admin/eselect-1.2
- $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
- python{2_7,3_4,3_5} pypy)
- )
- elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_uclibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- kernel_linux? ( >=app-misc/pax-utils-0.1.17 )
- kernel_SunOS? ( >=app-misc/pax-utils-0.1.17 )
- kernel_FreeBSD? ( >=app-misc/pax-utils-0.1.17 )
- kernel_Darwin? ( >=app-misc/pax-utils-0.1.18 )
- kernel_AIX? ( >=sys-apps/aix-miscutils-0.1.1634 )
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
- python2_7 pypy)
- ) )
- !<app-admin/logrotate-3.8.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- userland_GNU? ( >=sys-apps/coreutils-6.4 )
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
-
-SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-TARBALL_PV=${PV}
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-
-pkg_setup() {
- use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
-}
-
-python_prepare_all() {
- distutils-r1_python_prepare_all
-
- epatch "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
-
- if use native-extensions; then
- printf "[build_ext]\nportage-ext-modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use epydoc && targets+=( epydoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use epydoc && targets+=(
- install_epydoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- # comment out sanity test until it is fixed to work
- # with the new PORTAGE_PYM_PATH
- #if [[ $ROOT == / ]] ; then
- ## Run some minimal tests as a sanity check.
- #local test_runner=$(find "${ED}" -name runTests)
- #if [[ -n $test_runner && -x $test_runner ]] ; then
- #einfo "Running preinst sanity tests..."
- #"$test_runner" || die "preinst sanity tests failed"
- #fi
- #fi
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
- fi
-}
diff --git a/sys-apps/portage/portage-2.3.84.ebuild b/sys-apps/portage/portage-2.3.84.ebuild
deleted file mode 100644
index 083ed2521d..0000000000
--- a/sys-apps/portage/portage-2.3.84.ebuild
+++ /dev/null
@@ -1,264 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=(
- pypy3
- python3_6 python3_7
- python2_7
-)
-PYTHON_REQ_USE='bzip2(+),threads(+)'
-
-inherit eutils distutils-r1 multilib
-
-DESCRIPTION="Portage package manager used in Gentoo Prefix"
-HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
-LICENSE="GPL-2"
-KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-SLOT="0"
-IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
-
-DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- >=sys-apps/sed-4.0.5 sys-devel/patch
- doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )"
-# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
-# For whirlpool hash, require python[ssl] (bug #425046).
-# For compgen, require bash[readline] (bug #445576).
-RDEPEND="
- >=app-arch/tar-1.27
- dev-lang/python-exec:2
- !build? (
- >=sys-apps/sed-4.0.5
- app-shells/bash:0[readline]
- >=app-admin/eselect-1.2
- $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
- python{2_7,3_4,3_5} pypy)
- )
- elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
- elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- elibc_uclibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
- kernel_linux? ( >=app-misc/pax-utils-0.1.17 )
- kernel_SunOS? ( >=app-misc/pax-utils-0.1.17 )
- kernel_FreeBSD? ( >=app-misc/pax-utils-0.1.17 )
- kernel_Darwin? ( >=app-misc/pax-utils-0.1.18 )
- kernel_AIX? ( >=sys-apps/aix-miscutils-0.1.1634 )
- selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
- xattr? ( kernel_linux? (
- >=sys-apps/install-xattr-0.3
- $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
- python2_7 pypy)
- ) )
- !<app-admin/logrotate-3.8.0"
-PDEPEND="
- !build? (
- >=net-misc/rsync-2.6.4
- userland_GNU? ( >=sys-apps/coreutils-6.4 )
- )"
-# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
-# NOTE: FEATURES=installsources requires debugedit and rsync
-
-REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
-
-SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
-
-prefix_src_archives() {
- local x y
- for x in ${@}; do
- for y in ${SRC_ARCHIVES}; do
- echo ${y}/${x}
- done
- done
-}
-
-TARBALL_PV=${PV}
-SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
- $(prefix_src_archives prefix-${PN}-${TARBALL_PV}.tar.bz2)"
-
-S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-
-pkg_setup() {
- use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
-}
-
-python_prepare_all() {
- distutils-r1_python_prepare_all
-
- epatch "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
-
- if use native-extensions; then
- printf "[build_ext]\nportage-ext-modules=true\n" >> \
- setup.cfg || die
- fi
-
- if ! use ipc ; then
- einfo "Disabling ipc..."
- sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
- -i lib/_emerge/AbstractEbuildProcess.py || \
- die "failed to patch AbstractEbuildProcess.py"
- fi
-
- if use xattr && use kernel_linux ; then
- einfo "Adding FEATURES=xattr to make.globals ..."
- echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
- || die "failed to append to make.globals"
- fi
-
- if [[ -n ${EPREFIX} ]] ; then
- # PREFIX LOCAL: only hack const_autotool
- local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
- # ok, we can't rely on PORTAGE_ROOT_USER being there yet, as people
- # tend not to update that often, as long as we are a separate ebuild
- # we can assume when unset, it's time for some older trick
- if [[ -z ${PORTAGE_ROOT_USER} ]] ; then
- PORTAGE_ROOT_USER=$(python -c 'from portage.const import rootuser; print rootuser')
- fi
- # We need to probe for bash in the Prefix, because it may not
- # exist, in which case we fall back to the currently in use
- # bash. This logic is necessary in particular during bootstrap,
- # where we pull ourselves out of a temporary place with tools
- local bash="${EPREFIX}/bin/bash"
- [[ ! -x ${bash} ]] && bash=${BASH}
-
- einfo "Adjusting sources for ${EPREFIX}"
- find . -type f -exec \
- sed -e "s|@PORTAGE_EPREFIX@|${EPREFIX}|" \
- -e "s|@PORTAGE_MV@|$(type -P mv)|" \
- -e "s|@PORTAGE_BASH@|${bash}|" \
- -e "s|@PREFIX_PORTAGE_PYTHON@|$(type -P python)|" \
- -e "s|@EXTRA_PATH@|${extrapath}|" \
- -e "s|@portagegroup@|${PORTAGE_GROUP:-portage}|" \
- -e "s|@portageuser@|${PORTAGE_USER:-portage}|" \
- -e "s|@rootuser@|${PORTAGE_ROOT_USER:-root}|" \
- -e "s|@rootuid@|$(id -u ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@rootgid@|$(id -g ${PORTAGE_ROOT_USER:-root})|" \
- -e "s|@sysconfdir@|${EPREFIX}/etc|" \
- -i '{}' + || \
- die "Failed to patch sources"
- # We don't need the below, since setup.py deals with this (and
- # more) so we don't have to make this correct
- # -e "s|@PORTAGE_BASE@|${EPREFIX}/usr/lib/portage/${EPYTHON}|" \
-
- # remove Makefiles, or else they will get installed
- find . -name "Makefile.*" -delete
-
- einfo "Prefixing shebangs ..."
- while read -r -d $'\0' ; do
- local shebang=$(head -n1 "$REPLY")
- if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
- sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
- die "sed failed"
- fi
- done < <(find . -type f -print0)
-
- einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
- sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
- bin/emerge-webrsync || die
-
- einfo "Making absent gemato non-fatal"
- sed -i -e '/exitcode = 127/d' \
- lib/portage/sync/modules/rsync/rsync.py || die
- # END PREFIX LOCAL
- fi
-
- # PREFIX LOCAL: make.conf is written by bootstrap-prefix.sh
- if use !prefix ; then
- cd "${S}/cnf" || die
- if [ -f "make.conf.example.${ARCH}".diff ]; then
- patch make.conf.example "make.conf.example.${ARCH}".diff || \
- die "Failed to patch make.conf.example"
- else
- eerror ""
- eerror "Portage does not have an arch-specific configuration for this arch."
- eerror "Please notify the arch maintainer about this issue. Using generic."
- eerror ""
- fi
- fi
-}
-
-python_compile_all() {
- local targets=()
- use doc && targets+=( docbook )
- use epydoc && targets+=( epydoc )
-
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-}
-
-python_test() {
- esetup.py test
-}
-
-python_install() {
- # Install sbin scripts to bindir for python-exec linking
- # they will be relocated in pkg_preinst()
- distutils-r1_python_install \
- --system-prefix="${EPREFIX}/usr" \
- --bindir="$(python_get_scriptdir)" \
- --docdir="${EPREFIX}/usr/share/doc/${PF}" \
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
- --portage-bindir="${EPREFIX}/usr/lib/portage/${EPYTHON}" \
- --sbindir="$(python_get_scriptdir)" \
- --sysconfdir="${EPREFIX}/etc" \
- "${@}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- local targets=()
- use doc && targets+=(
- install_docbook
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
- use epydoc && targets+=(
- install_epydoc
- --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
- )
-
- # install docs
- if [[ ${targets[@]} ]]; then
- esetup.py "${targets[@]}"
- fi
-
- # Due to distutils/python-exec limitations
- # these must be installed to /usr/bin.
- local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
- einfo "Moving admin scripts to the correct directory"
- dodir /usr/sbin
- for target in ${sbin_relocations}; do
- einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
- done
-}
-
-pkg_preinst() {
- # comment out sanity test until it is fixed to work
- # with the new PORTAGE_PYM_PATH
- #if [[ $ROOT == / ]] ; then
- ## Run some minimal tests as a sanity check.
- #local test_runner=$(find "${ED}" -name runTests)
- #if [[ -n $test_runner && -x $test_runner ]] ; then
- #einfo "Running preinst sanity tests..."
- #"$test_runner" || die "preinst sanity tests failed"
- #fi
- #fi
-
- # elog dir must exist to avoid logrotate error for bug #415911.
- # This code runs in preinst in order to bypass the mapping of
- # portage:portage to root:root which happens after src_install.
- keepdir /var/log/portage/elog
- # This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
- fi
-}
diff --git a/sys-apps/portage/portage-2.3.68.ebuild b/sys-apps/portage/portage-3.0.1.ebuild
index 083ed2521d..cf3cc74f4b 100644
--- a/sys-apps/portage/portage-2.3.68.ebuild
+++ b/sys-apps/portage/portage-3.0.1.ebuild
@@ -1,46 +1,49 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=5
+EAPI=7
-PYTHON_COMPAT=(
- pypy3
- python3_6 python3_7
- python2_7
-)
+DISTUTILS_USE_SETUPTOOLS=no
+PYTHON_COMPAT=( pypy3 python3_{6..9} )
PYTHON_REQ_USE='bzip2(+),threads(+)'
-inherit eutils distutils-r1 multilib
+inherit distutils-r1 linux-info systemd prefix
DESCRIPTION="Portage package manager used in Gentoo Prefix"
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Portage"
+
LICENSE="GPL-2"
KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
SLOT="0"
-IUSE="build doc epydoc +ipc +native-extensions selinux xattr"
+IUSE="apidoc build doc gentoo-dev +ipc +native-extensions rsync-verify selinux xattr"
DEPEND="!build? ( $(python_gen_impl_dep 'ssl(+)') )
>=app-arch/tar-1.27
dev-lang/python-exec:2
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
- epydoc? ( >=dev-python/epydoc-2.0[$(python_gen_usedep 'python2*')] )"
+ apidoc? (
+ dev-python/sphinx
+ dev-python/sphinx-epytext
+ )"
# Require sandbox-2.2 for bug #288863.
-# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
-# quite slow, so it's not considered in the dependencies as an alternative to
-# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
-# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] (bug #425046).
# For compgen, require bash[readline] (bug #445576).
+# app-portage/gemato goes without PYTHON_USEDEP since we're calling
+# the executable.
RDEPEND="
+ app-arch/zstd
>=app-arch/tar-1.27
dev-lang/python-exec:2
!build? (
>=sys-apps/sed-4.0.5
app-shells/bash:0[readline]
>=app-admin/eselect-1.2
- $(python_gen_cond_dep 'dev-python/pyblake2[${PYTHON_USEDEP}]' \
- python{2_7,3_4,3_5} pypy)
+ rsync-verify? (
+ >=app-portage/gemato-14[${PYTHON_USEDEP}]
+ >=app-crypt/openpgp-keys-gentoo-release-20180706
+ >=app-crypt/gnupg-2.2.4-r2[ssl(-)]
+ )
)
elibc_FreeBSD? ( !prefix? ( sys-freebsd/freebsd-bin ) )
elibc_glibc? ( !prefix? ( >=sys-apps/sandbox-2.2 ) )
@@ -53,10 +56,10 @@ RDEPEND="
selinux? ( >=sys-libs/libselinux-2.0.94[python,${PYTHON_USEDEP}] )
xattr? ( kernel_linux? (
>=sys-apps/install-xattr-0.3
- $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
- python2_7 pypy)
) )
- !<app-admin/logrotate-3.8.0"
+ !<app-admin/logrotate-3.8.0
+ !<app-portage/gentoolkit-0.4.6
+ !<app-portage/repoman-2.3.10"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
@@ -65,8 +68,6 @@ PDEPEND="
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
-REQUIRED_USE="epydoc? ( $(python_gen_useflags 'python2*') )"
-
SRC_ARCHIVES="https://dev.gentoo.org/~zmedico/portage/archives https://dev.gentoo.org/~grobian/distfiles"
prefix_src_archives() {
@@ -84,15 +85,27 @@ SRC_URI="mirror://gentoo/prefix-${PN}-${TARBALL_PV}.tar.bz2
S="${WORKDIR}"/prefix-${PN}-${TARBALL_PV}
-pkg_setup() {
- use epydoc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
+pkg_pretend() {
+ local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"
+
+ check_extra_config
}
python_prepare_all() {
distutils-r1_python_prepare_all
- epatch "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
- epatch "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
+ eapply "${FILESDIR}"/${PN}-2.3.62-prefix-stack.patch # 658572
+ eapply "${FILESDIR}"/${PN}-2.3.45-ebuildshell.patch # 155161
+ if use gentoo-dev; then
+ einfo "Disabling --dynamic-deps by default for gentoo-dev..."
+ sed -e 's:\("--dynamic-deps", \)\("y"\):\1"n":' \
+ -i lib/_emerge/create_depgraph_params.py || \
+ die "failed to patch create_depgraph_params.py"
+
+ einfo "Enabling additional FEATURES for gentoo-dev..."
+ echo 'FEATURES="${FEATURES} strict-keepdir"' \
+ >> cnf/make.globals || die
+ fi
if use native-extensions; then
printf "[build_ext]\nportage-ext-modules=true\n" >> \
@@ -112,6 +125,12 @@ python_prepare_all() {
|| die "failed to append to make.globals"
fi
+ if use build || ! use rsync-verify; then
+ sed -e '/^sync-rsync-verify-metamanifest/s|yes|no|' \
+ -e '/^sync-webrsync-verify-signature/s|yes|no|' \
+ -i cnf/repos.conf || die "sed failed"
+ fi
+
if [[ -n ${EPREFIX} ]] ; then
# PREFIX LOCAL: only hack const_autotool
local extrapath="/usr/sbin:/usr/bin:/sbin:/bin"
@@ -157,7 +176,7 @@ python_prepare_all() {
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
- done < <(find . -type f -print0)
+ done < <(find . -type f ! -name etc-update -print0)
einfo "Setting gentoo_prefix as reponame for emerge-webrsync"
sed -i -e 's/repo_name=gentoo/repo_name=gentoo_prefix/' \
@@ -187,7 +206,7 @@ python_prepare_all() {
python_compile_all() {
local targets=()
use doc && targets+=( docbook )
- use epydoc && targets+=( epydoc )
+ use apidoc && targets+=( apidoc )
if [[ ${targets[@]} ]]; then
esetup.py "${targets[@]}"
@@ -220,8 +239,8 @@ python_install_all() {
install_docbook
--htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
)
- use epydoc && targets+=(
- install_epydoc
+ use apidoc && targets+=(
+ install_apidoc
--htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
)
@@ -230,6 +249,8 @@ python_install_all() {
esetup.py "${targets[@]}"
fi
+ systemd_dotmpfilesd "${FILESDIR}"/portage-ccache.conf
+
# Due to distutils/python-exec limitations
# these must be installed to /usr/bin.
local sbin_relocations='archive-conf dispatch-conf emaint env-update etc-update fixpackages regenworld'
@@ -237,28 +258,42 @@ python_install_all() {
dodir /usr/sbin
for target in ${sbin_relocations}; do
einfo "Moving /usr/bin/${target} to /usr/sbin/${target}"
- mv "${ED}usr/bin/${target}" "${ED}usr/sbin/${target}" || die "sbin scripts move failed!"
+ mv "${ED}/usr/bin/${target}" "${ED}/usr/sbin/${target}" || die "sbin scripts move failed!"
done
}
pkg_preinst() {
- # comment out sanity test until it is fixed to work
- # with the new PORTAGE_PYM_PATH
- #if [[ $ROOT == / ]] ; then
- ## Run some minimal tests as a sanity check.
- #local test_runner=$(find "${ED}" -name runTests)
- #if [[ -n $test_runner && -x $test_runner ]] ; then
- #einfo "Running preinst sanity tests..."
- #"$test_runner" || die "preinst sanity tests failed"
- #fi
- #fi
+ python_setup
+ local sitedir=$(python_get_sitedir)
+ [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such directory"
+ env -u DISTDIR \
+ -u PORTAGE_OVERRIDE_EPREFIX \
+ -u PORTAGE_REPOSITORIES \
+ -u PORTDIR \
+ -u PORTDIR_OVERLAY \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.default_locations || die
+
+ env -u BINPKG_COMPRESS \
+ PYTHONPATH="${D}${sitedir}${PYTHONPATH:+:${PYTHONPATH}}" \
+ "${PYTHON}" -m portage._compat_upgrade.binpkg_compression || die
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
- if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
- chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
+ if chown ${PORTAGE_USER}:${PORTAGE_GROUP} "${ED}"/var/log/portage{,/elog} 2>/dev/null ; then
+ chmod g+s,ug+rwx "${ED}"/var/log/portage{,/elog}
+ fi
+
+ if has_version "<${CATEGORY}/${PN}-2.3.77"; then
+ elog "The emerge --autounmask option is now disabled by default, except for"
+ elog "portions of behavior which are controlled by the --autounmask-use and"
+ elog "--autounmask-license options. For backward compatibility, previous"
+ elog "behavior of --autounmask=y and --autounmask=n is entirely preserved."
+ elog "Users can get the old behavior simply by adding --autounmask to the"
+ elog "make.conf EMERGE_DEFAULT_OPTS variable. For the rationale for this"
+ elog "change, see https://bugs.gentoo.org/658648."
fi
}