Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 691776 | Differences between
and this patch

Collapse All | Expand All

(-)a/bin/isolated-functions.sh (-9 / +2 lines)
Lines 38-55 __assert_sigpipe_ok() { Link Here
38
	local x pipestatus=${PIPESTATUS[*]}
38
	local x pipestatus=${PIPESTATUS[*]}
39
	for x in $pipestatus ; do
39
	for x in $pipestatus ; do
40
		# Allow SIGPIPE through (128 + 13)
40
		# Allow SIGPIPE through (128 + 13)
41
		if [[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]]
41
		[[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] && die "$@"
42
		then
43
			__helpers_die "$@"
44
			return 1
45
		fi
46
	done
42
	done
47
43
48
	# Require normal success for the last process (tar).
44
	# Require normal success for the last process (tar).
49
	if [[ $x -ne 0 ]]; then
45
	[[ $x -eq 0 ]] || die "$@"
50
		__helpers_die "$@"
51
		return 1
52
	fi
53
}
46
}
54
47
55
shopt -s extdebug
48
shopt -s extdebug
(-)a/bin/phase-helpers.sh (-64 / +24 lines)
Lines 1-5 Link Here
1
#!/bin/bash
1
#!/bin/bash
2
# Copyright 1999-2018 Gentoo Foundation
2
# Copyright 1999-2019 Gentoo Authors
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
4
5
if ___eapi_has_DESTTREE_INSDESTTREE; then
5
if ___eapi_has_DESTTREE_INSDESTTREE; then
Lines 347-356 unpack() { Link Here
347
				die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}"
347
				die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}"
348
			fi
348
			fi
349
		fi
349
		fi
350
		if [[ ! -s ${srcdir}${x} ]]; then
350
		[[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
351
			__helpers_die "unpack: ${x} does not exist"
352
			return 1
353
		fi
354
351
355
		__unpack_tar() {
352
		__unpack_tar() {
356
			if [[ ${y_insensitive} == tar ]] ; then
353
			if [[ ${y_insensitive} == tar ]] ; then
Lines 361-378 unpack() { Link Here
361
						"supported with EAPI '${EAPI}'. Instead use 'tar'."
358
						"supported with EAPI '${EAPI}'. Instead use 'tar'."
362
				fi
359
				fi
363
				$1 -c -- "$srcdir$x" | tar xof -
360
				$1 -c -- "$srcdir$x" | tar xof -
364
				__assert_sigpipe_ok "$myfail" || return 1
361
				__assert_sigpipe_ok "$myfail"
365
			else
362
			else
366
				local cwd_dest=${x##*/}
363
				local cwd_dest=${x##*/}
367
				cwd_dest=${cwd_dest%.*}
364
				cwd_dest=${cwd_dest%.*}
368
				if ! $1 -c -- "${srcdir}${x}" > "${cwd_dest}"; then
365
				$1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail"
369
					__helpers_die "$myfail"
370
					return 1
371
				fi
372
			fi
366
			fi
373
		}
367
		}
374
368
375
		myfail="unpack: failure unpacking ${x}"
369
		myfail="failure unpacking ${x}"
376
		case "${suffix_insensitive}" in
370
		case "${suffix_insensitive}" in
377
			tar)
371
			tar)
378
				if ___eapi_unpack_is_case_sensitive && \
372
				if ___eapi_unpack_is_case_sensitive && \
Lines 381-390 unpack() { Link Here
381
						"suffix '${suffix}' which is unofficially supported" \
375
						"suffix '${suffix}' which is unofficially supported" \
382
						"with EAPI '${EAPI}'. Instead use 'tar'."
376
						"with EAPI '${EAPI}'. Instead use 'tar'."
383
				fi
377
				fi
384
				if ! tar xof "$srcdir$x"; then
378
				tar xof "$srcdir$x" || die "$myfail"
385
					__helpers_die "$myfail"
386
					return 1
387
				fi
388
				;;
379
				;;
389
			tgz)
380
			tgz)
390
				if ___eapi_unpack_is_case_sensitive && \
381
				if ___eapi_unpack_is_case_sensitive && \
Lines 393-402 unpack() { Link Here
393
						"suffix '${suffix}' which is unofficially supported" \
384
						"suffix '${suffix}' which is unofficially supported" \
394
						"with EAPI '${EAPI}'. Instead use 'tgz'."
385
						"with EAPI '${EAPI}'. Instead use 'tgz'."
395
				fi
386
				fi
396
				if ! tar xozf "$srcdir$x"; then
387
				tar xozf "$srcdir$x" || die "$myfail"
397
					__helpers_die "$myfail"
398
					return 1
399
				fi
400
				;;
388
				;;
401
			tbz|tbz2)
389
			tbz|tbz2)
402
				if ___eapi_unpack_is_case_sensitive && \
390
				if ___eapi_unpack_is_case_sensitive && \
Lines 406-412 unpack() { Link Here
406
						"with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'."
394
						"with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'."
407
				fi
395
				fi
408
				${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof -
396
				${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof -
409
				__assert_sigpipe_ok "$myfail" || return 1
397
				__assert_sigpipe_ok "$myfail"
410
				;;
398
				;;
411
			zip|jar)
399
			zip|jar)
412
				if ___eapi_unpack_is_case_sensitive && \
400
				if ___eapi_unpack_is_case_sensitive && \
Lines 418-427 unpack() { Link Here
418
				fi
406
				fi
419
				# unzip will interactively prompt under some error conditions,
407
				# unzip will interactively prompt under some error conditions,
420
				# as reported in bug #336285
408
				# as reported in bug #336285
421
				if ! unzip -qo "${srcdir}${x}"; then
409
				( set +x ; while true ; do echo n || break ; done ) | \
422
					__helpers_die "$myfail"
410
				unzip -qo "${srcdir}${x}" || die "$myfail"
423
					return 1
424
				fi < <(set +x ; while true ; do echo n || break ; done)
425
				;;
411
				;;
426
			gz|z)
412
			gz|z)
427
				if ___eapi_unpack_is_case_sensitive && \
413
				if ___eapi_unpack_is_case_sensitive && \
Lines 430-436 unpack() { Link Here
430
						"suffix '${suffix}' which is unofficially supported" \
416
						"suffix '${suffix}' which is unofficially supported" \
431
						"with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'."
417
						"with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'."
432
				fi
418
				fi
433
				__unpack_tar "gzip -d" || return 1
419
				__unpack_tar "gzip -d"
434
				;;
420
				;;
435
			bz2|bz)
421
			bz2|bz)
