Lines 278-284
unpack() {
Link Here
|
278 |
local y |
278 |
local y |
279 |
local myfail |
279 |
local myfail |
280 |
local eapi=${EAPI:-0} |
280 |
local eapi=${EAPI:-0} |
281 |
[ -z "$*" ] && die "Nothing passed to the 'unpack' command" |
281 |
[ -z "$*" ] && { __helpers_die "Nothing passed to the 'unpack' command" ; return 1 ; } |
282 |
|
282 |
|
283 |
for x in "$@"; do |
283 |
for x in "$@"; do |
284 |
__vecho ">>> Unpacking ${x} to ${PWD}" |
284 |
__vecho ">>> Unpacking ${x} to ${PWD}" |
Lines 288-352
unpack() {
Link Here
|
288 |
if [[ ${x} == "./"* ]] ; then |
288 |
if [[ ${x} == "./"* ]] ; then |
289 |
srcdir="" |
289 |
srcdir="" |
290 |
elif [[ ${x} == ${DISTDIR%/}/* ]] ; then |
290 |
elif [[ ${x} == ${DISTDIR%/}/* ]] ; then |
291 |
die "Arguments to unpack() cannot begin with \${DISTDIR}." |
291 |
__helpers_die "Arguments to unpack() cannot begin with \${DISTDIR}." |
|
|
292 |
return 1 |
292 |
elif [[ ${x} == "/"* ]] ; then |
293 |
elif [[ ${x} == "/"* ]] ; then |
293 |
die "Arguments to unpack() cannot be absolute" |
294 |
__helpers_die "Arguments to unpack() cannot be absolute" |
|
|
295 |
return 1 |
294 |
else |
296 |
else |
295 |
srcdir="${DISTDIR}/" |
297 |
srcdir="${DISTDIR}/" |
296 |
fi |
298 |
fi |
297 |
[[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" |
299 |
[[ -s ${srcdir}${x} ]] || __helpers_die "${x} does not exist" || return 1 |
298 |
|
300 |
|
299 |
__unpack_tar() { |
301 |
__unpack_tar() { |
300 |
if [ "${y}" == "tar" ]; then |
302 |
if [ "${y}" == "tar" ]; then |
301 |
$1 -c -- "$srcdir$x" | tar xof - |
303 |
$1 -c -- "$srcdir$x" | tar xof - |
302 |
__assert_sigpipe_ok "$myfail" |
304 |
__helpers_assert_sigpipe_ok "$myfail" || return $? |
303 |
else |
305 |
else |
304 |
local cwd_dest=${x##*/} |
306 |
local cwd_dest=${x##*/} |
305 |
cwd_dest=${cwd_dest%.*} |
307 |
cwd_dest=${cwd_dest%.*} |
306 |
$1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail" |
308 |
$1 -c -- "${srcdir}${x}" > "${cwd_dest}" || \ |
|
|
309 |
__helpers_die "$myfail" || return $? |
307 |
fi |
310 |
fi |
308 |
} |
311 |
} |
309 |
|
312 |
|
310 |
myfail="failure unpacking ${x}" |
313 |
myfail="failure unpacking ${x}" |
311 |
case "${x##*.}" in |
314 |
case "${x##*.}" in |
312 |
tar) |
315 |
tar) |
313 |
tar xof "$srcdir$x" || die "$myfail" |
316 |
tar xof "$srcdir$x" || __helpers_die "$myfail" || return $? |
314 |
;; |
317 |
;; |
315 |
tgz) |
318 |
tgz) |
316 |
tar xozf "$srcdir$x" || die "$myfail" |
319 |
tar xozf "$srcdir$x" || __helpers_die "$myfail" || return $? |
317 |
;; |
320 |
;; |
318 |
tbz|tbz2) |
321 |
tbz|tbz2) |
319 |
${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - |
322 |
${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - |
320 |
__assert_sigpipe_ok "$myfail" |
323 |
__helpers_assert_sigpipe_ok "$myfail" || return $? |
321 |
;; |
324 |
;; |
322 |
ZIP|zip|jar) |
325 |
ZIP|zip|jar) |
323 |
# unzip will interactively prompt under some error conditions, |
326 |
# unzip will interactively prompt under some error conditions, |
324 |
# as reported in bug #336285 |
327 |
# as reported in bug #336285 |
325 |
( set +x ; while true ; do echo n || break ; done ) | \ |
328 |
( set +x ; while true ; do echo n || break ; done ) | \ |
326 |
unzip -qo "${srcdir}${x}" || die "$myfail" |
329 |
unzip -qo "${srcdir}${x}" |
|
|
330 |
__helpers_assert_sigpipe_ok "$myfail" || return $? |
327 |
;; |
331 |
;; |
328 |
gz|Z|z) |
332 |
gz|Z|z) |
329 |
__unpack_tar "gzip -d" |
333 |
__unpack_tar "gzip -d" || return $? |
330 |
;; |
334 |
;; |
331 |
bz2|bz) |
335 |
bz2|bz) |
332 |
__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" |
336 |
__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" || \ |
|
|
337 |
return $? |
333 |
;; |
338 |
;; |
334 |
7Z|7z) |
339 |
7Z|7z) |
335 |
local my_output |
340 |
local my_output |
336 |
my_output="$(7z x -y "${srcdir}${x}")" |
341 |
my_output="$(7z x -y "${srcdir}${x}")" |
337 |
if [ $? -ne 0 ]; then |
342 |
if [ $? -ne 0 ]; then |
338 |
echo "${my_output}" >&2 |
343 |
echo "${my_output}" >&2 |
339 |
die "$myfail" |
344 |
__helpers_die "${myfail}" || return $? |
340 |
fi |
345 |
fi |
341 |
;; |
346 |
;; |
342 |
RAR|rar) |
347 |
RAR|rar) |
343 |
unrar x -idq -o+ "${srcdir}${x}" || die "$myfail" |
348 |
unrar x -idq -o+ "${srcdir}${x}" || \ |
|
|
349 |
__helpers_die "${myfail}" || return $? |
344 |
;; |
350 |
;; |
345 |
LHa|LHA|lha|lzh) |
351 |
LHa|LHA|lha|lzh) |
346 |
lha xfq "${srcdir}${x}" || die "$myfail" |
352 |
lha xfq "${srcdir}${x}" || \ |
|
|
353 |
__helpers_die "${myfail}" || return $? |
347 |
;; |
354 |
;; |
348 |
a) |
355 |
a) |
349 |
ar x "${srcdir}${x}" || die "$myfail" |
356 |
ar x "${srcdir}${x}" || \ |
|
|
357 |
__helpers_die "${myfail}" || return $? |
350 |
;; |
358 |
;; |
351 |
deb) |
359 |
deb) |
352 |
# Unpacking .deb archives can not always be done with |
360 |
# Unpacking .deb archives can not always be done with |
Lines 356-386
unpack() {
Link Here
|
356 |
# installed. |
364 |
# installed. |
357 |
if type -P deb2targz > /dev/null; then |
365 |
if type -P deb2targz > /dev/null; then |
358 |
y=${x##*/} |
366 |
y=${x##*/} |
359 |
local created_symlink=0 |
367 |
if [ ! "${srcdir}${x}" -ef "${y}" ] ; then |
360 |
if [ ! "$srcdir$x" -ef "$y" ] ; then |
|
|
361 |
# deb2targz always extracts into the same directory as |
368 |
# deb2targz always extracts into the same directory as |
362 |
# the source file, so create a symlink in the current |
369 |
# the source file, so create a symlink in the current |
363 |
# working directory if necessary. |
370 |
# working directory if necessary. |
364 |
ln -sf "$srcdir$x" "$y" || die "$myfail" |
371 |
ln -sf "${srcdir}${x}" "${y}" || \ |
365 |
created_symlink=1 |
372 |
__helpers_die "${myfail}" || return $? |
366 |
fi |
373 |
deb2targz "${y}" || \ |
367 |
deb2targz "$y" || die "$myfail" |
374 |
__helpers_die "${myfail}" || return $? |
368 |
if [ $created_symlink = 1 ] ; then |
|
|
369 |
# Clean up the symlink so the ebuild |
375 |
# Clean up the symlink so the ebuild |
370 |
# doesn't inadvertently install it. |
376 |
# doesn't inadvertently install it. |
371 |
rm -f "$y" |
377 |
rm -f "${y}" || \ |
|
|
378 |
__helpers_die "${myfail}" || return $? |
379 |
else |
380 |
deb2targz "${y}" || \ |
381 |
__helpers_die "${myfail}" || return $? |
372 |
fi |
382 |
fi |
373 |
mv -f "${y%.deb}".tar.gz data.tar.gz || die "$myfail" |
383 |
mv -f "${y%.deb}".tar.gz data.tar.gz || \ |
|
|
384 |
__helpers_die "${myfail}" || return $? |
374 |
else |
385 |
else |
375 |
ar x "$srcdir$x" || die "$myfail" |
386 |
ar x "${srcdir}${x}" \ |
|
|
387 |
|| __helpers_die "${myfail}" || return $? |
376 |
fi |
388 |
fi |
377 |
;; |
389 |
;; |
378 |
lzma) |
390 |
lzma) |
379 |
__unpack_tar "lzma -d" |
391 |
__unpack_tar "lzma -d" || return $? |
380 |
;; |
392 |
;; |
381 |
xz) |
393 |
xz) |
382 |
if ___eapi_unpack_supports_xz; then |
394 |
if ___eapi_unpack_supports_xz; then |
383 |
__unpack_tar "xz -d" |
395 |
__unpack_tar "xz -d" || return $? |
384 |
else |
396 |
else |
385 |
__vecho "unpack ${x}: file format not recognized. Ignoring." |
397 |
__vecho "unpack ${x}: file format not recognized. Ignoring." |
386 |
fi |
398 |
fi |
Lines 392-399
unpack() {
Link Here
|
392 |
done |
404 |
done |
393 |
# Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE |
405 |
# Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE |
394 |
# should be preserved. |
406 |
# should be preserved. |
395 |
find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \ |
407 |
find . -mindepth 1 -maxdepth 1 ! -type l -execdir chmod -fR a+rX,u+w,g-w,o-w '{}' + || \ |
396 |
${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w |
408 |
__helpers_die "${myfail}" || return $? |
397 |
} |
409 |
} |
398 |
|
410 |
|
399 |
econf() { |
411 |
econf() { |
Lines 404-410
econf() {
Link Here
|
404 |
fi |
416 |
fi |
405 |
|
417 |
|
406 |
__hasg() { |
418 |
__hasg() { |
407 |
local x s=$1 |
419 |
local x s="$1" |
408 |
shift |
420 |
shift |
409 |
for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done |
421 |
for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done |
410 |
return 1 |
422 |
return 1 |
Lines 430-436
econf() {
Link Here
|
430 |
if [[ -n $CONFIG_SHELL && \ |
442 |
if [[ -n $CONFIG_SHELL && \ |
431 |
"$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then |
443 |
"$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then |
432 |
sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \ |
444 |
sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \ |
433 |
die "Substition of shebang in '$ECONF_SOURCE/configure' failed" |
445 |
__helpers_die "Substition of shebang in '$ECONF_SOURCE/configure' failed" || \ |
|
|
446 |
return $? |
434 |
fi |
447 |
fi |
435 |
if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then |
448 |
if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then |
436 |
find "${WORKDIR}" -type f '(' \ |
449 |
find "${WORKDIR}" -type f '(' \ |