commit:     2f1c3a0e7e0e5b6d61ede0c5328ea8010881f9b5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 22 21:49:29 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Sep 17 06:45:13 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f1c3a0e

Ban prepall in ebuild scope

Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ebuild-helpers/prepall | 28 ++--------------------------
 bin/misc-functions.sh      | 27 ++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
index 87e1ca20c..e23a6d410 100755
--- a/bin/ebuild-helpers/prepall
+++ b/bin/ebuild-helpers/prepall
@@ -4,29 +4,5 @@
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-if ! ___eapi_has_prefix_variables; then
-       ED=${D}
-fi
-
-if has chflags $FEATURES ; then
-       # Save all the file flags for restoration at the end of prepall.
-       mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
-       # Remove all the file flags so that prepall can do anything necessary.
-       chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
-       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
-
-if has chflags $FEATURES ; then
-       # Restore all the file flags that were saved at the beginning of 
prepall.
-       mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
-fi
+die "'${0##*/}' is not allowed in ebuild scope"
+exit 1

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 34492e086..d25bc8498 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -162,6 +162,31 @@ prepcompress() {
        return 0
 }
 
+__prepall() {
+       if has chflags $FEATURES ; then
+               # Save all the file flags for restoration at the end of prepall.
+               mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
+               # Remove all the file flags so that prepall can do anything 
necessary.
+               chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+               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
+
+       if has chflags $FEATURES ; then
+               # Restore all the file flags that were saved at the beginning 
of prepall.
+               mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> 
/dev/null
+       fi
+}
+
 install_qa_check() {
        local d f i qa_var x paths qa_checks=() checks_run=()
        if ! ___eapi_has_prefix_variables; then
@@ -219,7 +244,7 @@ install_qa_check() {
        done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
 
        export STRIP_MASK
-       prepall
+       __prepall
        ___eapi_has_docompress && prepcompress
        ecompressdir --dequeue
        ecompress --dequeue

Reply via email to