Bug: https://bugs.gentoo.org/630416
---
 bin/eapi.sh                 | 4 ++++
 bin/ebuild-helpers/dolib    | 7 ++++++-
 bin/ebuild-helpers/dolib.a  | 4 ++--
 bin/ebuild-helpers/dolib.so | 4 ++--
 bin/phase-helpers.sh        | 6 +++++-
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 964e19d7d..b8b493f45 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -60,6 +60,10 @@ ___eapi_has_dohtml_deprecated() {
        [[ ${1-${EAPI-0}} == 6 ]]
 }
 
+___eapi_has_dolib_libopts() {
+       [[ ${1-${EAPI-0}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress|6)$ ]]
+}
+
 ___eapi_has_docompress() {
        [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }
diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
index a11bad463..62e04b385 100755
--- a/bin/ebuild-helpers/dolib
+++ b/bin/ebuild-helpers/dolib
@@ -1,9 +1,14 @@
 #!/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
 
+if [[ -z ${PORTAGE_INTERNAL_DOLIB} ]] && ! ___eapi_has_dolib_libopts; then
+       die "'${0##*/}' has been banned for EAPI '$EAPI'"
+       exit 1
+fi
+
 if ! ___eapi_has_prefix_variables; then
        ED=${D}
 fi
diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
index 61961e4ed..5ea126b5d 100755
--- a/bin/ebuild-helpers/dolib.a
+++ b/bin/ebuild-helpers/dolib.a
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-LIBOPTIONS='-m0644' exec dolib "$@"
+LIBOPTIONS='-m0644' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"
diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
index eab8c9110..a3b579e5e 100755
--- a/bin/ebuild-helpers/dolib.so
+++ b/bin/ebuild-helpers/dolib.so
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-LIBOPTIONS='-m0755' exec dolib "$@"
+LIBOPTIONS='-m0755' PORTAGE_INTERNAL_DOLIB=1 exec dolib "$@"
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 49dad234d..12ccf6716 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 export DESTTREE=/usr
@@ -111,6 +111,10 @@ exeopts() {
 }
 
 libopts() {
+       if ! ___eapi_has_dolib_libopts; then
+               die "'${FUNCNAME}' has been banned for EAPI '$EAPI'"
+       fi
+
        export LIBOPTIONS="$@"
 
        # `install` should never be called with '-s' ...
-- 
2.16.2


Reply via email to