[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-10-26 Thread Ulrich Müller
commit: 6903a68f1e0d57d866b46fe0ed3ccaf8c487c119
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu Oct 26 16:03:16 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Thu Oct 26 16:44:22 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6903a68f

prep*: Symlink banned helpers to prepall

Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/prepall  | 2 +-
 bin/ebuild-helpers/prepalldocs  | 9 +
 bin/ebuild-helpers/prepallinfo  | 9 +
 bin/ebuild-helpers/prepallman   | 9 +
 bin/ebuild-helpers/prepallstrip | 9 +
 bin/ebuild-helpers/prepinfo | 9 +
 bin/ebuild-helpers/prepman  | 9 +
 bin/ebuild-helpers/prepstrip| 9 +
 8 files changed, 8 insertions(+), 57 deletions(-)

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 6af94db030..80fcecba60 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
deleted file mode 100755
index 6af94db030..00
--- a/bin/ebuild-helpers/prepalldocs
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
new file mode 12
index 00..87292339f4
--- /dev/null
+++ b/bin/ebuild-helpers/prepalldocs
@@ -0,0 +1 @@
+prepall
\ No newline at end of file

diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
deleted file mode 100755
index 6af94db030..00
--- a/bin/ebuild-helpers/prepallinfo
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
new file mode 12
index 00..87292339f4
--- /dev/null
+++ b/bin/ebuild-helpers/prepallinfo
@@ -0,0 +1 @@
+prepall
\ No newline at end of file

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
deleted file mode 100755
index 6af94db030..00
--- a/bin/ebuild-helpers/prepallman
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
new file mode 12
index 00..87292339f4
--- /dev/null
+++ b/bin/ebuild-helpers/prepallman
@@ -0,0 +1 @@
+prepall
\ No newline at end of file

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
deleted file mode 100755
index 80fcecba60..00
--- a/bin/ebuild-helpers/prepallstrip
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
new file mode 12
index 00..87292339f4
--- /dev/null
+++ b/bin/ebuild-helpers/prepallstrip
@@ -0,0 +1 @@
+prepall
\ No newline at end of file

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
deleted file mode 100755
index 80fcecba60..00
--- a/bin/ebuild-helpers/prepinfo
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
new file mode 12
index 00..87292339f4
--- /dev/null
+++ b/bin/ebuild-helpers/prepinfo
@@ -0,0 +1 @@
+prepall
\ No newline at end of file

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
deleted file mode 100755
index 80fcecba60..00
--- a/bin/ebuild-helpers/prepman
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die 

[gentoo-commits] proj/portage:master commit in: /, bin/ebuild-helpers/, bin/

2023-10-26 Thread Mike Gilbert
commit: 27952b1d753ef4ea9bbd2307f8a9a315ad94557d
Author: Mike Gilbert  gentoo  org>
AuthorDate: Thu Oct 26 14:42:00 2023 +
Commit: Mike Gilbert  gentoo  org>
CommitDate: Thu Oct 26 15:45:14 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=27952b1d

Convert portageq helper to a function

This keeps it out of PATH in ebuilds to avoid breaking external
utilities that call portageq.

Bug: https://bugs.gentoo.org/906129
Bug: https://bugs.gentoo.org/916287
Bug: https://bugs.gentoo.org/916296
Signed-off-by: Mike Gilbert  gentoo.org>

 NEWS| 4 +++-
 bin/ebuild-helpers/portageq | 8 
 bin/phase-helpers.sh| 4 
 bin/portageq-wrapper| 1 -
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index 06cd7695a6..fe171d1e27 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,9 @@ Release notes take the form of the following optional 
categories:
 portage-3.0.55 (UNRELEASED)
 --
 
-TODO
+Bug fixes:
+* Convert portageq helper to a function to avoid breaking external callers
+  (bug ##916287, bug #916296).
 
 portage-3.0.54 (2023-10-25)
 --

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
deleted file mode 100755
index bd9d6b0442..00
--- a/bin/ebuild-helpers/portageq
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 3f12b37077..6c2ecf0bc2 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1006,6 +1006,10 @@ best_version() {
___best_version_and_has_version_common "$@"
 }
 
+portageq() {
+die "portageq is not allowed in ebuild scope"
+}
+
 if ___eapi_has_get_libdir; then
get_libdir() {
local libdir_var="LIBDIR_${ABI}"

diff --git a/bin/portageq-wrapper b/bin/portageq-wrapper
index afa2defe1b..047d1d826c 100755
--- a/bin/portageq-wrapper
+++ b/bin/portageq-wrapper
@@ -9,7 +9,6 @@ IFS=":"
 set -f # in case ${PATH} contains any shell glob characters
 
 for path in "${PORTAGE_BIN_PATH}" ${PATH}; do
-   [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
[[ -x ${path}/portageq ]] || continue
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}/portageq" 
"$@"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-10-21 Thread Ulrich Müller
commit: f6e0fae115190d28957f8a7653a4118c4d3aed31
Author: Ulrich Müller  gentoo  org>
AuthorDate: Fri May 12 17:28:49 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sat Oct 21 08:01:24 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f6e0fae1

prepman: Ban in ebuild scope

Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/prepman | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 0c0a7e8122..80fcecba60 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -2,11 +2,7 @@
 # Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Note: this really does nothing these days. It's going to be banned
-# when the last consumers are gone.
-
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-exit 0
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2023-10-21 Thread Ulrich Müller
commit: dafad634cc4d46b6d7b45ec1535044f281916ef4
Author: Ulrich Müller  gentoo  org>
AuthorDate: Fri May 12 17:33:47 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sat Oct 21 08:01:25 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dafad634

prep{,all}strip: Ban in ebuild scope

Closes: https://bugs.gentoo.org/906156
Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/prepallstrip | 13 ++---
 bin/ebuild-helpers/prepstrip|  9 ++---
 bin/estrip  |  4 +---
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index f22483a531..80fcecba60 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -4,14 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ___eapi_has_dostrip; then
-   die "${0##*/}: ${0##*/} has been banned for EAPI '${EAPI}'; use 
'dostrip' instead"
-fi
-
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-if ! ___eapi_has_prefix_variables; then
-   ED=${D}
-fi
-
-exec prepstrip "${ED}"
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 0da4c65166..80fcecba60 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -4,10 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ___eapi_has_dostrip; then
-   die "${0##*/}: ${0##*/} has been banned for EAPI '${EAPI}'; use 
'dostrip' instead"
-fi
-
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-__PORTAGE_HELPER=prepstrip exec "${PORTAGE_BIN_PATH}"/estrip "${@}"
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/estrip b/bin/estrip
index 8a2f5adc1f..3ac6a16927 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -30,9 +30,8 @@ if ${PORTAGE_RESTRICT_strip} || ${FEATURES_nostrip} ; then
${FEATURES_installsources} || exit 0
 fi
 
-[[ ${__PORTAGE_HELPER} == prepstrip ]] && prepstrip=true || prepstrip=false
+prepstrip=false
 
-if ! ${prepstrip}; then
 while [[ $# -gt 0 ]] ; do
case $1 in
--ignore)
@@ -130,7 +129,6 @@ while [[ $# -gt 0 ]] ; do
shift
 done
 set -- "${ED}"
-fi
 
 PRESERVE_XATTR=false
 if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-10-21 Thread Ulrich Müller
commit: 76a7c3c61f6e3779452b6b3675c32bda02c8c88c
Author: Ulrich Müller  gentoo  org>
AuthorDate: Fri May 12 17:34:59 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sat Oct 21 08:01:25 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=76a7c3c6

portageq: Ban in ebuild scope

Closes: https://bugs.gentoo.org/906129
Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/portageq | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index e3926e11af..bd9d6b0442 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -4,5 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-exec "${PORTAGE_BIN_PATH}"/portageq-wrapper "$@"
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-06-07 Thread Ulrich Müller
commit: 5461ae06e8cdfe7a6b275713ed5226258b528af1
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Jun  7 08:44:38 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Jun  7 08:56:55 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5461ae06

dosym: Fix another corner case of strange input

echo doesn't work as expected when the first argument is "-e".
Thanks to tirnanog in #gentoo-portage for pointing this out.

Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/dosym | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index c87cf42b2..89ee66a96 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -33,7 +33,7 @@ if [[ ${option_r} ]]; then
dosym_canonicalize() {
local path slash i prev out IFS=/
 
-   read -r -d '' -a path < <(echo -n "${1}")
+   read -r -d '' -a path < <(printf '%s\0' "${1}")
[[ ${1} == /* ]] && slash=/
 
while true; do
@@ -58,7 +58,7 @@ if [[ ${option_r} ]]; then
done
 
out="${slash}${path[*]}"
-   echo "${out:-.}"
+   printf "%s\n" "${out:-.}"
}
 
# Expansion makes sense only for an absolute target path



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-06-07 Thread Ulrich Müller
commit: 5fc12989359ff6698ede5dc67e69ccf740aa4f4c
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Jun  7 07:06:10 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Jun  7 07:06:10 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5fc12989

dosym: Don't add a spurious newline to the path

Bash's <<< operator will append a newline to the string, therefore use
echo -n instead.

Fixes: 65bb6ae01f359d82be453bf01a9e8f49171d8436
Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/dosym | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 9ed27b8ce..c87cf42b2 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -33,7 +33,7 @@ if [[ ${option_r} ]]; then
dosym_canonicalize() {
local path slash i prev out IFS=/
 
-   read -r -d '' -a path <<< "${1}"
+   read -r -d '' -a path < <(echo -n "${1}")
[[ ${1} == /* ]] && slash=/
 
while true; do



[gentoo-commits] proj/portage:master commit in: /, bin/ebuild-helpers/

2023-06-06 Thread Ulrich Müller
commit: 65bb6ae01f359d82be453bf01a9e8f49171d8436
Author: Ulrich Müller  gentoo  org>
AuthorDate: Tue Jun  6 04:05:11 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Tue Jun  6 15:50:32 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=65bb6ae0

dosym: Prevent globbing of argument in dosym_canonicalize

Signed-off-by: Ulrich Müller  gentoo.org>

 NEWS | 4 
 bin/ebuild-helpers/dosym | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 8727e5623..09dd0675d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Bug fixes:
+* dosym: Prevent globbing of argument in dosym_canonicalize().
+
 portage-3.0.48.1 (2023-06-06)
 
 
@@ -6,6 +9,7 @@ Bug fixes:
 
 portage-3.0.48 (2023-06-01)
 --
+
 Breaking changes:
 * Output deprecation warnings for portageq, prepstrip and prepallstrip
   when they are called from an ebuild (bug #906129, bug #906156).

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index e41558a15..9ed27b8ce 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -33,7 +33,7 @@ if [[ ${option_r} ]]; then
dosym_canonicalize() {
local path slash i prev out IFS=/
 
-   path=( ${1} )
+   read -r -d '' -a path <<< "${1}"
[[ ${1} == /* ]] && slash=/
 
while true; do
@@ -41,7 +41,7 @@ if [[ ${option_r} ]]; then
# or as a special case, "/.." at the beginning of the 
path.
# Also drop empty and "." path components as we go 
along.
prev=
-   for i in ${!path[@]}; do
+   for i in "${!path[@]}"; do
if [[ -z ${path[i]} || ${path[i]} == . ]]; then
unset "path[i]"
elif [[ ${path[i]} != .. ]]; then



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, /, bin/

2023-05-13 Thread Ulrich Müller
commit: 4bc369c549c34a757c799e3f6df1214cd1da12ef
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sat May 13 10:35:50 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sat May 13 20:13:25 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4bc369c5

portageq-wrapper: New wrapper script

Move the internal portageq wrapper script out of the ebuild-helpers
directory. Call the new script from best_version and has_version in
the case when IPC is disabled.

The goal is to ban portageq from the ebuild environment after some
transition time.

Bug: https://bugs.gentoo.org/906129
Fixes: ab538e7750fb85d57a3eb9d9b440848c1f2c074a
Signed-off-by: Ulrich Müller  gentoo.org>

 NEWS  |  4 
 bin/ebuild-helpers/portageq   | 24 +--
 bin/phase-helpers.sh  |  2 +-
 bin/{ebuild-helpers/portageq => portageq-wrapper} | 19 --
 4 files changed, 10 insertions(+), 39 deletions(-)

diff --git a/NEWS b/NEWS
index 6d039c84f..e282d3f3c 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ Breaking changes:
 * Output deprecation warnings for portageq, prepstrip and prepallstrip
   when they are called from an ebuild (bug #906129, bug #906156).
 
+Cleanups:
+* Move the internal portageq wrapper script out of the ebuild-helpers
+  directory.
+
 portage-3.0.48 (UNRELEASED)
 --
 Bug fixes:

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index 0df0cd273..e3926e11a 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -2,29 +2,7 @@
 # Copyright 2009-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-scriptpath=${BASH_SOURCE[0]}
-scriptname=${scriptpath##*/}
-
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
 eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
-# Use safe cwd, avoiding unsafe import for bug #469338.
-cd "${PORTAGE_PYM_PATH}" || exit 1
-
-IFS=':'
-set -f # in case ${PATH} contains any shell glob characters
-
-for path in ${PATH}; do
-   [[ -x ${path}/${scriptname} ]] || continue
-   [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
-   [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
-
-   PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-   exec "${PORTAGE_PYTHON:-/usr/bin/python}" \
-   "${path}/${scriptname}" "$@"
-done
-
-unset IFS
-echo "${scriptname}: command not found" 1>&2
-exit 127
+exec "${PORTAGE_BIN_PATH}"/portageq-wrapper "$@"

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index af96b73e4..f1b762b0a 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -963,7 +963,7 @@ ___best_version_and_has_version_common() {
if [[ -n ${PORTAGE_IPC_DAEMON} ]] ; then
cmd+=("${PORTAGE_BIN_PATH}"/ebuild-ipc "${FUNCNAME[1]}" 
"${root}" "${atom}")
else
-   cmd+=("${PORTAGE_BIN_PATH}"/ebuild-helpers/portageq 
"${FUNCNAME[1]}" "${root}" "${atom}")
+   cmd+=("${PORTAGE_BIN_PATH}"/portageq-wrapper "${FUNCNAME[1]}" 
"${root}" "${atom}")
fi
 
"${cmd[@]}"

diff --git a/bin/ebuild-helpers/portageq b/bin/portageq-wrapper
similarity index 50%
copy from bin/ebuild-helpers/portageq
copy to bin/portageq-wrapper
index 0df0cd273..2ca4052c4 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/portageq-wrapper
@@ -2,29 +2,18 @@
 # Copyright 2009-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-scriptpath=${BASH_SOURCE[0]}
-scriptname=${scriptpath##*/}
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
-
 # Use safe cwd, avoiding unsafe import for bug #469338.
 cd "${PORTAGE_PYM_PATH}" || exit 1
 
-IFS=':'
+IFS=":"
 set -f # in case ${PATH} contains any shell glob characters
 
 for path in ${PATH}; do
-   [[ -x ${path}/${scriptname} ]] || continue
[[ ${path} == */portage/*/ebuild-helpers* ]] && continue
-   [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
-
+   [[ -x ${path}/portageq ]] || continue
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-   exec "${PORTAGE_PYTHON:-/usr/bin/python}" \
-   "${path}/${scriptname}" "$@"
+   exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}/portageq" 
"$@"
 done
 
-unset IFS
-echo "${scriptname}: command not found" 1>&2
+echo "portageq: command not found" >&2
 exit 127



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-05-11 Thread Sam James
commit: 63d6f2e8985de480c21a5c2f09bba1547c7de6b8
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu May 11 17:30:27 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Thu May 11 20:15:47 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=63d6f2e8

prep{,all}strip: Deprecate in all EAPIs

Calling these commands from ebuilds was never allowed.
Last usage was removed from Gentoo repository on 2019-04-14.

Bug: https://bugs.gentoo.org/906156
Signed-off-by: Ulrich Müller  gentoo.org>
Signed-off-by: Sam James  gentoo.org>

 bin/ebuild-helpers/prepallstrip | 4 +++-
 bin/ebuild-helpers/prepstrip| 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index 2f9c0f70e..f22483a53 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -8,6 +8,8 @@ if ___eapi_has_dostrip; then
die "${0##*/}: ${0##*/} has been banned for EAPI '${EAPI}'; use 
'dostrip' instead"
 fi
 
+eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
+
 if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 789296050..0da4c6516 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -8,4 +8,6 @@ if ___eapi_has_dostrip; then
die "${0##*/}: ${0##*/} has been banned for EAPI '${EAPI}'; use 
'dostrip' instead"
 fi
 
+eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
+
 __PORTAGE_HELPER=prepstrip exec "${PORTAGE_BIN_PATH}"/estrip "${@}"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-05-11 Thread Sam James
commit: ab538e7750fb85d57a3eb9d9b440848c1f2c074a
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu May 11 17:27:51 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Thu May 11 20:15:46 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ab538e77

ebuild-helpers/portageq: Deprecate

Calling portageq from ebuilds was never allowed.
Last usage was removed from Gentoo repository on 2019-03-14.

Bug: https://bugs.gentoo.org/906129
Signed-off-by: Ulrich Müller  gentoo.org>
Signed-off-by: Sam James  gentoo.org>

 bin/ebuild-helpers/portageq | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index 7d14f54c2..0df0cd273 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -1,10 +1,14 @@
 #!/usr/bin/env bash
-# Copyright 2009-2015 Gentoo Foundation
+# Copyright 2009-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 scriptpath=${BASH_SOURCE[0]}
 scriptname=${scriptpath##*/}
 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
+eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
+
 # Use safe cwd, avoiding unsafe import for bug #469338.
 cd "${PORTAGE_PYM_PATH}" || exit 1
 



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, lib/portage/tests/bin/, bin/

2023-05-09 Thread Sam James
commit: e5fd7ef3aca87539acc278f2b724e7e47fc4ce41
Author: Arfrever Frehtes Taifersar Arahesis  Apache  Org>
AuthorDate: Sun Apr 30 00:00:00 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed May 10 01:03:08 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=e5fd7ef3

Delete remnants of CONF_LIBDIR

Support for CONF_LIBDIR was initially added on 2004-08-16 in:
https://gitweb.gentoo.org/archive/proj/portage-cvs.git/commit/?id=ecc2faaa00b1e6250129267ba873bedd2121eac5

Support for LIBDIR_${ABI} was initially added on 2005-02-26 in:
https://gitweb.gentoo.org/archive/proj/portage-cvs.git/commit/?id=64779fdecc8e4ec7d2cb9a6fa70066694f78231d

Since then, CONF_LIBDIR was not used if ABI and LIBDIR_${ABI} were set.

CONF_LIBDIR was set only in 2004.3 profiles:
https://gitweb.gentoo.org/archive/repo/gentoo-2.git/commit/?id=1482b856ad2a301c8eb2245a7c7265350af2691d

LIBDIR_${ABI} was set in profiles starting with 2005.0 profiles:
https://gitweb.gentoo.org/archive/repo/gentoo-2.git/commit/?id=054e484d8717a18622615e019e7cd62495365192
https://gitweb.gentoo.org/archive/repo/gentoo-2.git/commit/?id=a1f9392206c050c2b952c3e1281b731f1c969bc9

Bug: https://bugs.gentoo.org/75420
Bug: https://bugs.gentoo.org/267159
Signed-off-by: Arfrever Frehtes Taifersar Arahesis  Apache.Org>
Closes: https://github.com/gentoo/portage/pull/1032
Signed-off-by: Sam James  gentoo.org>

 bin/ebuild-helpers/dolib  | 12 +---
 bin/phase-helpers.sh  | 25 -
 lib/portage/tests/bin/test_filter_bash_env.py | 22 +-
 3 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index 44e16f503..d6d21314b 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -22,15 +22,13 @@ else
 fi
 
 # Setup ABI cruft
-LIBDIR_VAR="LIBDIR_${ABI}"
-if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
-   CONF_LIBDIR=${!LIBDIR_VAR}
+libdir="lib"
+libdir_var="LIBDIR_${ABI}"
+if [[ -n ${ABI} && -n ${!libdir_var} ]] ; then
+   libdir=${!libdir_var}
 fi
-unset LIBDIR_VAR
 
-# We need this to default to lib so that things dont break
-CONF_LIBDIR=${CONF_LIBDIR:-lib}
-libdir="${ED%/}/${__E_DESTTREE#/}/${CONF_LIBDIR}"
+libdir="${ED%/}/${__E_DESTTREE#/}/${libdir}"
 
 if [[ $# -lt 1 ]] ; then
__helpers_die "${0##*/}: at least one argument needed"

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 59f1bd26b..e3fca6757 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -681,13 +681,13 @@ econf() {
fi
 
# If the profile defines a location to install libs to aside 
from default, pass it on.
-   # If the ebuild passes in --libdir, they're responsible for the 
conf_libdir fun.
-   local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}"
-   if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
-   CONF_LIBDIR=${!LIBDIR_VAR}
+   # If the ebuild passes in --libdir, they're responsible for the 
libdir fun.
+   local libdir libdir_var="LIBDIR_${ABI}"
+   if [[ -n ${ABI} && -n ${!libdir_var} ]] ; then
+   libdir=${!libdir_var}
fi
 
-   if [[ -n ${CONF_LIBDIR} ]] && ! __hasgq --libdir=\* "$@" ; then
+   if [[ -n ${libdir} ]] && ! __hasgq --libdir=\* "$@" ; then
export CONF_PREFIX=$(__hasg --exec-prefix=\* "$@")
[[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(__hasg 
--prefix=\* "$@")
 
@@ -695,10 +695,10 @@ econf() {
CONF_PREFIX=${CONF_PREFIX#*=}
 
[[ ${CONF_PREFIX} != /* ]] && 
CONF_PREFIX="/${CONF_PREFIX}"
-   [[ ${CONF_LIBDIR} != /* ]] && 
CONF_LIBDIR="/${CONF_LIBDIR}"
+   [[ ${libdir} != /* ]] && libdir="/${libdir}"
 
conf_args+=(
-   --libdir="$(__strip_duplicate_slashes 
"${CONF_PREFIX}${CONF_LIBDIR}")"
+   --libdir="$(__strip_duplicate_slashes 
"${CONF_PREFIX}${libdir}")"
)
fi
 
@@ -751,14 +751,13 @@ einstall() {
local ED=${D}
fi
 
-   LIBDIR_VAR="LIBDIR_${ABI}"
-   if [[ -n "${ABI}" && -n "${!LIBDIR_VAR}" ]]; then
-   CONF_LIBDIR="${!LIBDIR_VAR}"
+   local libdir libdir_var="LIBDIR_${ABI}"
+   if [[ -n "${ABI}" && -n "${!libdir_var}" ]]; then
+   libdir="${!libdir_var}"
fi
-   unset LIBDIR_VAR
 
-   if [[ -n "${CONF_LIBDIR}" && "${CONF_PREFIX:+set}" = set ]]; then
-   EI_DESTLIBDIR="${D%/}/${CONF_PREFIX}/${CONF_LIBDIR}"
+   if [[ -n "${libdir}" && "${CONF_PREFIX:+set}" = set ]]; then
+   EI_DESTLIBDIR="${D%/}/${CONF_PREFIX}/${libdir}"
EI_DESTLIBDIR="$(__strip_duplicate_slashes "${EI_DESTLIBDIR}")"

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-04-30 Thread Ulrich Müller
commit: f979b313a858358d77b2c67eb1036cb9b7b9a571
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sun Apr 30 07:31:38 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sun Apr 30 18:13:10 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f979b313

fowners, fperms: Restore QA warning

Suggested-by: Michał Górny  gentoo.org>
Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/fowners | 6 ++
 bin/ebuild-helpers/fperms  | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index a6409e40d..fa4e3c0d7 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -19,6 +19,12 @@ for arg; do
args+=( "${arg}" )
else
args+=( "${ED%/}/${arg#/}" )
+   # remove the QA warning after 2024-12-31
+   if [[ ${arg:0:1} != / ]]; then
+   eqawarn "${0##*/}: Path '${arg}' does not start with 
'/'."
+   eqawarn "This is unsupported. Add a slash for a path in 
\${ED},"
+   eqawarn "or use 'chown' for a path relative to the 
working dir."
+   fi
fi
 done
 

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index 989075eb7..d52f5a767 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -20,6 +20,12 @@ for arg; do
args+=( "${arg}" )
else
args+=( "${ED%/}/${arg#/}" )
+   # remove the QA warning after 2024-12-31
+   if [[ ${arg:0:1} != / ]]; then
+   eqawarn "${0##*/}: Path '${arg}' does not start with 
'/'."
+   eqawarn "This is unsupported. Add a slash for a path in 
\${ED},"
+   eqawarn "or use 'chmod' for a path relative to the 
working dir."
+   fi
fi
 done
 



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-04-30 Thread Ulrich Müller
commit: 412a0443b3d0520ef66cd9c217d166dde7d0d55f
Author: Ulrich Müller  gentoo  org>
AuthorDate: Fri Apr 28 11:32:32 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sun Apr 30 07:54:34 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=412a0443

fowners: Drop unused EPREFIX variable

Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/fowners | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index ca847cd26..a6409e40d 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
 if ! ___eapi_has_prefix_variables; then
-   EPREFIX= ED=${D}
+   ED=${D}
 fi
 
 args=()



[gentoo-commits] proj/portage:master commit in: /, bin/ebuild-helpers/

2023-04-30 Thread Ulrich Müller
commit: 6fc4a7d45798f5ef6605419c684e0ddaa2e812ef
Author: Ulrich Müller  gentoo  org>
AuthorDate: Fri Apr 28 09:20:02 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Sun Apr 30 07:54:34 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6fc4a7d4

fowners, fperms: Fix handling of relative pathnames

PMS section 12.3.9 specifies that fowners and fperms "[take] paths
relative to the image directory."

Currently, these helpers interpret any pathnames not beginning with a
slash as relative to the current working directory (after printing a
QA warning). This contradicts the spec.

It is also inconsistent with other helpers like insinto or dostrip,
which expand their pathnames relative to ${ED}.

Bug: https://bugs.gentoo.org/905223
Closes: https://github.com/gentoo/portage/pull/1027
Signed-off-by: Ulrich Müller  gentoo.org>

 NEWS   |  3 +++
 bin/ebuild-helpers/fowners | 26 ++
 bin/ebuild-helpers/fperms  | 25 ++---
 3 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/NEWS b/NEWS
index 77eaa9d7a..6c06d4e42 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Bug fixes:
+* fowners, fperms: Fix handling of relative pathnames (bug #905223).
+
 portage-3.0.47 (2023-04-30)
 ---
 

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index d245062e7..ca847cd26 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -8,27 +8,21 @@ if ! ___eapi_has_prefix_variables; then
EPREFIX= ED=${D}
 fi
 
+args=()
 got_owner=
 for arg; do
-   [[ ${arg} == -* ]] && continue
-
-   if [[ ! ${got_owner} ]]; then
+   if [[ ${arg} == -* ]]; then
+   args+=( "${arg}" )
+   elif [[ ! ${got_owner} ]]; then
+   # the first non-option is the owner and must not be prefixed
got_owner=1
-   continue
-   fi
-
-   if [[ ${arg} != /* ]]; then
-   eqawarn "Relative path passed to '${0##*/}': ${arg}"
-   eqawarn "This is unsupported. Please use 'chown' when you need 
to work on files"
-   eqawarn "outside the installation image (\${ED})."
+   args+=( "${arg}" )
+   else
+   args+=( "${ED%/}/${arg#/}" )
fi
 done
 
-
-# we can't prefix all arguments because
-# chown takes random options
-slash="/"
-chown "${@/#${slash}/${ED%/}${slash}}"
+chown "${args[@]}"
 ret=$?
 
 [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index 9e5da5d16..989075eb7 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -8,27 +8,22 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
+args=()
 got_mode=
 for arg; do
# - can either be an option or a mode string
-   [[ ${arg} == -* && ${arg} != -[ugorwxXst] ]] && continue
-
-   if [[ ! ${got_mode} ]]; then
+   if [[ ${arg} == -* && ${arg} != -[ugorwxXst] ]]; then
+   args+=( "${arg}" )
+   elif [[ ! ${got_mode} ]]; then
+   # the first non-option is the mode and must not be prefixed
got_mode=1
-   continue
-   fi
-
-   if [[ ${arg} != /* ]]; then
-   eqawarn "Relative path passed to '${0##*/}': ${arg}"
-   eqawarn "This is unsupported. Please use 'chmod' when you need 
to work on files"
-   eqawarn "outside the installation image (\${ED})."
+   args+=( "${arg}" )
+   else
+   args+=( "${ED%/}/${arg#/}" )
fi
 done
 
-# we can't prefix all arguments because
-# chmod takes random options
-slash="/"
-chmod "${@/#${slash}/${ED%/}${slash}}"
+chmod "${args[@]}"
 ret=$?
 [[ ${ret} -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit ${ret}



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/, /

2023-04-28 Thread Ulrich Müller
commit: 0fa8c7471e3e14a28c11ad4831fd2026e26b3c0b
Author: Ulrich Müller  gentoo  org>
AuthorDate: Thu Apr 27 17:26:27 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Thu Apr 27 18:33:32 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0fa8c747

bin: Rename all _E_*DESTTREE_ variables to __E_*DESTTREE

The __* namespace is reserved for package manager use.

Signed-off-by: Ulrich Müller  gentoo.org>

 NEWS|  3 +++
 bin/dohtml.py   |  4 ++--
 bin/ebuild-helpers/dobin| 10 +-
 bin/ebuild-helpers/doconfd  |  6 +++---
 bin/ebuild-helpers/dodoc|  4 ++--
 bin/ebuild-helpers/doenvd   |  6 +++---
 bin/ebuild-helpers/doexe|  8 
 bin/ebuild-helpers/doheader |  6 +++---
 bin/ebuild-helpers/doinitd  |  4 ++--
 bin/ebuild-helpers/doins| 16 
 bin/ebuild-helpers/dolib|  6 +++---
 bin/ebuild-helpers/domo | 12 ++--
 bin/ebuild-helpers/dosbin   | 10 +-
 bin/phase-functions.sh  | 10 +-
 bin/phase-helpers.sh| 44 ++--
 bin/save-ebuild-env.sh  |  2 +-
 16 files changed, 77 insertions(+), 74 deletions(-)

diff --git a/NEWS b/NEWS
index 50d96402c..7239cc285 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ Bug fixes:
   all options starting with "--with-", "--disable-" or "--enable-", in order
   to pass them to configure. This follows a change in PMS (bug #815169).
 
+* All _E_*DESTTREE_ variables to renamed to __E_*DESTTREE, in order to move
+  them to the __* namespace which is reserved for the package manager.
+
 portage-3.0.46 (2023-04-07)
 ---
 

diff --git a/bin/dohtml.py b/bin/dohtml.py
index 9a8cd4c00..853027300 100755
--- a/bin/dohtml.py
+++ b/bin/dohtml.py
@@ -152,8 +152,8 @@ class OptionsClass:
 self.ED = os.environ.get("ED", "")
 if self.ED:
 self.ED = normalize_path(self.ED)
-if "_E_DOCDESTTREE_" in os.environ:
-self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
+if "__E_DOCDESTTREE" in os.environ:
+self.DOCDESTTREE = os.environ["__E_DOCDESTTREE"]
 if self.DOCDESTTREE:
 self.DOCDESTTREE = normalize_path(self.DOCDESTTREE)
 

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index 14faab9bf..123a3177a 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -18,18 +18,18 @@ if ! ___eapi_has_DESTTREE_INSDESTTREE; then
die "${0##*/}: \${DESTTREE} has been banned for EAPI '${EAPI}'; 
use 'into' instead"
 else
# backwards compatibility
-   _E_DESTTREE_=${DESTTREE}
+   __E_DESTTREE=${DESTTREE}
 fi
 
-if [[ ! -d ${ED%/}/${_E_DESTTREE_#/}/bin ]] ; then
-   install -d "${ED%/}/${_E_DESTTREE_#/}/bin" || { __helpers_die 
"${0##*/}: failed to install ${ED%/}/${_E_DESTTREE_#/}/bin"; exit 2; }
+if [[ ! -d ${ED%/}/${__E_DESTTREE#/}/bin ]] ; then
+   install -d "${ED%/}/${__E_DESTTREE#/}/bin" || { __helpers_die 
"${0##*/}: failed to install ${ED%/}/${__E_DESTTREE#/}/bin"; exit 2; }
 fi
 
 ret=0
 
 for x in "$@" ; do
if [[ -e ${x} ]] ; then
-   install -m0755 -o ${PORTAGE_INST_UID:-0} -g 
${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${_E_DESTTREE_#/}/bin"
+   install -m0755 -o ${PORTAGE_INST_UID:-0} -g 
${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${__E_DESTTREE#/}/bin"
else
echo "!!! ${0##*/}: ${x} does not exist" 1>&2
false

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 761fd7309..9fbbc7d5a 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -9,9 +9,9 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-export _E_INSDESTTREE_='/etc/conf.d/'
+export __E_INSDESTTREE='/etc/conf.d/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
-   export INSDESTTREE=${_E_INSDESTTREE_}
+   export INSDESTTREE=${__E_INSDESTTREE}
 fi
 
 if ! ___eapi_doconfd_respects_insopts; then

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 28e58ae0c..240777aac 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -17,7 +17,7 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-04-06 Thread Ulrich Müller
commit: 5e58a0d413d4154262f966759d05fe952075c965
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Apr  5 16:36:49 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Apr  5 16:36:49 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=5e58a0d4

prepinfo: Deprecate

According to PMS, calling prepinfo from ebuilds was never allowed.
Last usage in Gentoo repository has been removed on 2018-11-22.

Bug: https://bugs.gentoo.org/899898
Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/prepinfo | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index 14fa38226..af5ae9f08 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -1,9 +1,11 @@
 #!/usr/bin/env bash
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
+
 if ! ___eapi_has_prefix_variables ; then
ED=${D}
 fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2023-04-06 Thread Ulrich Müller
commit: 1cd31f6e6d243153b3901678cf83aef634722181
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Apr  5 16:37:45 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Apr  5 16:37:45 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1cd31f6e

prepman: Deprecate

According to PMS, calling prepman from ebuilds was never allowed.
Last usage in Gentoo repository has been removed on 2019-04-14.

Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/prepman | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 871fd589b..0c0a7e812 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -1,8 +1,12 @@
 #!/usr/bin/env bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Note: this really does nothing these days. It's going to be banned
 # when the last consumers are gone.
 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
+eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope"
+
 exit 0



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, /, bin/

2022-10-17 Thread Sam James
commit: c81e799a3bc8de79ade7c5e2610ed305581c73cc
Author: Sam James  gentoo  org>
AuthorDate: Tue Oct 18 03:16:02 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Oct 18 03:40:07 2022 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c81e799a

info: drop .lz4/.lzo for info, use sorted list

Use same ordering of suffixes as we do elsewhere for easy comparison.

(I threw in .lz4 & .lzo last-minute earlier but on reflection, it's
misleading to put it here if it's not supported yet by texinfo.)

Fixes: 800e09a4a1a630548ea8316e5c906c6f48af3105
Bug: https://bugs.gentoo.org/757525
Signed-off-by: Sam James  gentoo.org>

 NEWS| 2 +-
 bin/ebuild-helpers/prepinfo | 2 +-
 bin/misc-functions.sh   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 780684966..3e2a5a2d6 100644
--- a/NEWS
+++ b/NEWS
@@ -19,7 +19,7 @@ Features:
   * -Wodr
 
 * ecompress, etc: Support additional compression suffixes for texinfo:
-  .xz, .lz, .lz4, .zst, .lzma (bug #757525).
+  .Z, .bz2, .lzma, .lz, .xz, .zst (bug #757525).
 
 Bug fixes:
 * Manifest: Fix Manifest.addFile() calls and add tests (bug #875860).

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index 4d200d0d3..14fa38226 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -32,7 +32,7 @@ find "${ED%/}/${infodir#/}" -type d -print0 | while read -r 
-d $'\0' x ; do
[[ -e ${f} ]] && continue 2
done
 
-   rm -f "${x}"/dir{,.info}{,.gz,.bz2,.xz,.lz,.zst,.lzma,.lz4}
+   rm -f "${x}"/dir{,.info}{,.Z,.gz,.bz2,.lzma,.lz,.xz,.zst}
 done
 
 exit 0

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 2fa61cf37..fc2a36fb3 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -253,7 +253,7 @@ install_qa_check() {
fi
 
# Portage regenerates this on the installed system.
-   rm -f "${ED%/}"/usr/share/info/dir{,.gz,.bz2,.xz,.lz,.zst,.lzma,.lz4} 
|| die "rm failed!"
+   rm -f "${ED%/}"/usr/share/info/dir{,.Z,.gz,.bz2,.lzma,.lz,.xz,.zst} || 
die "rm failed!"
 }
 
 __dyn_instprep() {



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/xattr/, bin/ebuild-helpers/, bin/postinst-qa-check.d/, bin/, ...

2022-08-01 Thread Sam James
commit: cb8eda531dad92bec9293c89f93db9b581245fd3
Author: Sam James  gentoo  org>
AuthorDate: Thu Jul 28 01:25:22 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Aug  1 22:38:11 2022 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cb8eda53

bin: style tweaks

Signed-off-by: Sam James  gentoo.org>

 bin/bashrc-functions.sh |  18 +-
 bin/binhost-snapshot|   2 +-
 bin/chpathtool.py   |   8 +-
 bin/doins.py|   8 +-
 bin/ebuild  |   2 +-
 bin/ebuild-helpers/bsd/sed  |   3 +-
 bin/ebuild-helpers/dobin|   6 +-
 bin/ebuild-helpers/dodir|   4 +-
 bin/ebuild-helpers/dodoc|   4 +-
 bin/ebuild-helpers/doexe|  17 +-
 bin/ebuild-helpers/dohard   |   4 +-
 bin/ebuild-helpers/dohtml   |  10 +-
 bin/ebuild-helpers/doinfo   |   6 +-
 bin/ebuild-helpers/doins|   4 +-
 bin/ebuild-helpers/dolib|  10 +-
 bin/ebuild-helpers/doman|  10 +-
 bin/ebuild-helpers/domo |   8 +-
 bin/ebuild-helpers/dosbin   |   4 +-
 bin/ebuild-helpers/dosed|   8 +-
 bin/ebuild-helpers/dosym|  14 +-
 bin/ebuild-helpers/fowners  |   6 +-
 bin/ebuild-helpers/fperms   |   6 +-
 bin/ebuild-helpers/newins   |  14 +-
 bin/ebuild-helpers/portageq |   1 +
 bin/ebuild-helpers/prepallstrip |   2 +-
 bin/ebuild-helpers/prepinfo |   3 +-
 bin/ebuild-helpers/prepstrip|   2 +-
 bin/ebuild-helpers/unprivileged/chown   |   3 +-
 bin/ebuild-helpers/xattr/install|   2 +-
 bin/ebuild.sh   | 178 
 bin/ecompress   |  13 +-
 bin/ecompress-file  |  15 +-
 bin/egencache   |   8 +-
 bin/emerge-webrsync |  31 ++-
 bin/estrip  |  41 ++--
 bin/etc-update  |  27 ++-
 bin/install-qa-check.d/05prefix |   8 +-
 bin/install-qa-check.d/10executable-issues  |   2 +-
 bin/install-qa-check.d/20deprecated-directories |   6 +-
 bin/install-qa-check.d/60udev   |   5 +-
 bin/install-qa-check.d/80libraries  |   2 +-
 bin/install-qa-check.d/90bad-bin-owner  |   2 +-
 bin/install-qa-check.d/90gcc-warnings   |  10 +-
 bin/install-qa-check.d/90world-writable |  10 +-
 bin/isolated-functions.sh   |  51 ++---
 bin/misc-functions.sh   |  99 +
 bin/phase-functions.sh  | 267 +---
 bin/phase-helpers.sh| 160 --
 bin/portageq|   4 +-
 bin/postinst-qa-check.d/50xdg-utils |  21 +-
 bin/save-ebuild-env.sh  |   8 +-
 51 files changed, 635 insertions(+), 522 deletions(-)

diff --git a/bin/bashrc-functions.sh b/bin/bashrc-functions.sh
index a45587b28..7d6aab544 100644
--- a/bin/bashrc-functions.sh
+++ b/bin/bashrc-functions.sh
@@ -5,22 +5,22 @@
 register_die_hook() {
local x
for x in $* ; do
-   has $x $EBUILD_DEATH_HOOKS || \
-   export EBUILD_DEATH_HOOKS="$EBUILD_DEATH_HOOKS $x"
+   has ${x} ${EBUILD_DEATH_HOOKS} || \
+   export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} ${x}"
done
 }
 
 register_success_hook() {
local x
for x in $* ; do
-   has $x $EBUILD_SUCCESS_HOOKS || \
-   export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"
+   has ${x} ${EBUILD_SUCCESS_HOOKS} || \
+   export EBUILD_SUCCESS_HOOKS="${EBUILD_SUCCESS_HOOKS} 
${x}"
done
 }
 
 __strip_duplicate_slashes() {
-   if [[ -n $1 ]] ; then
-   local removed=$1
+   if [[ -n ${1} ]] ; then
+   local removed=${1}
while [[ ${removed} == *//* ]] ; do
removed=${removed//\/\///}
done
@@ -29,14 +29,14 @@ __strip_duplicate_slashes() {
 }
 
 KV_major() {
-   [[ -z $1 ]] && return 1
+   [[ -z ${1} ]] && return 1
 
local KV=$@
echo "${KV%%.*}"
 }
 
 KV_minor() {
-   [[ -z $1 ]] && return 1
+   [[ -z ${1} ]] && return 1
 
local KV=$@
KV=${KV#*.}
@@ -44,7 +44,7 @@ KV_minor() {
 }
 
 KV_micro() {
-   [[ -z $1 ]] && return 1
+   [[ -z ${1} ]] && return 1
 
   

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2022-07-27 Thread Fabian Groffen
commit: adcabc001024f6398625145e99261f8e216c0e2e
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue Jul 26 18:36:29 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Wed Jul 27 19:04:48 2022 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=adcabc00

bin/ebuild-helpers/doins: fix D check, add EPREFIX check

ED = D/EPREFIX, so checking for ED includes EPREFIX, which when this is
absent fails to check for D.  Simply check for D instead, which catches
both the case for D and ED.

Add check for usage of EPREFIX, like for using D with helpers.

Signed-off-by: Fabian Groffen  gentoo.org>

 bin/ebuild-helpers/doins | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 6c6be31bb..a5fc224a9 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -42,7 +42,7 @@ if ! ___eapi_has_prefix_variables; then
export ED="${D}"
 fi
 
-if [[ ${_E_INSDESTTREE_#${ED}} != "${_E_INSDESTTREE_}" ]]; then
+if [[ ${_E_INSDESTTREE_#${D}} != "${_E_INSDESTTREE_}" ]]; then
__vecho "---" 1>&2
__vecho "You should not use \${D} or \${ED} with helpers." 1>&2
__vecho "  --> ${_E_INSDESTTREE_}" 1>&2
@@ -50,6 +50,16 @@ if [[ ${_E_INSDESTTREE_#${ED}} != "${_E_INSDESTTREE_}" ]]; 
then
__helpers_die "${helper} used with \${D} or \${ED}"
exit 1
 fi
+if [[ -n ${EPREFIX} && \
+   ${_E_INSDESTTREE_#${EPREFIX}} != "${_E_INSDESTTREE_}" ]]
+then
+   __vecho "---" 1>&2
+   __vecho "You should not use \${EPREFIX} with helpers." 1>&2
+   __vecho "  --> ${_E_INSDESTTREE_}" 1>&2
+   __vecho "---" 1>&2
+   __helpers_die "${helper} used with \${EPREFIX}"
+   exit 1
+fi
 
 if ___eapi_doins_and_newins_preserve_symlinks; then
DOINS_ARGS+=( --preserve_symlinks )



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2022-06-26 Thread Mike Gilbert
commit: d24c2a0fa03b8bf226cab97f681dc152beaf3040
Author: Mike Gilbert  gentoo  org>
AuthorDate: Sun Jun 26 16:53:00 2022 +
Commit: Mike Gilbert  gentoo  org>
CommitDate: Sun Jun 26 17:29:26 2022 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d24c2a0f

dosym: fix EAPI check for -r flag

Fixes: dfa50503f76f3e70bac50f959a9c7248e6ea880d
Signed-off-by: Mike Gilbert  gentoo.org>

 bin/ebuild-helpers/dosym | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 69d38956f..9672ed722 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -5,7 +5,7 @@
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
 option_r=
-if [[ ___eapi_has_dosym_r && $1 == -r ]]; then
+if ___eapi_has_dosym_r && [[ $1 == -r ]]; then
option_r=t
shift
 fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2021-05-23 Thread Zac Medico
commit: cbe923acdb6fae689cdaedc7f00901cd00e2557a
Author: Michał Górny  gentoo  org>
AuthorDate: Wed May 12 17:38:16 2021 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon May 24 04:52:34 2021 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=cbe923ac

Make doconf, doenvd, doheader & doinitd ignore ins/exeopts in EAPI 8

Bug: https://bugs.gentoo.org/657580
Signed-off-by: Michał Górny  gentoo.org>
Signed-off-by: Zac Medico  gentoo.org>

 bin/eapi.sh | 16 
 bin/ebuild-helpers/doconfd  |  8 +++-
 bin/ebuild-helpers/doenvd   |  8 +++-
 bin/ebuild-helpers/doheader |  8 +++-
 bin/ebuild-helpers/doinitd  |  9 -
 5 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index d3cac807c..eea8d0d0f 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -266,6 +266,22 @@ ___eapi_usev_has_second_arg() {
[[ ! ${1-${EAPI-0}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ ]]
 }
 
+___eapi_doconfd_respects_insopts() {
+   [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
+___eapi_doenvd_respects_insopts() {
+   [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
+___eapi_doheader_respects_insopts() {
+   [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
+___eapi_doinitd_respects_exeopts() {
+   [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-progress|6|7)$ 
]]
+}
+
 # OTHERS
 
 ___eapi_enables_failglob_in_global_scope() {

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 15ad980f3..572629a54 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -13,4 +13,10 @@ export _E_INSDESTTREE_='/etc/conf.d/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
export INSDESTTREE=${_E_INSDESTTREE_}
 fi
+
+if ! ___eapi_doconfd_respects_insopts; then
+   export INSOPTIONS=-m0644
+   export DIROPTIONS=""
+fi
+
 exec doins "$@"

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index f14b95104..f1310c848 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -13,4 +13,10 @@ export _E_INSDESTTREE_='/etc/env.d/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
export INSDESTTREE=${_E_INSDESTTREE_}
 fi
+
+if ! ___eapi_doenvd_respects_insopts; then
+   export INSOPTIONS=-m0644
+   export DIROPTIONS=""
+fi
+
 exec doins "$@"

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index aedc2322a..2f21a5a2a 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -17,4 +17,10 @@ export _E_INSDESTTREE_='/usr/include/'
 if ___eapi_has_DESTTREE_INSDESTTREE; then
export INSDESTTREE=${_E_INSDESTTREE_}
 fi
+
+if ! ___eapi_doheader_respects_insopts; then
+   export INSOPTIONS=-m0644
+   export DIROPTIONS=""
+fi
+
 exec doins "$@"

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index a216d9827..1863aedac 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -1,11 +1,18 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
 if [[ $# -lt 1 ]] ; then
source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
__helpers_die "${0##*/}: at least one argument needed"
exit 1
 fi
 
+if ! ___eapi_doinitd_respects_exeopts; then
+   export EXEOPTIONS=-m0755
+   export DIROPTIONS=""
+fi
+
 _E_EXEDESTTREE_='/etc/init.d/' exec doexe "$@"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2020-01-22 Thread Zac Medico
commit: dfeae52bdb90763b9144cbb6a82ffc3b8b49d0f6
Author: Zac Medico  gentoo  org>
AuthorDate: Sun Jan 19 18:40:56 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Thu Jan 23 05:58:04 2020 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dfeae52b

dosym: revert deprecated prefix compat (bug 615594)

According to PMS, dosym callers need to explicitly prefix the first
argument with ${EPREFIX} if that's desired.

https://bugs.gentoo.org/615594
Signed-off-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/dosym | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index d5a651bf5..abd4da4f0 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -20,16 +20,7 @@ fi
 
 destdir=${2%/*}
 [[ ! -d ${ED%/}/${destdir#/} ]] && dodir "${destdir}"
-target="${1}"
-# DEPRECATED HACK: when absolute, prefix with offset for Gentoo Prefix
-# (but only if ${EPREFIX} is not there already)
-# this will eventually be removed, #615594
-if [[ ${target:0:1} == "/" && ${target}/ != "${EPREFIX}"/* ]]; then
-   eqawarn "dosym: prepending EPREFIX to path implicitly. If this is 
desired,"
-   eqawarn "   please fix the ebuild to use \${EPREFIX} explicitly."
-   target="${EPREFIX}${target}"
-fi
-ln -snf "${target}" "${ED%/}/${2#/}"
+ln -snf "${1}" "${ED%/}/${2#/}"
 
 ret=$?
 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2019-10-02 Thread Ulrich Müller
commit: 87193bc3da112b8bdb42a2698514fcb047cf6989
Author: Ulrich Müller  gentoo  org>
AuthorDate: Wed Oct  2 10:07:09 2019 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Wed Oct  2 22:19:17 2019 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=87193bc3

doins: Fix directory install options when called as dodoc.

PMS does not mention that diropts should be respected when dodoc -r
creates directories recursively. This is consistent with the behaviour
for regular files, where insopts isn't respected either.

A parallel patch for further clarification of the PMS wording has been
sent to the gentoo-pms mailing list for review.

Acked-by: Zac Medico  gentoo.org>
Signed-off-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/doins | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index fb5fc7c7c..24fe48121 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -15,6 +15,7 @@ if [[ ${helper} == dodoc ]] ; then
exit 0
fi
export INSOPTIONS=-m0644
+   export DIROPTIONS=""
export _E_INSDESTTREE_=usr/share/doc/${PF}/${_E_DOCDESTTREE_}
 else
if ! ___eapi_has_DESTTREE_INSDESTTREE; then



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/xattr/, bin/ebuild-helpers/, bin/ebuild-helpers/unprivileged/, ...

2018-12-29 Thread Zac Medico
commit: b7f053d36f4ea0dd7c1fb109f8bc3dd0f678059a
Author: Zac Medico  gentoo  org>
AuthorDate: Sun Dec 30 01:13:14 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sun Dec 30 01:18:56 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b7f053d3

ebuild-helpers: remove redunant _portage_reinstall_ pattern

The _portage_reinstall_ pattern is now redundant because it would match
${PORTAGE_TMPDIR}/portage/._portage_reinstall_.*/ebuild-helpers* paths
that */portage/*/ebuild-helpers* would also match.

Signed-off-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/bsd/sed| 1 -
 bin/ebuild-helpers/portageq   | 1 -
 bin/ebuild-helpers/unprivileged/chown | 1 -
 bin/ebuild-helpers/xattr/install  | 1 -
 4 files changed, 4 deletions(-)

diff --git a/bin/ebuild-helpers/bsd/sed b/bin/ebuild-helpers/bsd/sed
index 2c252bd01..8bece09cd 100755
--- a/bin/ebuild-helpers/bsd/sed
+++ b/bin/ebuild-helpers/bsd/sed
@@ -16,7 +16,6 @@ else
for path in $PATH; do
if [[ -x ${path}/${scriptname} ]]; then
[[ ${path} == */portage/*/ebuild-helpers* ]] && continue
-   [[ ${path} == */._portage_reinstall_.* ]] && continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && 
continue
exec "${path}/${scriptname}" "$@"
exit 0

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index 45fa85d86..d31bd6810 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -14,7 +14,6 @@ set -f # in case ${PATH} contains any shell glob characters
 for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
[[ ${path} == */portage/*/ebuild-helpers* ]] && continue
-   [[ ${path} == */._portage_reinstall_.* ]] && continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
exec "${PORTAGE_PYTHON:-/usr/bin/python}" \

diff --git a/bin/ebuild-helpers/unprivileged/chown 
b/bin/ebuild-helpers/unprivileged/chown
index 6a8b264d2..a7a4ff447 100755
--- a/bin/ebuild-helpers/unprivileged/chown
+++ b/bin/ebuild-helpers/unprivileged/chown
@@ -12,7 +12,6 @@ IFS=':'
 for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
[[ ${path} == */portage/*/ebuild-helpers* ]] && continue
-   [[ ${path} == */._portage_reinstall_.* ]] && continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
IFS=$' \t\n'
output=$("${path}/${scriptname}" "$@" 2>&1)

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index 171968ffd..e5bb10895 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -29,7 +29,6 @@ set -f
 path=
 for x in ${PATH}; do
[[ ${x} == */portage/*/ebuild-helpers* ]] && continue
-   [[ ${x} == */._portage_reinstall_.* ]] && continue
path+=":${x}"
 done
 PATH=${path#:}



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/xattr/, bin/ebuild-helpers/unprivileged/, ...

2018-12-29 Thread Zac Medico
commit: 886edf0d01a975b3e4da8c39f999c999242f042c
Author: Zac Medico  gentoo  org>
AuthorDate: Sun Dec 30 01:06:19 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sun Dec 30 01:10:31 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=886edf0d

ebuild-helpers: fix PORTAGE_OVERRIDE_EPREFIX usage

In case PORTAGE_OVERRIDE_EPREFIX is modified in the environment,
the actual ebuild-helpers PATH will not match PORTAGE_OVERRIDE_EPREFIX.
Use the same ebuild-helpers pattern as the portageq wrapper script
since daeb75b345c4433218ab9e7a5319e8914092f048.

Signed-off-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/bsd/sed| 2 +-
 bin/ebuild-helpers/unprivileged/chown | 2 +-
 bin/ebuild-helpers/xattr/install  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/ebuild-helpers/bsd/sed b/bin/ebuild-helpers/bsd/sed
index 9a7f2d4bb..2c252bd01 100755
--- a/bin/ebuild-helpers/bsd/sed
+++ b/bin/ebuild-helpers/bsd/sed
@@ -15,7 +15,7 @@ else
 
for path in $PATH; do
if [[ -x ${path}/${scriptname} ]]; then
-   [[ ${path} == 
${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]] && continue
+   [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
[[ ${path} == */._portage_reinstall_.* ]] && continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && 
continue
exec "${path}/${scriptname}" "$@"

diff --git a/bin/ebuild-helpers/unprivileged/chown 
b/bin/ebuild-helpers/unprivileged/chown
index b57dc8aad..6a8b264d2 100755
--- a/bin/ebuild-helpers/unprivileged/chown
+++ b/bin/ebuild-helpers/unprivileged/chown
@@ -11,7 +11,7 @@ IFS=':'
 
 for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
-   [[ ${path} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]] && 
continue
+   [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
[[ ${path} == */._portage_reinstall_.* ]] && continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
IFS=$' \t\n'

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index 4d596e148..171968ffd 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -28,7 +28,7 @@ IFS=':'
 set -f
 path=
 for x in ${PATH}; do
-   [[ ${x} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]] && continue
+   [[ ${x} == */portage/*/ebuild-helpers* ]] && continue
[[ ${x} == */._portage_reinstall_.* ]] && continue
path+=":${x}"
 done



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-12-21 Thread Zac Medico
commit: daeb75b345c4433218ab9e7a5319e8914092f048
Author: Benda Xu  gentoo  org>
AuthorDate: Thu Dec 20 16:43:13 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sat Dec 22 00:07:32 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=daeb75b3

bin/ebuild-helpers/portageq: match against portage/bin/ebuild-helpers

In case PORTAGE_OVERRIDE_EPREFIX is modified in the environment,
the actual ebuild-helpers PATH will not match PORTAGE_OVERRIDE_EPREFIX.

Closes: https://github.com/gentoo/portage/pull/389
Signed-off-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/portageq | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index b314bce9f..45fa85d86 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -13,7 +13,7 @@ set -f # in case ${PATH} contains any shell glob characters
 
 for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
-   [[ ${path} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]] && 
continue
+   [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
[[ ${path} == */._portage_reinstall_.* ]] && continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/, lib/portage/tests/bin/

2018-09-20 Thread Michał Górny
commit: aa0a94198794f8ee8eedad26251b02f7b01dce17
Author: Michał Górny  gentoo  org>
AuthorDate: Sat Mar 24 11:47:02 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Thu Sep 20 18:48:29 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa0a9419

ecompress: Replace with implementation from portage[mgorny]

Replace the old ecompress/ecompressdir implementation with the one used
in portage[mgorny].  This is a squashed version of a long series of
commits that gutted off parts of old logic, introduced the new code,
fixed ongoing bugs and finally restored the missing features.  Given
the scale of changes, it is easier to review it as completely new code.

The duplicate model of ecompress/ecompressdir (both not exactly par
on features) has been replaced by a single helper that compresses
everything uniformly.  Instead of complex path-wise processing,
a mark-file logic is used -- the same as in estrip.  Additionally,
the functions are moved out of ebuild path to clearly indicate they are
internal API (they were not used in any ebuilds).

The new implementation is par on features with the old one.  It supports
exclusion suffix lists, automatic decompression of already-compressed
files (with eqawarn-ing about its unreliability), lower bound for
compressed file size, hardlink breaking and symlink fixing.  In other
words, there should be no regression upon replacing it.

Signed-off-by: Michał Górny  gentoo.org>
Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/ecompress   | 161 --
 bin/ebuild-helpers/ecompressdir| 226 -
 bin/ecompress  | 147 
 bin/ecompress-file |  68 +++
 bin/misc-functions.sh  | 127 +
 lib/portage/tests/bin/setup_env.py |   2 +-
 6 files changed, 221 insertions(+), 510 deletions(-)

diff --git a/bin/ebuild-helpers/ecompress b/bin/ebuild-helpers/ecompress
deleted file mode 100755
index 50ee81129..0
--- a/bin/ebuild-helpers/ecompress
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-if [[ -z $1 ]] ; then
-   __helpers_die "${0##*/}: at least one argument needed"
-   exit 1
-fi
-
-# setup compression stuff
-PORTAGE_COMPRESS=${PORTAGE_COMPRESS-bzip2}
-[[ -z ${PORTAGE_COMPRESS} ]] && exit 0
-
-if [[ ${PORTAGE_COMPRESS_FLAGS+set} != "set" ]] ; then
-   case ${PORTAGE_COMPRESS} in
-   bzip2|gzip)  PORTAGE_COMPRESS_FLAGS="-9";;
-   esac
-fi
-
-# decompress_args(suffix, binary)
-#  - suffix: the compression suffix to work with
-#  - binary: the program to execute that'll compress/decompress
-# new_args: global array used to return revised arguments
-decompress_args() {
-   local suffix=$1 binary=$2
-   shift 2
-
-   # Initialize the global new_args array.
-   new_args=()
-   declare -a decompress_args=()
-   local x i=0 decompress_count=0
-   for x in "$@" ; do
-   if [[ ${x%$suffix} = $x ]] ; then
-   new_args[$i]=$x
-   else
-   new_args[$i]=${x%$suffix}
-   decompress_args[$decompress_count]=$x
-   ((decompress_count++))
-   fi
-   ((i++))
-   done
-
-   if [ $decompress_count -gt 0 ] ; then
-   ${binary} "${decompress_args[@]}"
-   if [ $? -ne 0 ] ; then
-   # Apparently decompression failed for one or more 
files, so
-   # drop those since we don't want to compress them twice.
-   new_args=()
-   local x i=0
-   for x in "$@" ; do
-   if [[ ${x%$suffix} = $x ]] ; then
-   new_args[$i]=$x
-   ((i++))
-   elif [[ -f ${x%$suffix} ]] ; then
-   new_args[$i]=${x%$suffix}
-   ((i++))
-   else
-   # Apparently decompression failed for 
this one, so drop
-   # it since we don't want to compress it 
twice.
-   true
-   fi
-   done
-   fi
-   fi
-}
-
-case $1 in
-   --suffix)
-   [[ -n $2 ]] && __vecho "${0##*/}: --suffix takes no additional 
arguments" 1>&2
-
-   if [[ ! -e ${T}/.ecompress.suffix ]] ; then
-   set -e
-   tmpdir="${T}"/.ecompress$$.${RANDOM}
-   mkdir "${tmpdir}"
-   cd "${tmpdir}"
-   

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2018-09-20 Thread Michał Górny
commit: 6da3070ceeea4affce59310a15c6df86c89d1095
Author: Michał Górny  gentoo  org>
AuthorDate: Sat Mar 24 15:23:43 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Thu Sep 20 18:48:15 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6da3070c

Replace implicit doc compression with dir compression in old EAPIs

Unify the documentation compression methods in all EAPIs to compress
per-directory rather than implicitly compress files installed by dodoc,
doinfo and doman. Old EAPIs don't provide docompress to control which
directories are compressed but they don't say anything about dodoc etc.
compressing anything either.

Signed-off-by: Michał Górny  gentoo.org>
Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/dodoc|  3 +--
 bin/ebuild-helpers/prepinfo |  3 +--
 bin/ebuild-helpers/prepman  | 35 ++-
 bin/misc-functions.sh   |  8 +---
 4 files changed, 5 insertions(+), 44 deletions(-)

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 84936e400..e83091045 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -28,7 +28,6 @@ for x in "$@" ; do
eqawarn "QA Notice: dodoc argument '${x}' is a directory"
elif [ -s "${x}" ] ; then
install -m0644 "${x}" "${dir}" || { ((ret|=1)); continue; }
-   ecompress --queue "${dir}/${x##*/}"
elif [ ! -e "${x}" ] ; then
echo "!!! ${0##*/}: $x does not exist" 1>&2
((ret|=1))

diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
index eb1b6a7e3..9d33e6e9a 100755
--- a/bin/ebuild-helpers/prepinfo
+++ b/bin/ebuild-helpers/prepinfo
@@ -34,5 +34,4 @@ find "${ED%/}/${infodir#/}" -type d -print0 | while read -r 
-d $'\0' x ; do
rm -f "${x}"/dir{,.info}{,.gz,.bz2}
 done
 
-___eapi_has_docompress && exit 0
-exec ecompressdir --queue "${infodir}"
+exit 0

diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
index 5e9fe45b6..4c6d47bb2 100755
--- a/bin/ebuild-helpers/prepman
+++ b/bin/ebuild-helpers/prepman
@@ -2,38 +2,7 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-# Do not compress man pages which are smaller than this (in bytes). #169260
-SIZE_LIMIT='128'
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-if ! ___eapi_has_prefix_variables; then
-   ED=${D}
-fi
-
-if [[ -z $1 ]] ; then
-   mandir="${ED%/}/usr/share/man"
-else
-   mandir="${ED%/}/${1#/}/man"
-fi
-
-if [[ ! -d ${mandir} ]] ; then
-   eqawarn "QA Notice: prepman called with non-existent dir 
'${mandir#${ED%/}}'"
-   exit 0
-fi
-
-# replaced by controllable compression in EAPI 4
-___eapi_has_docompress && exit 0
-
-shopt -s nullglob
-
-really_is_mandir=0
-
-# use some heuristics to test if this is a real mandir
-for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
-   [[ -d ${subdir} ]] && really_is_mandir=1 && break
-done
-
-[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --limit ${SIZE_LIMIT} 
--queue "${mandir#${ED%/}}"
+# Note: this really does nothing these days. It's going to be banned
+# when the last consumers are gone.
 
 exit 0

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index d25bc8498..ed66e90ca 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -171,12 +171,6 @@ __prepall() {
chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
fi
 
-   if ! ___eapi_has_docompress; then
-   while IFS= read -r -d '' mandir ; do
-   mandir=${mandir#${ED}}
-   prepman "${mandir%/man}"
-   done < <(find "${ED}" -type d -name man -print0)
-   fi
[[ -d ${ED%/}/usr/share/info ]] && prepinfo
 
___eapi_has_dostrip || prepallstrip
@@ -245,7 +239,7 @@ install_qa_check() {
 
export STRIP_MASK
__prepall
-   ___eapi_has_docompress && prepcompress
+   prepcompress
ecompressdir --dequeue
ecompress --dequeue
 



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-09-17 Thread Michał Górny
commit: a90bafde1cab2db1f4d6fc65e7bf1b66df680449
Author: Michał Górny  gentoo  org>
AuthorDate: Fri Mar 23 08:18:20 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Sep 17 18:16:33 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a90bafde

f{owners,perms}: Warn when using relative path

Reviewed-by: Zac Medico  gentoo.org>
Closes: https://github.com/gentoo/portage/pull/364

 bin/ebuild-helpers/fowners | 15 +++
 bin/ebuild-helpers/fperms  | 15 +++
 2 files changed, 30 insertions(+)

diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
index 68004210b..0eda73e58 100755
--- a/bin/ebuild-helpers/fowners
+++ b/bin/ebuild-helpers/fowners
@@ -8,6 +8,21 @@ if ! ___eapi_has_prefix_variables; then
EPREFIX= ED=${D}
 fi
 
+got_owner=
+for arg; do
+   [[ ${arg} == -* ]] && continue
+   if [[ ! ${got_owner} ]]; then
+   got_owner=1
+   continue
+   fi
+   if [[ ${arg} != /* ]]; then
+   eqawarn "Relative path passed to '${0##*/}': ${arg}"
+   eqawarn "This is unsupported. Please use 'chown' when you need 
to work on files"
+   eqawarn "outside the installation image (\${ED})."
+   fi
+done
+
+
 # we can't prefix all arguments because
 # chown takes random options
 slash="/"

diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
index c63a6abc3..f98560039 100755
--- a/bin/ebuild-helpers/fperms
+++ b/bin/ebuild-helpers/fperms
@@ -8,6 +8,21 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
+got_mode=
+for arg; do
+   # - can either be an option or a mode string
+   [[ ${arg} == -* && ${arg} != -[ugorwxXst] ]] && continue
+   if [[ ! ${got_mode} ]]; then
+   got_mode=1
+   continue
+   fi
+   if [[ ${arg} != /* ]]; then
+   eqawarn "Relative path passed to '${0##*/}': ${arg}"
+   eqawarn "This is unsupported. Please use 'chmod' when you need 
to work on files"
+   eqawarn "outside the installation image (\${ED})."
+   fi
+done
+
 # we can't prefix all arguments because
 # chmod takes random options
 slash="/"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-09-17 Thread Michał Górny
commit: 1f8eedc8a6d030f5a4fa204fe68b693961e5e7c3
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Mar 22 20:35:17 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Sep 17 06:44:55 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1f8eedc8

Ban prepallinfo for ebuild scope use

Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/prepall | 4 ++--
 bin/ebuild-helpers/prepallinfo | 9 ++---
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index bc77af4a1..c2d879f37 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -17,7 +17,7 @@ if has chflags $FEATURES ; then
 fi
 
 prepallman
-prepallinfo
+[[ -d ${ED%/}/usr/share/info ]] && prepinfo
 
 ___eapi_has_dostrip || prepallstrip
 

diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
index 34d6a74b7..e23a6d410 100755
--- a/bin/ebuild-helpers/prepallinfo
+++ b/bin/ebuild-helpers/prepallinfo
@@ -4,10 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ! ___eapi_has_prefix_variables; then
-   ED=${D}
-fi
-
-[[ -d ${ED%/}/usr/share/info ]] || exit 0
-
-exec prepinfo
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-09-17 Thread Michał Górny
commit: efee1fa6e50aab511c42d995d2fd2f89d9cdecd6
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Mar 22 20:36:59 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Sep 17 06:45:09 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=efee1fa6

Ban prepallman in ebuild scope

Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/prepall|  7 ++-
 bin/ebuild-helpers/prepallman | 20 +++-
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index c2d879f37..87e1ca20c 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -16,7 +16,12 @@ if has chflags $FEATURES ; then
chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
 fi
 
-prepallman
+if ! ___eapi_has_docompress; then
+   while IFS= read -r -d '' mandir ; do
+   mandir=${mandir#${ED}}
+   prepman "${mandir%/man}"
+   done < <(find "${ED}" -type d -name man -print0)
+fi
 [[ -d ${ED%/}/usr/share/info ]] && prepinfo
 
 ___eapi_has_dostrip || prepallstrip

diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
index 03b10a8da..e23a6d410 100755
--- a/bin/ebuild-helpers/prepallman
+++ b/bin/ebuild-helpers/prepallman
@@ -1,22 +1,8 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-# replaced by controllable compression in EAPI 4
-___eapi_has_docompress && exit 0
-
-if ! ___eapi_has_prefix_variables; then
-   ED=${D}
-fi
-
-ret=0
-
-while IFS= read -r -d '' mandir ; do
-   mandir=${mandir#${ED}}
-   prepman "${mandir%/man}"
-   ((ret|=$?))
-done < <(find "${ED}" -type d -name man -print0)
-
-exit ${ret}
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-09-17 Thread Michał Górny
commit: be5877962bfdf949f887a61f03e1754286dd5ffd
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Mar 22 20:59:59 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Sep 17 06:45:11 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=be587796

Ban prepalldocs in ebuild scope

Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/prepalldocs | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
index 6cdceb318..e23a6d410 100755
--- a/bin/ebuild-helpers/prepalldocs
+++ b/bin/ebuild-helpers/prepalldocs
@@ -4,20 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ___eapi_has_docompress; then
-   die "'${0##*/}' has been banned for EAPI '$EAPI'"
-   exit 1
-fi
-
-if [[ -n $1 ]] ; then
-   __vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
-fi
-
-if ! ___eapi_has_prefix_variables; then
-   ED=${D}
-fi
-
-[[ -d ${ED%/}/usr/share/doc ]] || exit 0
-
-ecompressdir --ignore /usr/share/doc/${PF}/html
-ecompressdir --queue /usr/share/doc
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-05-04 Thread Zac Medico
commit: 256bcb665fcd37356c02a08a3e2a12d415a5d656
Author: Zac Medico  gentoo  org>
AuthorDate: Fri May  4 15:55:59 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri May  4 15:55:59 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=256bcb66

ecompressdir: fix slash normalization (bug 654838)

This solves the following error, for EAPI 7 ebuilds using newdoc as shown:

mv: cannot move 
'/var/tmp/portage/portage-test/foo-1/temp/ecompress-skip/usr/share/doc/foo-1/html'
 to
'/var/tmp/portage/portage-test/foo-1/imageusr/share/doc/foo-1/html/html': 
Directory not empty

EAPI=7
src_install() {
docinto html
newdoc /dev/null null.html
}

Fixes: 244a62a4f275 ("Fix uses of D/ED to account for no trailing slash")

 bin/ebuild-helpers/ecompressdir | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
index fb4c39f2b..dacb857be 100755
--- a/bin/ebuild-helpers/ecompressdir
+++ b/bin/ebuild-helpers/ecompressdir
@@ -139,7 +139,7 @@ funk_up_dir() {
 # Move all files and directories we want to skip running compression
 # on from srctree to dsttree.
 _relocate_skip_dirs() {
-   local srctree="$1" dsttree="$2"
+   local srctree="${1%/}" dsttree="${2%/}"
 
[[ -d ${srctree} ]] || return 0
 
@@ -213,7 +213,7 @@ for dir in "$@" ; do
 
# now lets do our work
if [[ -n ${suffix} ]] ; then
-   __vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED%/}}"
+   __vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED%/}/}"
funk_up_dir "compress" "${suffix}" "ecompress" "${size_limit}"
: $(( ret |= $? ))
fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2018-03-27 Thread Zac Medico
commit: 9aaa652c86b21b925bc56fafd57b561b86ace0f8
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Mar 26 19:12:51 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Wed Mar 28 05:09:15 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9aaa652c

Add dostrip for EAPI 7

This patch includes the essential parts of the dostrip implementation
from portage-mgorny. All of the prepstrip code has moved to
bin/estrip, without any changes except the addition of argument
parsing for estrip --ignore, --queue, and --deque modes which are
equivalent to the corresponding ecompressdir modes.

Due to overlap, also ban the non-standard prepstrip and prepallstrip
helpers in EAPI 7, with a die message suggesting to use 'dostrip'
instead. Also ignore the non-standard STRIP_MASK variable for EAPI 7.

Bug: https://bugs.gentoo.org/203891

 bin/eapi.sh |  4 +++
 bin/ebuild-helpers/prepall  |  2 +-
 bin/ebuild-helpers/prepallstrip |  4 +++
 bin/ebuild-helpers/prepstrip|  4 +++
 bin/ebuild.sh   |  2 +-
 bin/estrip  | 74 +++--
 bin/misc-functions.sh   |  6 
 bin/phase-helpers.sh| 29 
 bin/save-ebuild-env.sh  |  4 +--
 9 files changed, 122 insertions(+), 7 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 326eb387e..f9a4744e9 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -76,6 +76,10 @@ ___eapi_has_docompress() {
[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }
 
+___eapi_has_dostrip() {
+   [[ ${1-${EAPI-0}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 ___eapi_has_nonfatal() {
[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 44643bb58..bc77af4a1 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -19,7 +19,7 @@ fi
 prepallman
 prepallinfo
 
-prepallstrip
+___eapi_has_dostrip || prepallstrip
 
 if has chflags $FEATURES ; then
# Restore all the file flags that were saved at the beginning of 
prepall.

diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
index 59fa7cc61..4bde1f4b2 100755
--- a/bin/ebuild-helpers/prepallstrip
+++ b/bin/ebuild-helpers/prepallstrip
@@ -4,6 +4,10 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+if ___eapi_has_dostrip; then
+   die "${0##*/}: ${0##*/} has been banned for EAPI '$EAPI'; use 'dostrip' 
instead"
+fi
+
 if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 0ec4c16b3..9db06284d 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -4,4 +4,8 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
+if ___eapi_has_dostrip; then
+   die "${0##*/}: ${0##*/} has been banned for EAPI '$EAPI'; use 'dostrip' 
instead"
+fi
+
 exec -a "${0}" "${PORTAGE_BIN_PATH}"/estrip "${@}"

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 061b1aff4..11441bfb2 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -59,7 +59,7 @@ else
# These dummy functions are for things that are likely to be called
# in global scope, even though they are completely useless during
# the "depend" phase.
-   funcs="diropts docompress exeopts get_KV insopts
+   funcs="diropts docompress dostrip exeopts get_KV insopts
KV_major KV_micro KV_minor KV_to_int
libopts register_die_hook register_success_hook
__strip_duplicate_slashes

diff --git a/bin/estrip b/bin/estrip
index 2136e0d4d..fbd5882fa 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -30,6 +30,64 @@ if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
${FEATURES_installsources} || exit 0
 fi
 
+[[ ${0##*/} == prepstrip ]] && prepstrip=true || prepstrip=false
+
+if ! ${prepstrip}; then
+while [[ $# -gt 0 ]] ; do
+   case $1 in
+   --ignore)
+   shift
+
+   skip_dirs=()
+   for skip; do
+   if [[ -d ${ED%/}/${skip#/} ]]; then
+   skip_dirs+=( "${ED%/}/${skip#/}" )
+   else
+   rm -f "${ED%/}/${skip#/}.estrip" || die
+   fi
+   done
+
+   if [[ ${skip_dirs[@]} ]]; then
+   find "${skip_dirs[@]}" -name '*.estrip' -delete || die
+   fi
+
+   exit 0
+   ;;
+   --queue)
+   shift
+
+   find_paths=()
+   for path; do
+   if [[ -e ${ED%/}/${path#/} ]]; then
+   find_paths+=( "${ED%/}/${path#/}" )
+   fi
+   done
+
+   if [[ ${find_paths[@]} ]]; then
+   while IFS= read -r path; do
+   >> 

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-03-14 Thread Michał Górny
commit: c1a2ba57421a0a6fd0463e2a002fe1965f055efc
Author: Michał Górny  gentoo  org>
AuthorDate: Wed Mar 14 10:19:49 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Wed Mar 14 17:04:28 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c1a2ba57

prepstrip: Fix double slash in pre-stripped list

Fixes: 244a62a4f275e4282dc040be3c049e593c36c0ce
Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/prepstrip | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 9b895c60b..2136e0d4d 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -255,7 +255,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
# and start stripping the files ourselves.  The log parsing can be done 
in
# parallel though.
log=${tmpdir}/scanelf-already-stripped.log
-   scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED%/}##" > 
"${log}"
+   scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED%/}/##" > 
"${log}"
(
__multijob_child_init
qa_var="QA_PRESTRIPPED_${ARCH/-/_}"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/install-qa-check.d/, bin/

2018-03-12 Thread Michał Górny
commit: 244a62a4f275e4282dc040be3c049e593c36c0ce
Author: Michał Górny  gentoo  org>
AuthorDate: Wed Mar  7 15:00:10 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Mon Mar 12 20:11:44 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=244a62a4

Fix uses of D/ED to account for no trailing slash

Fix all uses of D/ED to account for trailing slash not being present
in EAPI 7. While at it, also remove some duplicate slashes.

Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/dobin   |  6 +++---
 bin/ebuild-helpers/dodir   |  4 ++--
 bin/ebuild-helpers/dodoc   |  2 +-
 bin/ebuild-helpers/doexe   |  8 
 bin/ebuild-helpers/dohard  |  6 +++---
 bin/ebuild-helpers/doinfo  |  8 
 bin/ebuild-helpers/doins   |  2 +-
 bin/ebuild-helpers/dolib   |  2 +-
 bin/ebuild-helpers/doman   |  8 
 bin/ebuild-helpers/domo|  6 +++---
 bin/ebuild-helpers/dosbin  |  6 +++---
 bin/ebuild-helpers/dosed   |  4 ++--
 bin/ebuild-helpers/dosym   |  8 
 bin/ebuild-helpers/ecompressdir| 25 ---
 bin/ebuild-helpers/fowners |  4 ++--
 bin/ebuild-helpers/fperms  |  4 ++--
 bin/ebuild-helpers/keepdir |  6 +++---
 bin/ebuild-helpers/prepalldocs |  4 ++--
 bin/ebuild-helpers/prepallinfo |  4 ++--
 bin/ebuild-helpers/prepinfo| 12 +--
 bin/ebuild-helpers/prepman | 10 -
 bin/ebuild-helpers/prepstrip   | 17 +++
 bin/install-qa-check.d/60udev  |  6 +++---
 bin/install-qa-check.d/80libraries | 22 ++--
 bin/misc-functions.sh  | 24 +++---
 bin/phase-helpers.sh   | 42 +++---
 26 files changed, 126 insertions(+), 124 deletions(-)

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index f43871f49..975067fb1 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -21,15 +21,15 @@ else
_E_DESTTREE_=${DESTTREE}
 fi
 
-if [[ ! -d ${ED}${_E_DESTTREE_}/bin ]] ; then
-   install -d "${ED}${_E_DESTTREE_}/bin" || { __helpers_die "${0##*/}: 
failed to install ${ED}${_E_DESTTREE_}/bin"; exit 2; }
+if [[ ! -d ${ED%/}/${_E_DESTTREE_#/}/bin ]] ; then
+   install -d "${ED%/}/${_E_DESTTREE_#/}/bin" || { __helpers_die 
"${0##*/}: failed to install ${ED%/}/${_E_DESTTREE_#/}/bin"; exit 2; }
 fi
 
 ret=0
 
 for x in "$@" ; do
if [[ -e ${x} ]] ; then
-   install -m0755 -o ${PORTAGE_INST_UID:-0} -g 
${PORTAGE_INST_GID:-0} "${x}" "${ED}${_E_DESTTREE_}/bin"
+   install -m0755 -o ${PORTAGE_INST_UID:-0} -g 
${PORTAGE_INST_GID:-0} "${x}" "${ED%/}/${_E_DESTTREE_#/}/bin"
else
echo "!!! ${0##*/}: $x does not exist" 1>&2
false

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index eed2c8b8f..9b376c73f 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -8,7 +8,7 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
-install -d ${DIROPTIONS} "${@/#/${ED}/}"
+install -d ${DIROPTIONS} "${@/#/${ED%/}/}"
 ret=$?
 [[ $ret -ne 0 ]] && __helpers_die "${0##*/} failed"
 exit $ret

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 75029eb20..84936e400 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -17,7 +17,7 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
-dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+dir="${ED%/}/usr/share/doc/${PF}/${_E_DOCDESTTREE_#/}"
 if [ ! -d "${dir}" ] ; then
install -d "${dir}"
 fi

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index 8c4b9e97c..152c13bf6 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -13,8 +13,8 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
-if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
-   install -d "${ED}${_E_EXEDESTTREE_}"
+if [[ ! -d ${ED%/}/${_E_EXEDESTTREE_#/} ]] ; then
+   install -d "${ED%/}/${_E_EXEDESTTREE_#/}"
 fi
 
 TMP=$(mktemp -d "${T}/.doexe_tmp_XX")
@@ -32,7 +32,7 @@ for x in "$@" ; do
mysrc="${x}"
fi
if [ -e "$mysrc" ] ; then
-   install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"
+   install ${EXEOPTIONS} "$mysrc" "${ED%/}/${_E_EXEDESTTREE_#/}"
else
echo "!!! ${0##*/}: $mysrc does not 

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-03-11 Thread Michał Górny
commit: 61667248130fcf279047472875d03fa65520d084
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Sep 21 17:19:12 2017 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sun Mar 11 11:43:41 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=61667248

nonfatal: Implement fallback executable for EAPI 7

EAPI 7 specifies that nonfatal has to be implemented both as a bash
function and a fallback executable, so that it can be used e.g. via
find/xargs.

Bug: https://bugs.gentoo.org/622894

 bin/ebuild-helpers/nonfatal | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/bin/ebuild-helpers/nonfatal b/bin/ebuild-helpers/nonfatal
new file mode 100755
index 0..5da07cc71
--- /dev/null
+++ b/bin/ebuild-helpers/nonfatal
@@ -0,0 +1,14 @@
+#!/bin/bash
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
+if ! ___eapi_has_nonfatal; then
+   die "${0##*/} not supported in this EAPI"
+fi
+if [[ $# -lt 1 ]]; then
+   die "${0##*/}: Missing argument"
+fi
+
+PORTAGE_NONFATAL=1 exec "$@"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-03-08 Thread Michał Górny
commit: 15b84985370820af47247eef7ca3fdb7676ab987
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Mar  8 19:50:51 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Thu Mar  8 21:49:45 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=15b84985

ebuild-helpers: Fix overriding 'insinto' directory

Closes: https://bugs.gentoo.org/649946
Reviewed-by: Zac Medico  gentoo.org>

 bin/ebuild-helpers/doconfd  | 9 +++--
 bin/ebuild-helpers/doenvd   | 9 +++--
 bin/ebuild-helpers/doheader | 6 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 38cf58234..15ad980f3 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -2,10 +2,15 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
 if [[ $# -lt 1 ]] ; then
-   source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
__helpers_die "${0##*/}: at least one argument needed"
exit 1
 fi
 
-_E_INSDESTTREE_='/etc/conf.d/' exec doins "$@"
+export _E_INSDESTTREE_='/etc/conf.d/'
+if ___eapi_has_DESTTREE_INSDESTTREE; then
+   export INSDESTTREE=${_E_INSDESTTREE_}
+fi
+exec doins "$@"

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index a15cec7f2..f14b95104 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -2,10 +2,15 @@
 # Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
 if [[ $# -lt 1 ]] ; then
-   source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
__helpers_die "${0##*/}: at least one argument needed"
exit 1
 fi
 
-_E_INSDESTTREE_='/etc/env.d/' exec doins "$@"
+export _E_INSDESTTREE_='/etc/env.d/'
+if ___eapi_has_DESTTREE_INSDESTTREE; then
+   export INSDESTTREE=${_E_INSDESTTREE_}
+fi
+exec doins "$@"

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index 03bf23b1c..aedc2322a 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -13,4 +13,8 @@ if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then
exit 1
 fi
 
-_E_INSDESTTREE_='/usr/include/' exec doins "$@"
+export _E_INSDESTTREE_='/usr/include/'
+if ___eapi_has_DESTTREE_INSDESTTREE; then
+   export INSDESTTREE=${_E_INSDESTTREE_}
+fi
+exec doins "$@"



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2018-03-04 Thread Michał Górny
commit: bab6cc7268d0788d501e05f15b79b220de71664f
Author: Michał Górny  gentoo  org>
AuthorDate: Thu Sep 21 15:07:17 2017 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sun Mar  4 21:03:53 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bab6cc72

domo: force /usr prefix in EAPI 7

Bug: https://bugs.gentoo.org/595924

 bin/eapi.sh | 4 
 bin/ebuild-helpers/domo | 7 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 5a1a9aa40..ba4008acf 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -186,6 +186,10 @@ ___eapi_die_can_respect_nonfatal() {
[[ ! ${1-${EAPI-0}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_domo_respects_into() {
+   [[ ${1-${EAPI-0}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 # OTHERS
 
 ___eapi_enables_failglob_in_global_scope() {

diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
index 9742173ac..e08e55a3a 100755
--- a/bin/ebuild-helpers/domo
+++ b/bin/ebuild-helpers/domo
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -14,6 +14,11 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
+# newer EAPIs force /usr consistently with other /usr/share helpers
+if ! ___eapi_domo_respects_into; then
+   DESTTREE=/usr
+fi
+
 if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
install -d "${ED}${DESTTREE}/share/locale/"
 fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-03-03 Thread Zac Medico
commit: aff97baa3625cabdf71fea9a0256381282040860
Author: Arfrever Frehtes Taifersar Arahesis  Apache  Org>
AuthorDate: Sun Mar  4 02:33:44 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sun Mar  4 02:40:47 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=aff97baa

prepstrip: Preserve xattr outside of user namespace.

Pass '-m -' to getfattr for including all extended attributes, because
getfattr defaults to including only user.* extended attributes.

Bug: https://bugs.gentoo.org/649524

 bin/ebuild-helpers/prepstrip | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index ea5c0dc09..929547ae5 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -35,7 +35,7 @@ if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then
PRESERVE_XATTR=true
if type -P getfattr >/dev/null && type -P setfattr >/dev/null ; then
dump_xattrs() {
-   getfattr -d --absolute-names "$1"
+   getfattr -d -m - --absolute-names "$1"
}
restore_xattrs() {
setfattr --restore=-



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2018-02-04 Thread Zac Medico
commit: 9215056d3eb9814b2ffee9bd7c7cc8a540fcc7ee
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Feb  5 04:38:09 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Feb  5 04:39:36 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9215056d

bin/ebuild-helpers/newins: ${*:3} for explicit concatenation

Reported-by: R0b0t1  gmail.com>

 bin/ebuild-helpers/newins | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
index 8032a8f2f..30e54b7e5 100755
--- a/bin/ebuild-helpers/newins
+++ b/bin/ebuild-helpers/newins
@@ -12,7 +12,7 @@ if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
 fi
 
 (($#>2)) && \
-   eqawarn "QA Notice: ${helper} called with more than 2 arguments: ${@:3}"
+   eqawarn "QA Notice: ${helper} called with more than 2 arguments: ${*:3}"
 
 stdin=
 if ___eapi_newins_supports_reading_from_standard_input && [[ $1 == "-" ]]; then



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2017-12-15 Thread Zac Medico
commit: 7ae0c9d084bb1caf18c751cecb7fb98a619dfbcb
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Dec 15 20:59:06 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Dec 15 20:59:19 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7ae0c9d0

bin/ebuild-helpers/doins: fix PYTHONPATH setting (bug 640934)

This makes the PYTHONPATH setting consistent with other helpers
like dohtml and xattr/install.

Fixes: d9522ba661b5 ("Rewrite doins in python (bug 624526)")
Bug: https://bugs.gentoo.org/640934

 bin/ebuild-helpers/doins | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index c3a57890a..73c9d8b91 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -82,7 +82,7 @@ DOINS_ARGS+=(
 # If PYTHONPATH is empty (not unset), it means "add current working directory
 # to the import path" if the Python is prior to 3.4, which would cause
 # unexpected import. See also #469338.
-PYTHONPATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}${PYTHONPATH:+:}${PYTHONPATH}"
 \
+PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
"${PORTAGE_PYTHON:-/usr/bin/python}" \
"${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/doins.py \
"${DOINS_ARGS[@]}" -- "$@" || \



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2017-10-16 Thread Zac Medico
commit: 234ad726ddc5d62eb0d956023de338dc488e2ea1
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Oct 16 08:08:19 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Oct 16 17:15:20 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=234ad726

prepstrip: use debugedit from rpm if necessary (bug 634378)

If debugedit is not found in PATH, then use debugedit
installed by app-arch/rpm (if available).

Suggested-by: Francesco Riosa  gmail.com>
Bug: https://bugs.gentoo.org/634378
Acked-by: Brian Dolbec  gentoo.org>

 bin/ebuild-helpers/prepstrip | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 43caa29c7..ea5c0dc09 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -84,7 +84,19 @@ esac
 
 prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
 
-type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
+debugedit=$(type -P debugedit)
+if [[ -z ${debugedit} ]]; then
+   debugedit_paths=(
+   "${EPREFIX}/usr/libexec/rpm/debugedit"
+   )
+   for x in "${debugedit_paths[@]}"; do
+   if [[ -x ${x} ]]; then
+   debugedit=${x}
+   break
+   fi
+   done
+fi
+[[ ${debugedit} ]] && debugedit_found=true || debugedit_found=false
 debugedit_warned=false
 
 __multijob_init
@@ -101,8 +113,8 @@ save_elf_sources() {
if ! ${debugedit_found} ; then
if ! ${debugedit_warned} ; then
debugedit_warned=true
-   ewarn "FEATURES=installsources is enabled but the 
debugedit binary could not"
-   ewarn "be found. This feature will not work unless 
debugedit is installed!"
+   ewarn "FEATURES=installsources is enabled but the 
debugedit binary could not be"
+   ewarn "found. This feature will not work unless 
debugedit or rpm is installed!"
fi
return 0
fi
@@ -112,7 +124,7 @@ save_elf_sources() {
# since we're editing the ELF here, we should recompute the build-id
# (the -i flag below).  save that output so we don't need to recompute
# it later on in the save_elf_debug step.
-   buildid=$(debugedit -i \
+   buildid=$("${debugedit}" -i \
-b "${WORKDIR}" \
-d "${prepstrip_sources_dir}" \
-l "${tmpdir}/sources/${x##*/}.${BASHPID:-$(__bashpid)}" \



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2017-07-09 Thread Michał Górny
commit: 6465e5a1d970d0d28a590a5958d7d61e7378d1c3
Author: Michał Górny  gentoo  org>
AuthorDate: Sun Jul  2 17:55:49 2017 +
Commit: Michał Górny  gentoo  org>
CommitDate: Sun Jul  9 21:34:52 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=6465e5a1

doman: QA-complain on compressed files

Passing compressed files to doman is not permitted by the PMS. However,
Portage permitting it results in many developers repeatedly violating
this and arguing that it's permitted because nobody explicitly forbids
it. Add an explicit QA warning to Portage to cease it.

Reviewed-by: Brian Dolbec  gentoo.org>

 bin/ebuild-helpers/doman | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
index da66ac335..43d29f22e 100755
--- a/bin/ebuild-helpers/doman
+++ b/bin/ebuild-helpers/doman
@@ -30,6 +30,7 @@ for x in "$@" ; do
 
# These will be automatically decompressed by ecompressdir.
if has ${suffix} Z gz bz2 ; then
+   eqawarn "QA Notice: doman argument '${x}' is compressed, this 
is not portable"
realname=${x%.*}
suffix=${realname##*.}
fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2017-04-20 Thread Michał Górny
commit: 18712aa6924862bbab5814c6199e7d7ab416d005
Author: Michał Górny  gentoo  org>
AuthorDate: Wed Apr 19 13:36:02 2017 +
Commit: Michał Górny  gentoo  org>
CommitDate: Thu Apr 20 20:39:51 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=18712aa6

dosym: protect Prefix hack from double EPREFIX

Add an additional conditional to the dosym Prefix hack to ensure that
the symlink is not using double Prefix when the ebuild uses ${EPREFIX}
explicitly. This ensures that Portage on Prefix systems is both
compatible with the ebuilds relying on the hack, and using dosym
in the PMS-defined manner.

Approved-by: Brian Dolbec  gentoo.org> (on IRC)
Approved-by: Ulrich Müller  gentoo.org>

 bin/ebuild-helpers/dosym | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index b9c70ce9c..e96039146 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -20,9 +20,15 @@ fi
 
 destdir=${2%/*}
 [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
-# when absolute, prefix with offset for Gentoo Prefix
 target="${1}"
-[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}"
+# DEPRECATED HACK: when absolute, prefix with offset for Gentoo Prefix
+# (but only if ${EPREFIX} is not there already)
+# this will eventually be removed, #615594
+if [[ ${target:0:1} == "/" && ${target}/ != "${EPREFIX}"/* ]]; then
+   eqawarn "dosym: prepending EPREFIX to path implicitly. If this is 
desired,"
+   eqawarn "   please fix the ebuild to use \${EPREFIX} explicitly."
+   target="${EPREFIX}${target}"
+fi
 ln -snf "${target}" "${ED}${2}"
 
 ret=$?



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2017-04-20 Thread Ulrich Müller
commit: c40c39537d584f57e449d3525e92fafbe85517fd
Author: Ulrich Müller  gentoo  org>
AuthorDate: Sat Apr 15 09:11:18 2017 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Thu Apr 20 17:20:04 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c40c3953

dosym: Make implicit basename a fatal error.

The respective QA warning in the dosym helper is in place since 2011.
All known violations in the gentoo repository have been fixed.

Gentoo-Bug: 379899
Acked-by: Brian Dolbec  gentoo.org>

 bin/ebuild-helpers/dosym | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index 0bc8cc7be..b9c70ce9c 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -13,10 +13,9 @@ if ! ___eapi_has_prefix_variables; then
ED=${D}
 fi
 
-if [[ ${2} == */ ]] || \
-   [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
+if [[ ${2} == */ ]] || [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
# implicit basename not allowed by PMS (bug #379899)
-   eqawarn "QA Notice: dosym target omits basename: '${2}'"
+   __helpers_die "${0##*/}: dosym target omits basename: '${2}'"
 fi
 
 destdir=${2%/*}



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/unprivileged/, bin/ebuild-helpers/xattr/, bin/, ...

2015-06-10 Thread Mike Frysinger
commit: 62769c609dd770a5f225028f6701af06a0dd8e9c
Author: Mike Frysinger vapier AT gentoo DOT org
AuthorDate: Mon Jun  1 06:31:26 2015 +
Commit: Mike Frysinger vapier AT gentoo DOT org
CommitDate: Wed Jun 10 23:57:16 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=62769c60

require PORTAGE_{BIN,PYM}_PATH not be cleared

Rather than hardcode a full path everywhere as a fallback, assume the
value is always set to the right location.  The current path isn't the
right place anymore already.

If it turns out we want to support this scenario, we can do it via a
bunch of bootstrapping (and symlinked) files.

 bin/ebuild-helpers/die| 2 +-
 bin/ebuild-helpers/dobin  | 2 +-
 bin/ebuild-helpers/doconfd| 2 +-
 bin/ebuild-helpers/dodir  | 2 +-
 bin/ebuild-helpers/dodoc  | 2 +-
 bin/ebuild-helpers/doenvd | 2 +-
 bin/ebuild-helpers/doexe  | 2 +-
 bin/ebuild-helpers/dohard | 2 +-
 bin/ebuild-helpers/doheader   | 2 +-
 bin/ebuild-helpers/dohtml | 6 ++
 bin/ebuild-helpers/doinfo | 2 +-
 bin/ebuild-helpers/doinitd| 2 +-
 bin/ebuild-helpers/doins  | 2 +-
 bin/ebuild-helpers/dolib  | 2 +-
 bin/ebuild-helpers/doman  | 2 +-
 bin/ebuild-helpers/domo   | 2 +-
 bin/ebuild-helpers/dosbin | 2 +-
 bin/ebuild-helpers/dosed  | 2 +-
 bin/ebuild-helpers/dosym  | 2 +-
 bin/ebuild-helpers/ecompress  | 2 +-
 bin/ebuild-helpers/ecompressdir   | 2 +-
 bin/ebuild-helpers/elog   | 2 +-
 bin/ebuild-helpers/emake  | 2 +-
 bin/ebuild-helpers/fowners| 2 +-
 bin/ebuild-helpers/fperms | 2 +-
 bin/ebuild-helpers/keepdir| 2 +-
 bin/ebuild-helpers/newins | 2 +-
 bin/ebuild-helpers/portageq   | 4 +---
 bin/ebuild-helpers/prepall| 2 +-
 bin/ebuild-helpers/prepalldocs| 2 +-
 bin/ebuild-helpers/prepallinfo| 2 +-
 bin/ebuild-helpers/prepallman | 2 +-
 bin/ebuild-helpers/prepallstrip   | 2 +-
 bin/ebuild-helpers/prepinfo   | 2 +-
 bin/ebuild-helpers/prepman| 2 +-
 bin/ebuild-helpers/prepstrip  | 3 +--
 bin/ebuild-helpers/unprivileged/chown | 4 ++--
 bin/ebuild-helpers/xattr/install  | 2 --
 bin/ebuild-ipc| 4 +---
 bin/ebuild.sh | 3 ---
 bin/helper-functions.sh   | 2 +-
 bin/isolated-functions.sh | 2 +-
 bin/misc-functions.sh | 2 +-
 43 files changed, 43 insertions(+), 55 deletions(-)

diff --git a/bin/ebuild-helpers/die b/bin/ebuild-helpers/die
index 9869141..5c6b1d2 100755
--- a/bin/ebuild-helpers/die
+++ b/bin/ebuild-helpers/die
@@ -2,6 +2,6 @@
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
+source ${PORTAGE_BIN_PATH}/isolated-functions.sh || exit 1
 die $@
 exit 1

diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
index 0ba1eb0..9f4d73d 100755
--- a/bin/ebuild-helpers/dobin
+++ b/bin/ebuild-helpers/dobin
@@ -2,7 +2,7 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
+source ${PORTAGE_BIN_PATH}/isolated-functions.sh || exit 1
 
 if [[ $# -lt 1 ]] ; then
__helpers_die ${0##*/}: at least one argument needed

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index 1baa3ed..926c318 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 if [[ $# -lt 1 ]] ; then
-   source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
+   source ${PORTAGE_BIN_PATH}/isolated-functions.sh || exit 1
__helpers_die ${0##*/}: at least one argument needed
exit 1
 fi

diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
index e03ba9a..eed2c8b 100755
--- a/bin/ebuild-helpers/dodir
+++ b/bin/ebuild-helpers/dodir
@@ -2,7 +2,7 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
+source ${PORTAGE_BIN_PATH}/isolated-functions.sh || exit 1
 
 if ! ___eapi_has_prefix_variables; then
ED=${D}

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 6ccf0a4..75029eb 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -2,7 +2,7 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
+source 

[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2015-05-14 Thread Brian Dolbec
commit: 4eccd02bff2d8cf11176750087f29d372af0e71f
Author: Mike Frysinger vapier AT gentoo DOT org
AuthorDate: Thu May 14 09:41:10 2015 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Thu May 14 19:01:22 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4eccd02b

ebuild-helpers: avoid `env` indirection by setting the vars before the exec

Setting an env var on the same line as the exec will make bash export the
var to the program it execs.  That means these forms are practically equiv:
FOO=val exec blah
exec env FOO=val blah

The difference is that we now avoid execing env entirely.

 bin/ebuild-helpers/doconfd  | 5 +
 bin/ebuild-helpers/dodoc| 5 +
 bin/ebuild-helpers/doenvd   | 5 +
 bin/ebuild-helpers/doheader | 5 +
 bin/ebuild-helpers/doinitd  | 5 +
 bin/ebuild-helpers/dolib.a  | 3 +--
 bin/ebuild-helpers/dolib.so | 3 +--
 7 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index a3c09a5..1baa3ed 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-exec \
-env \
-INSDESTTREE=/etc/conf.d/ \
-doins $@
+INSDESTTREE='/etc/conf.d/' exec doins $@

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 99122c4..6ccf0a4 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -5,10 +5,7 @@
 source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
 
 if ___eapi_dodoc_supports_-r; then
-   exec \
-   env \
-   __PORTAGE_HELPER=dodoc \
-   doins $@
+   __PORTAGE_HELPER='dodoc' exec doins $@
 fi
 
 if [ $# -lt 1 ] ; then

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index 9287933..67bb934 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-exec \
-env \
-INSDESTTREE=/etc/env.d/ \
-doins $@
+INSDESTTREE='/etc/env.d/' exec doins $@

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index 3795365..e4cae6a 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -13,7 +13,4 @@ if [[ $# -lt 1 ]] || [[ $1 == -r  $# -lt 2 ]] ; then
exit 1
 fi
 
-exec \
-env \
-INSDESTTREE=/usr/include/ \
-doins $@
+INSDESTTREE='/usr/include/' exec doins $@

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index 476b858..aa7b66c 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-exec \
-env \
-_E_EXEDESTTREE_=/etc/init.d/ \
-doexe $@
+_E_EXEDESTTREE_='/etc/init.d/' exec doexe $@

diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
index d2279dc..61961e4 100755
--- a/bin/ebuild-helpers/dolib.a
+++ b/bin/ebuild-helpers/dolib.a
@@ -2,5 +2,4 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec env LIBOPTIONS=-m0644 \
-   dolib $@
+LIBOPTIONS='-m0644' exec dolib $@

diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
index 4bdbfab..eab8c91 100755
--- a/bin/ebuild-helpers/dolib.so
+++ b/bin/ebuild-helpers/dolib.so
@@ -2,5 +2,4 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec env LIBOPTIONS=-m0755 \
-   dolib $@
+LIBOPTIONS='-m0755' exec dolib $@



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2015-05-14 Thread Mike Frysinger
commit: 122465d2c507cd4904d940500dcf23eaab93954f
Author: Mike Frysinger vapier AT gentoo DOT org
AuthorDate: Thu May 14 09:41:10 2015 +
Commit: Mike Frysinger vapier AT gentoo DOT org
CommitDate: Thu May 14 09:41:10 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=122465d2

ebuild-helpers: avoid `env` indirection by setting the vars before the exec

Setting an env var on the same line as the exec will make bash export the
var to the program it execs.  That means these forms are practically equiv:
FOO=val exec blah
exec env FOO=val blah

The difference is that we now avoid execing env entirely.

 bin/ebuild-helpers/doconfd  | 5 +
 bin/ebuild-helpers/dodoc| 5 +
 bin/ebuild-helpers/doenvd   | 5 +
 bin/ebuild-helpers/doheader | 5 +
 bin/ebuild-helpers/doinitd  | 5 +
 bin/ebuild-helpers/dolib.a  | 3 +--
 bin/ebuild-helpers/dolib.so | 3 +--
 7 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index a3c09a5..1baa3ed 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-exec \
-env \
-INSDESTTREE=/etc/conf.d/ \
-doins $@
+INSDESTTREE='/etc/conf.d/' exec doins $@

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 99122c4..6ccf0a4 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -5,10 +5,7 @@
 source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
 
 if ___eapi_dodoc_supports_-r; then
-   exec \
-   env \
-   __PORTAGE_HELPER=dodoc \
-   doins $@
+   __PORTAGE_HELPER='dodoc' exec doins $@
 fi
 
 if [ $# -lt 1 ] ; then

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index 9287933..67bb934 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-exec \
-env \
-INSDESTTREE=/etc/env.d/ \
-doins $@
+INSDESTTREE='/etc/env.d/' exec doins $@

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index 3795365..e4cae6a 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -13,7 +13,4 @@ if [[ $# -lt 1 ]] || [[ $1 == -r  $# -lt 2 ]] ; then
exit 1
 fi
 
-exec \
-env \
-INSDESTTREE=/usr/include/ \
-doins $@
+INSDESTTREE='/usr/include/' exec doins $@

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index 476b858..aa7b66c 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
exit 1
 fi
 
-exec \
-env \
-_E_EXEDESTTREE_=/etc/init.d/ \
-doexe $@
+_E_EXEDESTTREE_='/etc/init.d/' exec doexe $@

diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
index d2279dc..61961e4 100755
--- a/bin/ebuild-helpers/dolib.a
+++ b/bin/ebuild-helpers/dolib.a
@@ -2,5 +2,4 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec env LIBOPTIONS=-m0644 \
-   dolib $@
+LIBOPTIONS='-m0644' exec dolib $@

diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
index 4bdbfab..eab8c91 100755
--- a/bin/ebuild-helpers/dolib.so
+++ b/bin/ebuild-helpers/dolib.so
@@ -2,5 +2,4 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec env LIBOPTIONS=-m0755 \
-   dolib $@
+LIBOPTIONS='-m0755' exec dolib $@



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, man/

2015-05-03 Thread Mike Frysinger
commit: 2b0ccc8c94bc07934c2f4b66054765003e26ee9f
Author: Mike Frysinger vapier AT gentoo DOT org
AuthorDate: Mon May  4 05:41:49 2015 +
Commit: Mike Frysinger vapier AT gentoo DOT org
CommitDate: Mon May  4 05:43:37 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2b0ccc8c

emake: refresh comments/docs/style

The comments for this code is woefully out of date.  The man page too
has not been updated in a long time to reflect the latest behavior.

 bin/ebuild-helpers/emake | 28 
 man/ebuild.5 | 22 +++---
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 4618053..2a3c2f0 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -1,19 +1,23 @@
 #!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 #
-# emake: Supplies some default parameters to GNU make. At the moment the
-#only parameter supplied is -jN, where N is a number of
-#parallel processes that should be ideal for the running host
-#(e.g. on a single-CPU machine, N=2).  The MAKEOPTS variable
-#is set in make.globals. We don't source make.globals
-#here because emake is only called from an ebuild.
+# emake: Run make and automatically pass along flags set in the env.  We 
support
+# MAKEOPTS  EXTRA_EMAKE which allows the user to customize behavior (such as
+# parallel builds and load limiting).  The latter overrides the ebuild and thus
+# should be used with caution (more a debugging knob).
+#
+# With newer EAPIs, we also automatically fail the build if make itself fails.
 
 source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
 
-if [[ $PORTAGE_QUIET != 1 ]] ; then
+cmd=(
+   ${MAKE:-make} ${MAKEOPTS} $@ ${EXTRA_EMAKE}
+)
+
+if [[ ${PORTAGE_QUIET} != 1 ]] ; then
(
-   for arg in ${MAKE:-make} $MAKEOPTS $@ $EXTRA_EMAKE ; do
+   for arg in ${cmd[@]} ; do
[[ ${arg} == * * ]] \
 printf '%s'  ${arg} \
|| printf %s  ${arg}
@@ -22,7 +26,7 @@ if [[ $PORTAGE_QUIET != 1 ]] ; then
) 2
 fi
 
-${MAKE:-make} ${MAKEOPTS} $@ ${EXTRA_EMAKE}
+${cmd[@]}
 ret=$?
-[[ $ret -ne 0 ]]  __helpers_die ${0##*/} failed
-exit $ret
+[[ ${ret} -ne 0 ]]  __helpers_die ${0##*/} failed
+exit ${ret}

diff --git a/man/ebuild.5 b/man/ebuild.5
index 7049f17..6a27cc5 100644
--- a/man/ebuild.5
+++ b/man/ebuild.5
@@ -1189,16 +1189,24 @@ string \fIdisable\-silent\-rules\fR occurs in the output
 of \fIconfigure \-\-help\fR.
 .TP
 .B emake\fR \fI[make options]
-This is used as a replacement for make.  Performs 'make ${MAKEOPTS}
-\fImake options\fR' (as set in make.globals), default is MAKEOPTS=\-j2.
+This must be used in place of `make` in ebuilds.  Performs `${MAKE:-make}
+${MAKEOPTS} \fImake options\fR ${EXTRA_EMAKE}`, and calls `die` automatically
+starting with \fBEAPI 4\fR.
+
+The \fBMAKEOPTS\fR variable is set by the user so they can enable features such
+as parallel builds; see \fBmake.conf\fR(5) for more details.
+
+The \fBEXTRA_EMAKE\fR knob is portage feature so developers can override things
+while debugging ebuilds; it is not part of any EAPI specification.
 
 .B ***WARNING***
 .br
-if you are going to use \fBemake\fR, make sure your build is happy with
-parallel makes (make \-j2).  It should be tested thoroughly as parallel
-makes are notorious for failing _sometimes_ but not always.  If you determine
-that your package fails to build in parallel, and you are unable to resolve
-the issue, then you should run '\fBemake\fR \-j1' instead of 'make'.
+You must make sure your build is happy with parallel makes (make \-j2).  It
+should be tested thoroughly as parallel makes are notorious for failing
+_sometimes_ but not always.  If you determine that your package fails to build
+in parallel, and you are unable to resolve the issue, then you should run
+`\fBemake\fR \-j1` explicitly.  This is a last resort however as it can
+significantly slow down builds on systems with lots of processors.
 
 .SS Install:
 .TP



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/unprivileged/, bin/ebuild-helpers/xattr/, bin/ebuild-helpers/, ...

2015-04-28 Thread Zac Medico
commit: b891bf13e47694eb1d36a34efb03d21c4b382669
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Mon Apr 27 20:26:35 2015 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Tue Apr 28 23:30:53 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b891bf13

ebuild-helpers: avoid exec loops or fork bombs in wrappers (bug 547086)

Since commit 130c01b9e561dd6ff7733a4905b21a0a921e9a22, extra portage
paths in PATH could trigger exec loops or fork bombs in wrappers.

Fixes: 130c01b9e561 (_doebuild_path: add fallback for temp PORTAGE_BIN_PATH 
(bug 547086))
X-Gentoo-Bug: 547086
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=547086
Acked-by: Brian Dolbec dolsen AT gentoo.org

 bin/ebuild-helpers/bsd/sed|  4 +++-
 bin/ebuild-helpers/portageq   |  4 +++-
 bin/ebuild-helpers/unprivileged/chown |  4 +++-
 bin/ebuild-helpers/xattr/install  | 14 +-
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/bin/ebuild-helpers/bsd/sed b/bin/ebuild-helpers/bsd/sed
index 01b8847..9a7f2d4 100755
--- a/bin/ebuild-helpers/bsd/sed
+++ b/bin/ebuild-helpers/bsd/sed
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 scriptpath=${BASH_SOURCE[0]}
@@ -15,6 +15,8 @@ else
 
for path in $PATH; do
if [[ -x ${path}/${scriptname} ]]; then
+   [[ ${path} == 
${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]]  continue
+   [[ ${path} == */._portage_reinstall_.* ]]  continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]]  
continue
exec ${path}/${scriptname} $@
exit 0

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index 4151bac..ba889eb 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2009-2013 Gentoo Foundation
+# Copyright 2009-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 scriptpath=${BASH_SOURCE[0]}
@@ -15,6 +15,8 @@ set -f # in case ${PATH} contains any shell glob characters
 
 for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
+   [[ ${path} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]]  
continue
+   [[ ${path} == */._portage_reinstall_.* ]]  continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]]  continue
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
exec ${PORTAGE_PYTHON:-/usr/bin/python} \

diff --git a/bin/ebuild-helpers/unprivileged/chown 
b/bin/ebuild-helpers/unprivileged/chown
index 08fa650..2f1f161 100755
--- a/bin/ebuild-helpers/unprivileged/chown
+++ b/bin/ebuild-helpers/unprivileged/chown
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2012-2013 Gentoo Foundation
+# Copyright 2012-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 scriptpath=${BASH_SOURCE[0]}
@@ -9,6 +9,8 @@ IFS=':'
 
 for path in ${PATH}; do
[[ -x ${path}/${scriptname} ]] || continue
+   [[ ${path} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]]  
continue
+   [[ ${path} == */._portage_reinstall_.* ]]  continue
[[ ${path}/${scriptname} -ef ${scriptpath} ]]  continue
IFS=$' \t\n'
output=$(${path}/${scriptname} $@ 21)

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index d572fe6..2d2a693 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2013 Gentoo Foundation
+# Copyright 2013-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
@@ -24,6 +24,18 @@ else
fi
 fi
 
+# Filter internal portage paths from PATH, in order to avoid
+# a possible exec loop or fork bomb (see bug 547086).
+IFS=':'
+set -f
+path=
+for x in ${PATH}; do
+   [[ ${x} == ${PORTAGE_OVERRIDE_EPREFIX}/usr/lib*/portage/* ]]  continue
+   [[ ${x} == */._portage_reinstall_.* ]]  continue
+   path+=:${x}
+done
+PATH=${path#:}
+
 if [[ ${implementation} == c ]]; then
exec ${INSTALL_XATTR} $@
 elif [[ ${implementation} == python ]]; then



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2014-12-04 Thread Michał Górny
commit: e3ea27ee19ddd849b1796360afc86d80946ab646
Author: Michał Górny mgorny AT gentoo DOT org
AuthorDate: Mon Dec  1 19:54:14 2014 +
Commit: Michał Górny mgorny AT gentoo DOT org
CommitDate: Thu Dec  4 14:01:35 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e3ea27ee

Deprecate dohtml for EAPI 6

---
 bin/eapi.sh   | 4 
 bin/ebuild-helpers/dohtml | 4 
 2 files changed, 8 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index b27b57c..7e7b54b 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -52,6 +52,10 @@ ___eapi_has_einstall() {
[[ ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_dohtml_deprecated() {
+   [[ ! ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_docompress() {
[[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]]
 }

diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index 75d3d00..0478e49 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -4,6 +4,10 @@
 
 source ${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
 
+if ___eapi_has_dohtml_deprecated; then
+   eqawarn '${0##*/}' is deprecated in EAPI '$EAPI'
+fi
+
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
 # Use safe cwd, avoiding unsafe import for bug #469338.



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/

2014-10-19 Thread Zac Medico
commit: 03cbe2762903601fe679ccd766456f6f6cba8ea2
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Sat Oct 11 04:32:54 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Sun Oct 19 17:32:23 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=03cbe276

bin/ebuild-helpers/portageq: fix bug #524964

Since commit 0cc4c1ac21a2ea94cfb1f6ff4b461a9e349d47df,
$PORTAGE_BIN_PATH/portageq no longer exists, which breaks
bin/ebuild-helpers/portageq. Note that has_version and best_version
rely on bin/ebuild-helpers/portageq if IPC is disabled, so breakage
extends beyond ebuilds that call portageq illegally. Since
$PORTAGE_BIN_PATH no longer works, use PATH to locate the real
portageq python script.

Fixes: 0cc4c1ac21a2 (Install Portage using setup.py)
X-Gento-Bug: 524964
X-Gentoo-URL: https://bugs.gentoo.org/show_bug.cgi?id=524964

---
 bin/ebuild-helpers/portageq | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
index b67b03f..4151bac 100755
--- a/bin/ebuild-helpers/portageq
+++ b/bin/ebuild-helpers/portageq
@@ -2,9 +2,25 @@
 # Copyright 2009-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+scriptpath=${BASH_SOURCE[0]}
+scriptname=${scriptpath##*/}
+
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
 # Use safe cwd, avoiding unsafe import for bug #469338.
 cd ${PORTAGE_PYM_PATH}
-PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-   exec ${PORTAGE_PYTHON:-/usr/bin/python} $PORTAGE_BIN_PATH/portageq 
$@
+
+IFS=':'
+set -f # in case ${PATH} contains any shell glob characters
+
+for path in ${PATH}; do
+   [[ -x ${path}/${scriptname} ]] || continue
+   [[ ${path}/${scriptname} -ef ${scriptpath} ]]  continue
+   PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
+   exec ${PORTAGE_PYTHON:-/usr/bin/python} \
+   ${path}/${scriptname} $@
+done
+
+unset IFS
+echo ${scriptname}: command not found 12
+exit 127



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2014-08-19 Thread Michał Górny
commit: 49ec4696f0d933957c75b8ecc0f775bc79c78010
Author: Sergei Trofimovich slyfox AT gentoo DOT org
AuthorDate: Thu Jul 24 22:11:47 2014 +
Commit: Michał Górny mgorny AT gentoo DOT org
CommitDate: Sat Aug  9 23:41:47 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=49ec4696

emake: pass EXTRA_EMAKE after user's $@, not before

Patch allows easier override or ebuild things, like
#foo-.ebuild:
src_compile() {
emake V=1
}

EXTRA_EMAKE=V=0 emerge =foo-

That way it's easier to eyeball upstream builds for new warnings.

This behaviour is more in line with EXTRA_ECONF variable.

Signed-off-by: Sergei Trofimovich slyfox AT gentoo.org

---
 bin/ebuild-helpers/emake | 4 ++--
 bin/phase-helpers.sh | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 69d836f..4618053 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -13,7 +13,7 @@ source 
${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
 
 if [[ $PORTAGE_QUIET != 1 ]] ; then
(
-   for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE $@ ; do
+   for arg in ${MAKE:-make} $MAKEOPTS $@ $EXTRA_EMAKE ; do
[[ ${arg} == * * ]] \
 printf '%s'  ${arg} \
|| printf %s  ${arg}
@@ -22,7 +22,7 @@ if [[ $PORTAGE_QUIET != 1 ]] ; then
) 2
 fi
 
-${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} $@
+${MAKE:-make} ${MAKEOPTS} $@ ${EXTRA_EMAKE}
 ret=$?
 [[ $ret -ne 0 ]]  __helpers_die ${0##*/} failed
 exit $ret

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 412decb..47bd843 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -617,8 +617,8 @@ einstall() {
mandir=${ED}usr/share/man \
sysconfdir=${ED}etc \
${LOCAL_EXTRA_EINSTALL} \
-   ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-   $@ install
+   ${MAKEOPTS} -j1 \
+   $@ ${EXTRA_EMAKE} install
fi
${MAKE:-make} prefix=${ED}usr \
datadir=${ED}usr/share \
@@ -627,8 +627,8 @@ einstall() {
mandir=${ED}usr/share/man \
sysconfdir=${ED}etc \
${LOCAL_EXTRA_EINSTALL} \
-   ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-   $@ install || die einstall failed
+   ${MAKEOPTS} -j1 \
+   $@ ${EXTRA_EMAKE} install || die einstall failed
else
die no Makefile found
fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, bin/

2014-08-09 Thread Brian Dolbec
commit: 49ec4696f0d933957c75b8ecc0f775bc79c78010
Author: Sergei Trofimovich slyfox AT gentoo DOT org
AuthorDate: Thu Jul 24 22:11:47 2014 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Sat Aug  9 23:41:47 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=49ec4696

emake: pass EXTRA_EMAKE after user's $@, not before

Patch allows easier override or ebuild things, like
#foo-.ebuild:
src_compile() {
emake V=1
}

EXTRA_EMAKE=V=0 emerge =foo-

That way it's easier to eyeball upstream builds for new warnings.

This behaviour is more in line with EXTRA_ECONF variable.

Signed-off-by: Sergei Trofimovich slyfox AT gentoo.org

---
 bin/ebuild-helpers/emake | 4 ++--
 bin/phase-helpers.sh | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
index 69d836f..4618053 100755
--- a/bin/ebuild-helpers/emake
+++ b/bin/ebuild-helpers/emake
@@ -13,7 +13,7 @@ source 
${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/isolated-functions.sh
 
 if [[ $PORTAGE_QUIET != 1 ]] ; then
(
-   for arg in ${MAKE:-make} $MAKEOPTS $EXTRA_EMAKE $@ ; do
+   for arg in ${MAKE:-make} $MAKEOPTS $@ $EXTRA_EMAKE ; do
[[ ${arg} == * * ]] \
 printf '%s'  ${arg} \
|| printf %s  ${arg}
@@ -22,7 +22,7 @@ if [[ $PORTAGE_QUIET != 1 ]] ; then
) 2
 fi
 
-${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} $@
+${MAKE:-make} ${MAKEOPTS} $@ ${EXTRA_EMAKE}
 ret=$?
 [[ $ret -ne 0 ]]  __helpers_die ${0##*/} failed
 exit $ret

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 412decb..47bd843 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -617,8 +617,8 @@ einstall() {
mandir=${ED}usr/share/man \
sysconfdir=${ED}etc \
${LOCAL_EXTRA_EINSTALL} \
-   ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-   $@ install
+   ${MAKEOPTS} -j1 \
+   $@ ${EXTRA_EMAKE} install
fi
${MAKE:-make} prefix=${ED}usr \
datadir=${ED}usr/share \
@@ -627,8 +627,8 @@ einstall() {
mandir=${ED}usr/share/man \
sysconfdir=${ED}etc \
${LOCAL_EXTRA_EINSTALL} \
-   ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
-   $@ install || die einstall failed
+   ${MAKEOPTS} -j1 \
+   $@ ${EXTRA_EMAKE} install || die einstall failed
else
die no Makefile found
fi



[gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/xattr/

2014-06-17 Thread Brian Dolbec
commit: 9089c2d755b0ecb1b340fc23dda461163f589c43
Author: Anthony G. Basile blueness AT gentoo DOT org
AuthorDate: Sat May 31 23:15:20 2014 +
Commit: Brian Dolbec brian.dolbec AT gmail DOT com
CommitDate: Tue Jun 17 18:49:37 2014 +
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9089c2d7

ebuild-helpers/xattr/install: use install-xattr

Currently bin/ebuild-helpers/xattr/install uses ${PORTAGE_BIN_PATH}/install.py
as a wrapper to coreutils' install to preserve a file's extended attributes when
installing, usually during src_install().  This is needed, for instance, when
preserving xattr based PaX flags, bug #465000.  However the python wrapper is
very slow, comment #42 of bug #465000.  A C wrapper was developed and tested,
bugs #501534 and #511984.  This patch checks for the existence of the C wrapper,
and uses it, falling back on the python wrapper only if not found, or if over-
ridden by ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION}.

---
 bin/ebuild-helpers/xattr/install | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index f51f621..d572fe6 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -4,9 +4,32 @@
 
 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
+INSTALL_XATTR=${EPREFIX}/usr/bin/install-xattr
 # Use safe cwd, avoiding unsafe import for bug #469338.
 export __PORTAGE_HELPER_CWD=${PWD}
 cd ${PORTAGE_PYM_PATH}
 export __PORTAGE_HELPER_PATH=${BASH_SOURCE[0]}
-PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
-   exec ${PORTAGE_PYTHON:-/usr/bin/python} 
${PORTAGE_BIN_PATH}/install.py $@
+
+if [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == c ]]; then
+   implementation=c
+elif [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == python ]]; then
+   implementation=python
+else
+   # If PORTAGE_INSTALL_XATTR_IMPLEMENTATION is unset or not set to c or 
python
+   # then we'll autodetect, preferring c but falling back on python
+   if [[ -x ${INSTALL_XATTR} ]]; then
+   implementation=c
+   else
+   implementation=python
+   fi
+fi
+
+if [[ ${implementation} == c ]]; then
+   exec ${INSTALL_XATTR} $@
+elif [[ ${implementation} == python ]]; then
+   PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
+   exec ${PORTAGE_PYTHON:-/usr/bin/python} 
${PORTAGE_BIN_PATH}/install.py $@
+else
+   echo Unknown implementation for PORTAGE_INSTALL_XATTR_IMPLEMENTATION
+   exit -1
+fi