public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] ebuild: Extend helper-in-global-scope ban to all EAPIs
@ 2016-05-05 21:10 Michał Górny
  2016-05-06 13:14 ` Alexander Berntsen
  2016-05-20 22:27 ` Michał Górny
  0 siblings, 2 replies; 6+ messages in thread
From: Michał Górny @ 2016-05-05 21:10 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Make helper calls in global scope fatal in all supported EAPIs since
this is the behavior required by PMS and all major offenders are fixed
already.
---
 bin/eapi.sh   |  4 ----
 bin/ebuild.sh | 30 ++++++------------------------
 2 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index cd3e1a4..a9c56b8 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -166,10 +166,6 @@ ___eapi_helpers_can_die() {
 	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
 }
 
-___eapi_disallows_helpers_in_global_scope() {
-	[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5|5-hdepend)$ ]]
-}
-
 ___eapi_unpack_is_case_sensitive() {
 	[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
 }
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index f1586b2..5b3146d 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -59,34 +59,16 @@ 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.
-	for x in diropts docompress exeopts get_KV insopts \
-		KV_major KV_micro KV_minor KV_to_int \
-		libopts register_die_hook register_success_hook \
-		__strip_duplicate_slashes \
-		use_with use_enable ; do
-		eval "${x}() {
-			if ___eapi_disallows_helpers_in_global_scope; then
-				die \"\${FUNCNAME}() calls are not allowed in global scope\"
-			fi
-		}"
-	done
-	# These dummy functions return false in non-strict EAPIs, in order to ensure that
-	# `use multislot` is false for the "depend" phase.
-	funcs="use useq usev"
+	funcs="diropts docompress exeopts get_KV insopts
+		KV_major KV_micro KV_minor KV_to_int
+		libopts register_die_hook register_success_hook
+		__strip_duplicate_slashes
+		use useq usev use_with use_enable"
 	___eapi_has_usex && funcs+=" usex"
 	___eapi_has_in_iuse && funcs+=" in_iuse"
-	for x in ${funcs} ; do
-		eval "${x}() {
-			if ___eapi_disallows_helpers_in_global_scope; then
-				die \"\${FUNCNAME}() calls are not allowed in global scope\"
-			else
-				return 1
-			fi
-		}"
-	done
 	# These functions die because calls to them during the "depend" phase
 	# are considered to be severe QA violations.
-	funcs="best_version has_version portageq"
+	funcs+=" best_version has_version portageq"
 	___eapi_has_master_repositories && funcs+=" master_repositories"
 	___eapi_has_repository_path && funcs+=" repository_path"
 	___eapi_has_available_eclasses && funcs+=" available_eclasses"
-- 
2.8.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-27  5:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-05 21:10 [gentoo-portage-dev] [PATCH] ebuild: Extend helper-in-global-scope ban to all EAPIs Michał Górny
2016-05-06 13:14 ` Alexander Berntsen
2016-05-06 16:52   ` Zac Medico
2016-05-20 22:27 ` Michał Górny
2016-06-27  0:07   ` Zac Medico
2016-06-27  5:13     ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox