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/phase-helpers.sh (-60 / +22 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 "unpack: ${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-374 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}" || die
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
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}" || die
410
				;;
398
				;;
411
			zip|jar)
399
			zip|jar)
412
				if ___eapi_unpack_is_case_sensitive && \
400
				if ___eapi_unpack_is_case_sensitive && \
Lines 419-426 unpack() { Link Here
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
				if ! unzip -qo "${srcdir}${x}"; then
422
					__helpers_die "$myfail"
410
					die "${myfail}"
423
					return 1
424
				fi < <(set +x ; while true ; do echo n || break ; done)
411
				fi < <(set +x ; while true ; do echo n || break ; done)
425
				;;
412
				;;
426
			gz|z)
413
			gz|z)
Lines 430-436 unpack() { Link Here
430
						"suffix '${suffix}' which is unofficially supported" \
417
						"suffix '${suffix}' which is unofficially supported" \
431
						"with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'."
418
						"with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'."
432
				fi
419
				fi
433
				__unpack_tar "gzip -d" || return 1
420
				__unpack_tar "gzip -d" || die "${myfail}"
434
				;;
421
				;;
435
			bz2|bz)
422
			bz2|bz)
436
				if ___eapi_unpack_is_case_sensitive && \
423
				if ___eapi_unpack_is_case_sensitive && \
Lines 440-446 unpack() { Link Here
440
						"with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'."
427
						"with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'."
441
				fi
428
				fi
442
				__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \
429
				__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \
443
					|| return 1
430
					|| die "${myfail}"
444
				;;
431
				;;
445
			7z)
432
			7z)
446
				local my_output
433
				local my_output
Lines 457-466 unpack() { Link Here
457
						"suffix '${suffix}' which is unofficially supported" \
444
						"suffix '${suffix}' which is unofficially supported" \
458
						"with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'."
445
						"with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'."
459
				fi
446
				fi
460
				if ! unrar x -idq -o+ "${srcdir}${x}"; then
447
				unrar x -idq -o+ "${srcdir}${x}" || die "${myfail}"
461
					__helpers_die "$myfail"
462
					return 1
463
				fi
464
				;;
448
				;;
465
			lha|lzh)
449
			lha|lzh)
466
				if ___eapi_unpack_is_case_sensitive && \
450
				if ___eapi_unpack_is_case_sensitive && \
Lines 470-479 unpack() { Link Here
470
						"with EAPI '${EAPI}'." \
454
						"with EAPI '${EAPI}'." \
471
						"Instead use 'LHA', 'LHa', 'lha', or 'lzh'."
455
						"Instead use 'LHA', 'LHa', 'lha', or 'lzh'."
472
				fi
456
				fi
473
				if ! lha xfq "${srcdir}${x}"; then
457
				lha xfq "${srcdir}${x}" || die "${myfail}"
474
					__helpers_die "$myfail"
475
					return 1
476
				fi
477
				;;
458
				;;
478
			a)
459
			a)
479
				if ___eapi_unpack_is_case_sensitive && \
460
				if ___eapi_unpack_is_case_sensitive && \
Lines 482-491 unpack() { Link Here
482
						"suffix '${suffix}' which is unofficially supported" \
463
						"suffix '${suffix}' which is unofficially supported" \
483
						"with EAPI '${EAPI}'. Instead use 'a'."
464
						"with EAPI '${EAPI}'. Instead use 'a'."
484
				fi
465
				fi
485
				if ! ar x "${srcdir}${x}"; then
466
				ar x "${srcdir}${x}" || die "${myfail}"
486
					__helpers_die "$myfail"
487
					return 1
488
				fi
489
				;;
467
				;;
490
			deb)
468
			deb)
491
				if ___eapi_unpack_is_case_sensitive && \
469
				if ___eapi_unpack_is_case_sensitive && \