436
				if ___eapi_unpack_is_case_sensitive && \
422
				if ___eapi_unpack_is_case_sensitive && \
Lines 439-446 unpack() { Link Here
439
						"suffix '${suffix}' which is unofficially supported" \
425
						"suffix '${suffix}' which is unofficially supported" \
440
						"with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'."
426
						"with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'."
441
				fi
427
				fi
442
				__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \
428
				__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}"
443
					|| return 1
444
				;;
429
				;;
445
			7z)
430
			7z)
446
				local my_output
431
				local my_output
Lines 457-466 unpack() { Link Here
457
						"suffix '${suffix}' which is unofficially supported" \
442
						"suffix '${suffix}' which is unofficially supported" \
458
						"with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'."
443
						"with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'."
459
				fi
444
				fi
460
				if ! unrar x -idq -o+ "${srcdir}${x}"; then
445
				unrar x -idq -o+ "${srcdir}${x}" || die "$myfail"
461
					__helpers_die "$myfail"
462
					return 1
463
				fi
464
				;;
446
				;;
465
			lha|lzh)
447
			lha|lzh)
466
				if ___eapi_unpack_is_case_sensitive && \
448
				if ___eapi_unpack_is_case_sensitive && \
Lines 470-479 unpack() { Link Here
470
						"with EAPI '${EAPI}'." \
452
						"with EAPI '${EAPI}'." \
471
						"Instead use 'LHA', 'LHa', 'lha', or 'lzh'."
453
						"Instead use 'LHA', 'LHa', 'lha', or 'lzh'."
472
				fi
454
				fi
473
				if ! lha xfq "${srcdir}${x}"; then
455
				lha xfq "${srcdir}${x}" || die "$myfail"
474
					__helpers_die "$myfail"
475
					return 1
476
				fi
477
				;;
456
				;;
478
			a)
457
			a)
479
				if ___eapi_unpack_is_case_sensitive && \
458
				if ___eapi_unpack_is_case_sensitive && \
