1 |
--- |
2 |
bin/isolated-functions.sh | 11 ++++-- |
3 |
bin/phase-helpers.sh | 87 ++++++++++++++++++++++++++++++++++------------- |
4 |
2 files changed, 73 insertions(+), 25 deletions(-) |
5 |
|
6 |
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh |
7 |
index 6f6d669..f320084 100644 |
8 |
--- a/bin/isolated-functions.sh |
9 |
+++ b/bin/isolated-functions.sh |
10 |
@@ -36,11 +36,18 @@ __assert_sigpipe_ok() { |
11 |
local x pipestatus=${PIPESTATUS[*]} |
12 |
for x in $pipestatus ; do |
13 |
# Allow SIGPIPE through (128 + 13) |
14 |
- [[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] && die "$@" |
15 |
+ if [[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] |
16 |
+ then |
17 |
+ __helpers_die "$@" |
18 |
+ return 1 |
19 |
+ fi |
20 |
done |
21 |
|
22 |
# Require normal success for the last process (tar). |
23 |
- [[ $x -eq 0 ]] || die "$@" |
24 |
+ if [[ $x -eq 0 ]]; then |
25 |
+ __helpers_die "$@" |
26 |
+ return 1 |
27 |
+ fi |
28 |
} |
29 |
|
30 |
shopt -s extdebug |
31 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
32 |
index 5f7c809..3e63b11 100644 |
33 |
--- a/bin/phase-helpers.sh |
34 |
+++ b/bin/phase-helpers.sh |
35 |
@@ -285,7 +285,10 @@ unpack() { |
36 |
else |
37 |
srcdir="${DISTDIR}/" |
38 |
fi |
39 |
- [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" |
40 |
+ if [[ ! -s ${srcdir}${x} ]]; then |
41 |
+ __helpers_die "unpack: ${x} does not exist" |
42 |
+ return 1 |
43 |
+ fi |
44 |
|
45 |
__unpack_tar() { |
46 |
if [[ ${y_insensitive} == tar ]] ; then |
47 |
@@ -296,15 +299,18 @@ unpack() { |
48 |
"supported with EAPI '${EAPI}'. Instead use 'tar'." |
49 |
fi |
50 |
$1 -c -- "$srcdir$x" | tar xof - |
51 |
- __assert_sigpipe_ok "$myfail" |
52 |
+ __assert_sigpipe_ok "$myfail" || return 1 |
53 |
else |
54 |
local cwd_dest=${x##*/} |
55 |
cwd_dest=${cwd_dest%.*} |
56 |
- $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail" |
57 |
+ if ! $1 -c -- "${srcdir}${x}" > "${cwd_dest}"; then |
58 |
+ __helpers_die "$myfail" |
59 |
+ return 1 |
60 |
+ fi |
61 |
fi |
62 |
} |
63 |
|
64 |
- myfail="failure unpacking ${x}" |
65 |
+ myfail="unpack: failure unpacking ${x}" |
66 |
case "${suffix_insensitive}" in |
67 |
tar) |
68 |
if ___eapi_unpack_is_case_sensitive && \ |
69 |
@@ -313,7 +319,10 @@ unpack() { |
70 |
"suffix '${suffix}' which is unofficially supported" \ |
71 |
"with EAPI '${EAPI}'. Instead use 'tar'." |
72 |
fi |
73 |
- tar xof "$srcdir$x" || die "$myfail" |
74 |
+ if ! tar xof "$srcdir$x"; then |
75 |
+ __helpers_die "$myfail" |
76 |
+ return 1 |
77 |
+ fi |
78 |
;; |
79 |
tgz) |
80 |
if ___eapi_unpack_is_case_sensitive && \ |
81 |
@@ -322,7 +331,10 @@ unpack() { |
82 |
"suffix '${suffix}' which is unofficially supported" \ |
83 |
"with EAPI '${EAPI}'. Instead use 'tgz'." |
84 |
fi |
85 |
- tar xozf "$srcdir$x" || die "$myfail" |
86 |
+ if ! tar xozf "$srcdir$x"; then |
87 |
+ __helpers_die "$myfail" |
88 |
+ return 1 |
89 |
+ fi |
90 |
;; |
91 |
tbz|tbz2) |
92 |
if ___eapi_unpack_is_case_sensitive && \ |
93 |
@@ -332,7 +344,7 @@ unpack() { |
94 |
"with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'." |
95 |
fi |
96 |
${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - |
97 |
- __assert_sigpipe_ok "$myfail" |
98 |
+ __assert_sigpipe_ok "$myfail" || return 1 |
99 |
;; |
100 |
zip|jar) |
101 |
if ___eapi_unpack_is_case_sensitive && \ |
102 |
@@ -344,8 +356,10 @@ unpack() { |
103 |
fi |
104 |
# unzip will interactively prompt under some error conditions, |
105 |
# as reported in bug #336285 |
106 |
- ( set +x ; while true ; do echo n || break ; done ) | \ |
107 |
- unzip -qo "${srcdir}${x}" || die "$myfail" |
108 |
+ if ! unzip -qo "${srcdir}${x}"; then |
109 |
+ __helpers_die "$myfail" |
110 |
+ return 1 |
111 |
+ fi < <(set +x ; while true ; do echo n || break ; done) |
112 |
;; |
113 |
gz|z) |
114 |
if ___eapi_unpack_is_case_sensitive && \ |
115 |
@@ -354,7 +368,7 @@ unpack() { |
116 |
"suffix '${suffix}' which is unofficially supported" \ |
117 |
"with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'." |
118 |
fi |
119 |
- __unpack_tar "gzip -d" |
120 |
+ __unpack_tar "gzip -d" || return 1 |
121 |
;; |
122 |
bz2|bz) |
123 |
if ___eapi_unpack_is_case_sensitive && \ |
124 |
@@ -363,7 +377,8 @@ unpack() { |
125 |
"suffix '${suffix}' which is unofficially supported" \ |
126 |
"with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'." |
127 |
fi |
128 |
- __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" |
129 |
+ __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \ |
130 |
+ || return 1 |
131 |
;; |
132 |
7z) |
133 |
local my_output |
134 |
@@ -380,7 +395,10 @@ unpack() { |
135 |
"suffix '${suffix}' which is unofficially supported" \ |
136 |
"with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'." |
137 |
fi |
138 |
- unrar x -idq -o+ "${srcdir}${x}" || die "$myfail" |
139 |
+ if ! unrar x -idq -o+ "${srcdir}${x}"; then |
140 |
+ __helpers_die "$myfail" |
141 |
+ return 1 |
142 |
+ fi |
143 |
;; |
144 |
lha|lzh) |
145 |
if ___eapi_unpack_is_case_sensitive && \ |
146 |
@@ -390,7 +408,10 @@ unpack() { |
147 |
"with EAPI '${EAPI}'." \ |
148 |
"Instead use 'LHA', 'LHa', 'lha', or 'lzh'." |
149 |
fi |
150 |
- lha xfq "${srcdir}${x}" || die "$myfail" |
151 |
+ if ! lha xfq "${srcdir}${x}"; then |
152 |
+ __helpers_die "$myfail" |
153 |
+ return 1 |
154 |
+ fi |
155 |
;; |
156 |
a) |
157 |
if ___eapi_unpack_is_case_sensitive && \ |
158 |
@@ -399,7 +420,10 @@ unpack() { |
159 |
"suffix '${suffix}' which is unofficially supported" \ |
160 |
"with EAPI '${EAPI}'. Instead use 'a'." |
161 |
fi |
162 |
- ar x "${srcdir}${x}" || die "$myfail" |
163 |
+ if ! ar x "${srcdir}${x}"; then |
164 |
+ __helpers_die "$myfail" |
165 |
+ return 1 |
166 |
+ fi |
167 |
;; |
168 |
deb) |
169 |
if ___eapi_unpack_is_case_sensitive && \ |
170 |
@@ -420,18 +444,30 @@ unpack() { |
171 |
# deb2targz always extracts into the same directory as |
172 |
# the source file, so create a symlink in the current |
173 |
# working directory if necessary. |
174 |
- ln -sf "$srcdir$x" "$y" || die "$myfail" |
175 |
+ if ! ln -sf "$srcdir$x" "$y"; then |
176 |
+ __helpers_die "$myfail" |
177 |
+ return 1 |
178 |
+ fi |
179 |
created_symlink=1 |
180 |
fi |
181 |
- deb2targz "$y" || die "$myfail" |
182 |
+ if ! deb2targz "$y"; then |
183 |
+ __helpers_die "$myfail" |
184 |
+ return 1 |
185 |
+ fi |
186 |
if [ $created_symlink = 1 ] ; then |
187 |
# Clean up the symlink so the ebuild |
188 |
# doesn't inadvertently install it. |
189 |
rm -f "$y" |
190 |
fi |
191 |
- mv -f "${y%.deb}".tar.gz data.tar.gz || die "$myfail" |
192 |
+ if ! mv -f "${y%.deb}".tar.gz data.tar.gz; then |
193 |
+ __helpers_die "$myfail" |
194 |
+ return 1 |
195 |
+ fi |
196 |
else |
197 |
- ar x "$srcdir$x" || die "$myfail" |
198 |
+ if ! ar x "$srcdir$x"; then |
199 |
+ __helpers_die "$myfail" |
200 |
+ return 1 |
201 |
+ fi |
202 |
fi |
203 |
;; |
204 |
lzma) |
205 |
@@ -441,7 +477,7 @@ unpack() { |
206 |
"suffix '${suffix}' which is unofficially supported" \ |
207 |
"with EAPI '${EAPI}'. Instead use 'lzma'." |
208 |
fi |
209 |
- __unpack_tar "lzma -d" |
210 |
+ __unpack_tar "lzma -d" || return 1 |
211 |
;; |
212 |
xz) |
213 |
if ___eapi_unpack_is_case_sensitive && \ |
214 |
@@ -451,7 +487,7 @@ unpack() { |
215 |
"with EAPI '${EAPI}'. Instead use 'xz'." |
216 |
fi |
217 |
if ___eapi_unpack_supports_xz; then |
218 |
- __unpack_tar "xz -d" |
219 |
+ __unpack_tar "xz -d" || return 1 |
220 |
else |
221 |
__vecho "unpack ${x}: file format not recognized. Ignoring." |
222 |
fi |
223 |
@@ -581,7 +617,8 @@ econf() { |
224 |
echo "!!! Please attach the following file when seeking support:" |
225 |
echo "!!! ${PWD}/config.log" |
226 |
fi |
227 |
- die "econf failed" |
228 |
+ __helpers_die "econf failed" |
229 |
+ return 1 |
230 |
fi |
231 |
elif [ -f "${ECONF_SOURCE}/configure" ]; then |
232 |
die "configure is not executable" |
233 |
@@ -620,7 +657,7 @@ einstall() { |
234 |
${MAKEOPTS} -j1 \ |
235 |
"$@" ${EXTRA_EMAKE} install |
236 |
fi |
237 |
- ${MAKE:-make} prefix="${ED}usr" \ |
238 |
+ if ! ${MAKE:-make} prefix="${ED}usr" \ |
239 |
datadir="${ED}usr/share" \ |
240 |
infodir="${ED}usr/share/info" \ |
241 |
localstatedir="${ED}var/lib" \ |
242 |
@@ -628,7 +665,11 @@ einstall() { |
243 |
sysconfdir="${ED}etc" \ |
244 |
${LOCAL_EXTRA_EINSTALL} \ |
245 |
${MAKEOPTS} -j1 \ |
246 |
- "$@" ${EXTRA_EMAKE} install || die "einstall failed" |
247 |
+ "$@" ${EXTRA_EMAKE} install |
248 |
+ then |
249 |
+ __helpers_die "einstall failed" |
250 |
+ return 1 |
251 |
+ fi |
252 |
else |
253 |
die "no Makefile found" |
254 |
fi |
255 |
-- |
256 |
2.1.3 |