Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] ebuild: Extend helper-in-global-scope ban to all EAPIs
Date: Thu, 05 May 2016 21:10:55
Message-Id: 1462482644-13455-1-git-send-email-mgorny@gentoo.org
1 Make helper calls in global scope fatal in all supported EAPIs since
2 this is the behavior required by PMS and all major offenders are fixed
3 already.
4 ---
5 bin/eapi.sh | 4 ----
6 bin/ebuild.sh | 30 ++++++------------------------
7 2 files changed, 6 insertions(+), 28 deletions(-)
8
9 diff --git a/bin/eapi.sh b/bin/eapi.sh
10 index cd3e1a4..a9c56b8 100644
11 --- a/bin/eapi.sh
12 +++ b/bin/eapi.sh
13 @@ -166,10 +166,6 @@ ___eapi_helpers_can_die() {
14 [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
15 }
16
17 -___eapi_disallows_helpers_in_global_scope() {
18 - [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5|5-hdepend)$ ]]
19 -}
20 -
21 ___eapi_unpack_is_case_sensitive() {
22 [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
23 }
24 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
25 index f1586b2..5b3146d 100755
26 --- a/bin/ebuild.sh
27 +++ b/bin/ebuild.sh
28 @@ -59,34 +59,16 @@ else
29 # These dummy functions are for things that are likely to be called
30 # in global scope, even though they are completely useless during
31 # the "depend" phase.
32 - for x in diropts docompress exeopts get_KV insopts \
33 - KV_major KV_micro KV_minor KV_to_int \
34 - libopts register_die_hook register_success_hook \
35 - __strip_duplicate_slashes \
36 - use_with use_enable ; do
37 - eval "${x}() {
38 - if ___eapi_disallows_helpers_in_global_scope; then
39 - die \"\${FUNCNAME}() calls are not allowed in global scope\"
40 - fi
41 - }"
42 - done
43 - # These dummy functions return false in non-strict EAPIs, in order to ensure that
44 - # `use multislot` is false for the "depend" phase.
45 - funcs="use useq usev"
46 + funcs="diropts docompress exeopts get_KV insopts
47 + KV_major KV_micro KV_minor KV_to_int
48 + libopts register_die_hook register_success_hook
49 + __strip_duplicate_slashes
50 + use useq usev use_with use_enable"
51 ___eapi_has_usex && funcs+=" usex"
52 ___eapi_has_in_iuse && funcs+=" in_iuse"
53 - for x in ${funcs} ; do
54 - eval "${x}() {
55 - if ___eapi_disallows_helpers_in_global_scope; then
56 - die \"\${FUNCNAME}() calls are not allowed in global scope\"
57 - else
58 - return 1
59 - fi
60 - }"
61 - done
62 # These functions die because calls to them during the "depend" phase
63 # are considered to be severe QA violations.
64 - funcs="best_version has_version portageq"
65 + funcs+=" best_version has_version portageq"
66 ___eapi_has_master_repositories && funcs+=" master_repositories"
67 ___eapi_has_repository_path && funcs+=" repository_path"
68 ___eapi_has_available_eclasses && funcs+=" available_eclasses"
69 --
70 2.8.2

Replies