Lines 508-539 unpack() { Link Here
508
						# deb2targz always extracts into the same directory as
486
						# deb2targz always extracts into the same directory as
509
						# the source file, so create a symlink in the current
487
						# the source file, so create a symlink in the current
510
						# working directory if necessary.
488
						# working directory if necessary.
511
						if ! ln -sf "$srcdir$x" "$y"; then
489
						ln -sf "${srcdir}${x}" "${y}" || die "${myfail}"
512
							__helpers_die "$myfail"
513
							return 1
514
						fi
515
						created_symlink=1
490
						created_symlink=1
516
					fi
491
					fi
517
					if ! deb2targz "$y"; then
492
					deb2targz "${y}" || die "${myfail}"
518
						__helpers_die "$myfail"
519
						return 1
520
					fi
521
					if [ $created_symlink = 1 ] ; then
493
					if [ $created_symlink = 1 ] ; then
522
						# Clean up the symlink so the ebuild
494
						# Clean up the symlink so the ebuild
523
						# doesn't inadvertently install it.
495
						# doesn't inadvertently install it.
524
						rm -f "$y"
496
						rm -f "$y"
525
					fi
497
					fi
526
					if ! mv -f "${y%.deb}".tar.gz data.tar.gz; then
498
					mv -f "${y%.deb}".tar.gz data.tar.gz \
527
						if ! mv -f "${y%.deb}".tar.xz data.tar.xz; then
499
						|| mv -f "${y%.deb}".tar.xz data.tar.xz \
528
							__helpers_die "$myfail"
500
						|| die "${myfail}"
529
							return 1
530
						fi
531
					fi
532
				else
501
				else
533
					if ! ar x "$srcdir$x"; then
502
					ar x "${srcdir}${x}" || die "${myfail}"
534
						__helpers_die "$myfail"
535
						return 1
536
					fi
537
				fi
503
				fi
538
				;;
504
				;;
539
			lzma)
505
			lzma)
Lines 543-549 unpack() { Link Here
543
						"suffix '${suffix}' which is unofficially supported" \
509
						"suffix '${suffix}' which is unofficially supported" \
544
						"with EAPI '${EAPI}'. Instead use 'lzma'."
510
						"with EAPI '${EAPI}'. Instead use 'lzma'."
545
				fi
511
				fi
546
				__unpack_tar "lzma -d" || return 1
512
				__unpack_tar "lzma -d" || die "${myfail}"
547
				;;
513
				;;
548
			xz)
514
			xz)
549
				if ___eapi_unpack_is_case_sensitive && \
515
				if ___eapi_unpack_is_case_sensitive && \
Lines 553-559 unpack() { Link Here
553
						"with EAPI '${EAPI}'. Instead use 'xz'."
519
						"with EAPI '${EAPI}'. Instead use 'xz'."
554
				fi
520
				fi
555
				if ___eapi_unpack_supports_xz; then
521
				if ___eapi_unpack_supports_xz; then
556
					__unpack_tar "xz -d" || return 1
522
					__unpack_tar "xz -d" || die "${myfail}"
557
				else
523
				else
558
					__vecho "unpack ${x}: file format not recognized. Ignoring."
524
					__vecho "unpack ${x}: file format not recognized. Ignoring."
559
				fi
525
				fi
Lines 566-575 unpack() { Link Here
566
						"with EAPI '${EAPI}'. Instead use 'txz'."
532
						"with EAPI '${EAPI}'. Instead use 'txz'."
567
				fi
533
				fi
568
				if ___eapi_unpack_supports_txz; then
534
				if ___eapi_unpack_supports_txz; then
569
					if ! tar xof "$srcdir$x"; then
535
					tar xof "${srcdir}${x}" || die "${myfail}"
570
						__helpers_die "$myfail"
571
						return 1
572
					fi
573
				else
536
				else
574
					__vecho "unpack ${x}: file format not recognized. Ignoring."
537
					__vecho "unpack ${x}: file format not recognized. Ignoring."
575
				fi
538
				fi
576
- 

Return to bug 691776