Lines 482-491 unpack() { Link Here
482
						"suffix '${suffix}' which is unofficially supported" \
461
						"suffix '${suffix}' which is unofficially supported" \
483
						"with EAPI '${EAPI}'. Instead use 'a'."
462
						"with EAPI '${EAPI}'. Instead use 'a'."
484
				fi
463
				fi
485
				if ! ar x "${srcdir}${x}"; then
464
				ar x "${srcdir}${x}" || die "$myfail"
486
					__helpers_die "$myfail"
487
					return 1
488
				fi
489
				;;
465
				;;
490
			deb)
466
			deb)
491
				if ___eapi_unpack_is_case_sensitive && \
467
				if ___eapi_unpack_is_case_sensitive && \
Lines 508-539 unpack() { Link Here
508
						# deb2targz always extracts into the same directory as
484
						# deb2targz always extracts into the same directory as
509
						# the source file, so create a symlink in the current
485
						# the source file, so create a symlink in the current
510
						# working directory if necessary.
486
						# working directory if necessary.
511
						if ! ln -sf "$srcdir$x" "$y"; then
487
						ln -sf "$srcdir$x" "$y" || die "$myfail"
512
							__helpers_die "$myfail"
513
							return 1
514
						fi
515
						created_symlink=1
488
						created_symlink=1
516
					fi
489
					fi
517
					if ! deb2targz "$y"; then
490
					deb2targz "$y" || die "$myfail"
518
						__helpers_die "$myfail"
519
						return 1
520
					fi
521
					if [ $created_symlink = 1 ] ; then
491
					if [ $created_symlink = 1 ] ; then
522
						# Clean up the symlink so the ebuild
492
						# Clean up the symlink so the ebuild
523
						# doesn't inadvertently install it.
493
						# doesn't inadvertently install it.
524
						rm -f "$y"
494
						rm -f "$y"
525
					fi
495
					fi
526
					if ! mv -f "${y%.deb}".tar.gz data.tar.gz; then
496
					mv -f "${y%.deb}".tar.gz data.tar.gz \
527
						if ! mv -f "${y%.deb}".tar.xz data.tar.xz; then
497
						|| mv -f "${y%.deb}".tar.xz data.tar.xz \
528
							__helpers_die "$myfail"
498
						|| die "$myfail"
529
							return 1
530
						fi
531
					fi
532
				else
499
				else
533
					if ! ar x "$srcdir$x"; then
500
					ar x "$srcdir$x" || die "$myfail"
534
						__helpers_die "$myfail"
535
						return 1
536
					fi
537
				fi
501
				fi
538
				;;
502
				;;
539
			lzma)
503
			lzma)
Lines 543-549 unpack() { Link Here
543
						"suffix '${suffix}' which is unofficially supported" \
507
						"suffix '${suffix}' which is unofficially supported" \
544
						"with EAPI '${EAPI}'. Instead use 'lzma'."
508
						"with EAPI '${EAPI}'. Instead use 'lzma'."
545
				fi
509
				fi
546
				__unpack_tar "lzma -d" || return 1
510
				__unpack_tar "lzma -d"
547
				;;
511
				;;
548
			xz)
512
			xz)
549
				if ___eapi_unpack_is_case_sensitive && \
513
				if ___eapi_unpack_is_case_sensitive && \
Lines 553-559 unpack() { Link Here
553
						"with EAPI '${EAPI}'. Instead use 'xz'."
517
						"with EAPI '${EAPI}'. Instead use 'xz'."
554
				fi
518
				fi
555
				if ___eapi_unpack_supports_xz; then
519
				if ___eapi_unpack_supports_xz; then
556
					__unpack_tar "xz -d" || return 1
520
					__unpack_tar "xz -d"
557
				else
521
				else
558
					__vecho "unpack ${x}: file format not recognized. Ignoring."
522
					__vecho "unpack ${x}: file format not recognized. Ignoring."
559
				fi
523
				fi
Lines 566-575 unpack() { Link Here
566
						"with EAPI '${EAPI}'. Instead use 'txz'."
530
						"with EAPI '${EAPI}'. Instead use 'txz'."
567
				fi
531
				fi
568
				if ___eapi_unpack_supports_txz; then
532
				if ___eapi_unpack_supports_txz; then
569
					if ! tar xof "$srcdir$x"; then
533
					tar xof "$srcdir$x" || die "$myfail"
570
						__helpers_die "$myfail"
571
						return 1
572
					fi
573
				else
534
				else
574
					__vecho "unpack ${x}: file format not recognized. Ignoring."
535
					__vecho "unpack ${x}: file format not recognized. Ignoring."
575
				fi
536
				fi
576
- 

Return to bug 691776