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