@@ -, +, @@ --- bin/phase-helpers.sh | 81 ++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 59 deletions(-) --- a/bin/phase-helpers.sh +++ a/bin/phase-helpers.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 if ___eapi_has_DESTTREE_INSDESTTREE; then @@ -347,10 +347,7 @@ unpack() { die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}" fi fi - if [[ ! -s ${srcdir}${x} ]]; then - __helpers_die "unpack: ${x} does not exist" - return 1 - fi + [[ -s ${srcdir}${x} ]] || die "unpack: ${x} does not exist" __unpack_tar() { if [[ ${y_insensitive} == tar ]] ; then @@ -361,14 +358,11 @@ unpack() { "supported with EAPI '${EAPI}'. Instead use 'tar'." fi $1 -c -- "$srcdir$x" | tar xof - - __assert_sigpipe_ok "$myfail" || return 1 + __assert_sigpipe_ok "${myfail}" || die else local cwd_dest=${x##*/} cwd_dest=${cwd_dest%.*} - if ! $1 -c -- "${srcdir}${x}" > "${cwd_dest}"; then - __helpers_die "$myfail" - return 1 - fi + $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "${myfail}" fi } @@ -381,10 +375,7 @@ unpack() { "suffix '${suffix}' which is unofficially supported" \ "with EAPI '${EAPI}'. Instead use 'tar'." fi - if ! tar xof "$srcdir$x"; then - __helpers_die "$myfail" - return 1 - fi + tar xof "${srcdir}${x}" || die "${myfail}" ;; tgz) if ___eapi_unpack_is_case_sensitive && \ @@ -393,10 +384,7 @@ unpack() { "suffix '${suffix}' which is unofficially supported" \ "with EAPI '${EAPI}'. Instead use 'tgz'." fi - if ! tar xozf "$srcdir$x"; then - __helpers_die "$myfail" - return 1 - fi + tar xozf "${srcdir}${x}" || die "${myfail}" ;; tbz|tbz2) if ___eapi_unpack_is_case_sensitive && \ @@ -406,7 +394,7 @@ unpack() { "with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'." fi ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - - __assert_sigpipe_ok "$myfail" || return 1 + __assert_sigpipe_ok "${myfail}" || die ;; zip|jar) if ___eapi_unpack_is_case_sensitive && \ @@ -419,8 +407,7 @@ unpack() { # unzip will interactively prompt under some error conditions, # as reported in bug #336285 if ! unzip -qo "${srcdir}${x}"; then - __helpers_die "$myfail" - return 1 + die "${myfail}" fi < <(set +x ; while true ; do echo n || break ; done) ;; gz|z) @@ -430,7 +417,7 @@ unpack() { "suffix '${suffix}' which is unofficially supported" \ "with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'." fi - __unpack_tar "gzip -d" || return 1 + __unpack_tar "gzip -d" || die "${myfail}" ;; bz2|bz) if ___eapi_unpack_is_case_sensitive && \ @@ -440,7 +427,7 @@ unpack() { "with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'." fi __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" \ - || return 1 + || die "${myfail}" ;; 7z) local my_output @@ -457,10 +444,7 @@ unpack() { "suffix '${suffix}' which is unofficially supported" \ "with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'." fi - if ! unrar x -idq -o+ "${srcdir}${x}"; then - __helpers_die "$myfail" - return 1 - fi + unrar x -idq -o+ "${srcdir}${x}" || die "${myfail}" ;; lha|lzh) if ___eapi_unpack_is_case_sensitive && \ @@ -470,10 +454,7 @@ unpack() { "with EAPI '${EAPI}'." \ "Instead use 'LHA', 'LHa', 'lha', or 'lzh'." fi - if ! lha xfq "${srcdir}${x}"; then - __helpers_die "$myfail" - return 1 - fi + lha xfq "${srcdir}${x}" || die "${myfail}" ;; a) if ___eapi_unpack_is_case_sensitive && \ @@ -482,10 +463,7 @@ unpack() { "suffix '${suffix}' which is unofficially supported" \ "with EAPI '${EAPI}'. Instead use 'a'." fi - if ! ar x "${srcdir}${x}"; then - __helpers_die "$myfail" - return 1 - fi + ar x "${srcdir}${x}" || die "${myfail}" ;; deb) if ___eapi_unpack_is_case_sensitive && \ @@ -508,32 +486,20 @@ unpack() { # deb2targz always extracts into the same directory as # the source file, so create a symlink in the current # working directory if necessary. - if ! ln -sf "$srcdir$x" "$y"; then - __helpers_die "$myfail" - return 1 - fi + ln -sf "${srcdir}${x}" "${y}" || die "${myfail}" created_symlink=1 fi - if ! deb2targz "$y"; then - __helpers_die "$myfail" - return 1 - fi + deb2targz "${y}" || die "${myfail}" if [ $created_symlink = 1 ] ; then # Clean up the symlink so the ebuild # doesn't inadvertently install it. rm -f "$y" fi - if ! mv -f "${y%.deb}".tar.gz data.tar.gz; then - if ! mv -f "${y%.deb}".tar.xz data.tar.xz; then - __helpers_die "$myfail" - return 1 - fi - fi + mv -f "${y%.deb}".tar.gz data.tar.gz \ + || mv -f "${y%.deb}".tar.xz data.tar.xz \ + || die "${myfail}" else - if ! ar x "$srcdir$x"; then - __helpers_die "$myfail" - return 1 - fi + ar x "${srcdir}${x}" || die "${myfail}" fi ;; lzma) @@ -543,7 +509,7 @@ unpack() { "suffix '${suffix}' which is unofficially supported" \ "with EAPI '${EAPI}'. Instead use 'lzma'." fi - __unpack_tar "lzma -d" || return 1 + __unpack_tar "lzma -d" || die "${myfail}" ;; xz) if ___eapi_unpack_is_case_sensitive && \ @@ -553,7 +519,7 @@ unpack() { "with EAPI '${EAPI}'. Instead use 'xz'." fi if ___eapi_unpack_supports_xz; then - __unpack_tar "xz -d" || return 1 + __unpack_tar "xz -d" || die "${myfail}" else __vecho "unpack ${x}: file format not recognized. Ignoring." fi @@ -566,10 +532,7 @@ unpack() { "with EAPI '${EAPI}'. Instead use 'txz'." fi if ___eapi_unpack_supports_txz; then - if ! tar xof "$srcdir$x"; then - __helpers_die "$myfail" - return 1 - fi + tar xof "${srcdir}${x}" || die "${myfail}" else __vecho "unpack ${x}: file format not recognized. Ignoring." fi --