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 80FEC138A1F for ; Fri, 26 Sep 2014 02:17:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 10B3AE09B5; Fri, 26 Sep 2014 02:17:24 +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 55AE2E0997 for ; Fri, 26 Sep 2014 02:17:23 +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 2C24D3401D6 for ; Fri, 26 Sep 2014 02:17:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D33816472 for ; Fri, 26 Sep 2014 02:17:20 +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: <1411694533.042e1e0695255470e3194b6d343c74a1f2ec7f4b.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/phase-helpers.sh bin/save-ebuild-env.sh X-VCS-Directories: bin/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 042e1e0695255470e3194b6d343c74a1f2ec7f4b X-VCS-Branch: master Date: Fri, 26 Sep 2014 02:17:20 +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: caf4e1a3-04c5-43ab-834e-c99e4e75cce2 X-Archives-Hash: e13b23af3369d2db62dc3064ecf67078 commit: 042e1e0695255470e3194b6d343c74a1f2ec7f4b Author: Michał Górny gentoo org> AuthorDate: Thu Sep 25 18:33:44 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Fri Sep 26 01:22:13 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=042e1e06 Re-apply "Rewrite default ebuild phase setting code" (bug 523182)" Add empty default src_prepare() as required by PMS Add missing bind for pkg_nofetch. Spotted-by: Zac Medico gentoo.org> X-Gento-Bug: 523182 X-Gentoo-URL: https://bugs.gentoo.org/show_bug.cgi?id=523182 Merged 3 pathces by: Brian Dolbec gentoo.org> --- bin/phase-functions.sh | 123 +++++++++++++++++++++++-------------------------- bin/phase-helpers.sh | 4 ++ bin/save-ebuild-env.sh | 2 +- 3 files changed, 63 insertions(+), 66 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index df385b8..d292ad3 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -750,91 +750,84 @@ __ebuild_phase_funcs() { [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*" local eapi=$1 local phase_func=$2 - local default_phases="pkg_nofetch src_unpack src_prepare src_configure - src_compile src_install src_test" - local x y default_func="" - - for x in pkg_nofetch src_unpack src_test ; do - declare -F $x >/dev/null || \ - eval "$x() { __eapi0_$x \"\$@\" ; }" + 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 + # We can just call the specific handler -- it will either error out + # on invalid phase or run it. + eval "default() { + default_${phase_func} + }" + case "$eapi" in + 0|1) # EAPIs not supporting 'default' - 0|1) + for x in pkg_nofetch src_unpack src_test ; do + declare -F $x >/dev/null || \ + eval "$x() { __eapi0_$x; }" + done 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_prepare ]] && \ + default_src_prepare() { __eapi2_src_prepare; } + [[ ${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 pkg_nofetch >/dev/null || \ + pkg_nofetch() { default; } + declare -F src_unpack >/dev/null || \ + src_unpack() { default; } + declare -F src_prepare >/dev/null || \ + src_prepare() { default; } declare -F src_configure >/dev/null || \ - src_configure() { __eapi2_src_configure "$@" ; } - + src_configure() { default; } declare -F src_compile >/dev/null || \ - src_compile() { __eapi2_src_compile "$@" ; } - - has $eapi 2 3 || declare -F src_install >/dev/null || \ - src_install() { __eapi4_src_install "$@" ; } + src_compile() { default; } + declare -F src_test >/dev/null || \ + src_test() { default; } - 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\" - }" + # defaults starting with EAPI 4 + if ! has ${eapi} 2 3; then + [[ ${phase_func} == src_install ]] && \ + default_src_install() { __eapi4_src_install; } + declare -F src_install >/dev/null || \ + src_install() { default; } fi - ;; esac } diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index ca28ce9..5f7c809 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -682,6 +682,10 @@ __eapi1_src_compile() { __eapi2_src_compile } +__eapi2_src_prepare() { + : +} + __eapi2_src_configure() { if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then econf diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index 98cff83..de0c499 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 ; do + pkg_prerm pkg_postrm pkg_config pkg_info pkg_pretend ; do unset -f default_$x __eapi{0,1,2,3,4}_$x done unset x