Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>, Mike Frysinger <vapier@g.o>
Subject: [gentoo-portage-dev] [PATCH 7/7] Add dostrip for EAPI 7
Date: Sun, 25 Mar 2018 20:32:45
Message-Id: 20180325202826.7827-8-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 0/7] Add dostrip for EAPI 7 by Zac Medico
1 From: Michał Górny <mgorny@g.o>
2
3 Bug: https://bugs.gentoo.org/203891
4 Closes: https://github.com/mgorny/portage/issues/8
5 ---
6 bin/eapi.sh | 4 ++++
7 bin/ebuild.sh | 2 +-
8 bin/phase-helpers.sh | 26 ++++++++++++++++++++++++++
9 bin/save-ebuild-env.sh | 2 +-
10 4 files changed, 32 insertions(+), 2 deletions(-)
11
12 diff --git a/bin/eapi.sh b/bin/eapi.sh
13 index 326eb387e..1445c3ec7 100644
14 --- a/bin/eapi.sh
15 +++ b/bin/eapi.sh
16 @@ -76,6 +76,10 @@ ___eapi_has_docompress() {
17 [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
18 }
19
20 +___eapi_has_dostrip() {
21 + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|5|6)$ ]]
22 +}
23 +
24 ___eapi_has_nonfatal() {
25 [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]]
26 }
27 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
28 index 061b1aff4..11441bfb2 100755
29 --- a/bin/ebuild.sh
30 +++ b/bin/ebuild.sh
31 @@ -59,7 +59,7 @@ else
32 # These dummy functions are for things that are likely to be called
33 # in global scope, even though they are completely useless during
34 # the "depend" phase.
35 - funcs="diropts docompress exeopts get_KV insopts
36 + funcs="diropts docompress dostrip exeopts get_KV insopts
37 KV_major KV_micro KV_minor KV_to_int
38 libopts register_die_hook register_success_hook
39 __strip_duplicate_slashes
40 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
41 index 020a49592..556d089b5 100644
42 --- a/bin/phase-helpers.sh
43 +++ b/bin/phase-helpers.sh
44 @@ -163,6 +163,32 @@ docompress() {
45 fi
46 }
47
48 +dostrip() {
49 + ___eapi_has_dostrip || die "'${FUNCNAME}' not supported in this EAPI"
50 +
51 + local f g
52 + if [[ $1 = "-x" ]]; then
53 + shift
54 + for f; do
55 + f=$(__strip_duplicate_slashes "${f}"); f=${f%/}
56 + [[ ${f:0:1} = / ]] || f="/${f}"
57 + for g in "${PORTAGE_DOSTRIP_SKIP[@]}"; do
58 + [[ ${f} = "${g}" ]] && continue 2
59 + done
60 + PORTAGE_DOSTRIP_SKIP+=( "${f}" )
61 + done
62 + else
63 + for f; do
64 + f=$(__strip_duplicate_slashes "${f}"); f=${f%/}
65 + [[ ${f:0:1} = / ]] || f="/${f}"
66 + for g in "${PORTAGE_DOSTRIP[@]}"; do
67 + [[ ${f} = "${g}" ]] && continue 2
68 + done
69 + PORTAGE_DOSTRIP+=( "${f}" )
70 + done
71 + fi
72 +}
73 +
74 useq() {
75 has $EBUILD_PHASE prerm postrm || eqawarn \
76 "QA Notice: The 'useq' function is deprecated (replaced by 'use')"
77 diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
78 index f624f44ec..947ac79d5 100644
79 --- a/bin/save-ebuild-env.sh
80 +++ b/bin/save-ebuild-env.sh
81 @@ -60,7 +60,7 @@ __save_ebuild_env() {
82 unpack __strip_duplicate_slashes econf einstall \
83 __dyn_setup __dyn_unpack __dyn_clean \
84 into insinto exeinto docinto \
85 - insopts diropts exeopts libopts docompress \
86 + insopts diropts exeopts libopts docompress dostrip \
87 __abort_handler __abort_prepare __abort_configure __abort_compile \
88 __abort_test __abort_install __dyn_prepare __dyn_configure \
89 __dyn_compile __dyn_test __dyn_install \
90 --
91 2.13.6