From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1914A13838B for ; Sat, 20 Sep 2014 15:09:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88685E086C; Sat, 20 Sep 2014 15:09:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 28742E086C for ; Sat, 20 Sep 2014 15:09:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 082E133FCB7 for ; Sat, 20 Sep 2014 15:09:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 33BE397E for ; Sat, 20 Sep 2014 15:09:39 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1411189487.c775565a9f0c2aa5872559f3927d6608e840cb1d.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/phase-functions.sh bin/save-ebuild-env.sh X-VCS-Directories: bin/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: c775565a9f0c2aa5872559f3927d6608e840cb1d X-VCS-Branch: master Date: Sat, 20 Sep 2014 15:09:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d341d2d1-0973-4731-b65e-ff263bcd93f0 X-Archives-Hash: 36125898c1301bedf28cf9aa13ae9b9d commit: c775565a9f0c2aa5872559f3927d6608e840cb1d Author: Brian Dolbec gentoo org> AuthorDate: Sat Sep 20 05:04:47 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sat Sep 20 05:04:47 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c775565a Revert "Rewrite default ebuild phase setting code" (bug 523182) This reverts commit 772ed29fd9e7cf722aed943adbe33a27f250e1ff. X-Gentoo-Bug: 523182 X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=523182 --- bin/phase-functions.sh | 117 +++++++++++++++++++++++++++---------------------- bin/save-ebuild-env.sh | 2 +- 2 files changed, 66 insertions(+), 53 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 9bc3eb5..df385b8 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -750,78 +750,91 @@ __ebuild_phase_funcs() { [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*" local eapi=$1 local phase_func=$2 - local all_phases="src_compile pkg_config src_configure pkg_info - src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst - src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack" - local x - - # First, set up the error handlers for default* - for x in ${all_phases} ; do - eval "default_${x}() { - die \"default_${x}() is not supported in EAPI='${eapi}' in phase ${phase_func}\" - }" - done + local default_phases="pkg_nofetch src_unpack src_prepare src_configure + src_compile src_install src_test" + local x y default_func="" - # We can just call the specific handler -- it will either error out - # on invalid phase or run it. - eval "default() { - default_${phase_func} - }" + for x in pkg_nofetch src_unpack src_test ; do + declare -F $x >/dev/null || \ + eval "$x() { __eapi0_$x \"\$@\" ; }" + done case "$eapi" in - 0|1) # EAPIs not supporting 'default' - for x in pkg_nofetch src_unpack src_test ; do - declare -F $x >/dev/null || \ - eval "$x() { __eapi0_$x; }" - done + 0|1) if ! declare -F src_compile >/dev/null ; then case "$eapi" in 0) - src_compile() { __eapi0_src_compile; } + src_compile() { __eapi0_src_compile "$@" ; } ;; *) - src_compile() { __eapi1_src_compile; } + src_compile() { __eapi1_src_compile "$@" ; } ;; esac fi + + for x in $default_phases ; do + eval "default_$x() { + die \"default_$x() is not supported with EAPI='$eapi' during phase $phase_func\" + }" + done + + eval "default() { + die \"default() is not supported with EAPI='$eapi' during phase $phase_func\" + }" + ;; - *) # EAPIs supporting 'default' - - # defaults starting with EAPI 0 - [[ ${phase_func} == pkg_nofetch ]] && \ - default_pkg_nofetch() { __eapi0_pkg_nofetch; } - [[ ${phase_func} == src_unpack ]] && \ - default_src_unpack() { __eapi0_src_unpack; } - [[ ${phase_func} == src_test ]] && \ - default_src_test() { __eapi0_src_test; } - - # defaults starting with EAPI 2 - [[ ${phase_func} == src_configure ]] && \ - default_src_configure() { __eapi2_src_configure; } - [[ ${phase_func} == src_compile ]] && \ - default_src_compile() { __eapi2_src_compile; } - - # bind supported phases to the defaults - declare -F src_unpack >/dev/null || \ - src_unpack() { default; } + *) + declare -F src_configure >/dev/null || \ - src_configure() { default; } + src_configure() { __eapi2_src_configure "$@" ; } + declare -F src_compile >/dev/null || \ - src_compile() { default; } - declare -F src_test >/dev/null || \ - src_test() { default; } + src_compile() { __eapi2_src_compile "$@" ; } + + has $eapi 2 3 || declare -F src_install >/dev/null || \ + src_install() { __eapi4_src_install "$@" ; } - # defaults starting with EAPI 4 - if ! has ${eapi} 2 3; then - [[ ${phase_func} == src_install ]] && \ - default_src_install() { __eapi4_src_install; } + if has $phase_func $default_phases ; then + + __eapi2_pkg_nofetch () { __eapi0_pkg_nofetch "$@" ; } + __eapi2_src_unpack () { __eapi0_src_unpack "$@" ; } + __eapi2_src_prepare () { true ; } + __eapi2_src_test () { __eapi0_src_test "$@" ; } + __eapi2_src_install () { die "$FUNCNAME is not supported" ; } + + for x in $default_phases ; do + eval "default_$x() { __eapi2_$x \"\$@\" ; }" + done + + eval "default() { __eapi2_$phase_func \"\$@\" ; }" + + case "$eapi" in + 2|3) + ;; + *) + eval "default_src_install() { __eapi4_src_install \"\$@\" ; }" + [[ $phase_func = src_install ]] && \ + eval "default() { __eapi4_$phase_func \"\$@\" ; }" + ;; + esac + + else + + for x in $default_phases ; do + eval "default_$x() { + die \"default_$x() is not supported in phase $default_func\" + }" + done + + eval "default() { + die \"default() is not supported with EAPI='$eapi' during phase $phase_func\" + }" - declare -F src_install >/dev/null || \ - src_install() { default; } fi + ;; esac } diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index de0c499..98cff83 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -42,7 +42,7 @@ __save_ebuild_env() { for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \ src_compile src_test src_install pkg_preinst pkg_postinst \ - pkg_prerm pkg_postrm pkg_config pkg_info pkg_pretend ; do + pkg_prerm pkg_postrm ; do unset -f default_$x __eapi{0,1,2,3,4}_$x done unset x