EAPI 5: User patches (no-op dummy stub for now)
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Aug 2012 05:04:42 +0000 (22:04 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Aug 2012 05:04:42 +0000 (22:04 -0700)
A real apply_user_patches implementation will be a bit more work, so
for now we'll just implement the minimum amount necessary to satisfy
the spec:
http://git.overlays.gentoo.org/gitweb/?p=proj/pms.git;a=commit;h=a8bf7862967cce36b7f1b408934a774126da2538

bin/phase-functions.sh
bin/phase-helpers.sh
bin/save-ebuild-env.sh

index c23be74d347ebd09f63a69a50be6eac01b65c798..ff7d855209b2fafe22f4fac453146cf8fa0ae7a9 100644 (file)
@@ -277,7 +277,8 @@ dyn_clean() {
                        "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \
                        "$PORTAGE_BUILDDIR"/.die_hooks \
                        "$PORTAGE_BUILDDIR"/.ipc_{in,out,lock} \
-                       "$PORTAGE_BUILDDIR"/.exit_status
+                       "$PORTAGE_BUILDDIR"/.exit_status \
+                       "$PORTAGE_BUILDDIR"/.apply_user_patches
 
                rm -rf "${PORTAGE_BUILDDIR}/build-info"
                rm -rf "${WORKDIR}"
@@ -381,6 +382,14 @@ dyn_prepare() {
                die "Failed to create $PORTAGE_BUILDDIR/.prepared"
        vecho ">>> Source prepared."
        ebuild_phase post_src_prepare
+       case "${EAPI}" in
+               0|1|2|3|4|4-python|4-slot-abi)
+                       ;;
+               *)
+                       [[ ! -f ${PORTAGE_BUILDDIR}/.apply_user_patches ]] && \
+                               die "src_prepare must call apply_user_patches at least once"
+                       ;;
+       esac
 
        trap - SIGINT SIGQUIT
 }
@@ -804,6 +813,18 @@ _ebuild_phase_funcs() {
                                                eval "default_src_install() { _eapi4_src_install \"\$@\" ; }"
                                                [[ $phase_func = src_install ]] && \
                                                        eval "default() { _eapi4_$phase_func \"\$@\" ; }"
+                                               case "$eapi" in
+                                                       4|4-python|4-slot-abi)
+                                                               ;;
+                                                       *)
+                                                               ! declare -F src_prepare >/dev/null && \
+                                                                       src_prepare() { _eapi5_src_prepare "$@" ; }
+                                                               default_src_prepare() { _eapi5_src_prepare "$@" ; }
+                                                               [[ $phase_func = src_prepare ]] && \
+                                                                       eval "default() { _eapi5_$phase_func \"\$@\" ; }"
+                                                               apply_user_patches() { _eapi5_apply_user_patches "$@" ; }
+                                                               ;;
+                                               esac
                                                ;;
                                esac
 
index 3f02c070125ea4d6706787236b73196cfeef4455..3230870c211733fc282a2bdeb0d5af96680497c0 100644 (file)
@@ -598,6 +598,21 @@ _eapi4_src_install() {
        fi
 }
 
+_eapi5_src_prepare() {
+       apply_user_patches
+}
+
+apply_user_patches() {
+       die "apply_user_patches is not supported with EAPI ${EAPI}"
+}
+
+_eapi5_apply_user_patches() {
+       # This is a no-op that is just enough to fullfill the spec.
+       [[ -f ${PORTAGE_BUILDDIR}/.apply_user_patches ]] && return 1
+       > "${PORTAGE_BUILDDIR}/.apply_user_patches" || die
+       return 1
+}
+
 # @FUNCTION: has_version
 # @USAGE: <DEPEND ATOM>
 # @DESCRIPTION:
index 47a2acae54c7e678c0d4b1b33fa031a722c41251..4bf6e4e18c28448c532ac9047d9cbc9bb3c6fda4 100644 (file)
@@ -46,7 +46,8 @@ save_ebuild_env() {
        done
        unset x
 
-       unset -f assert assert_sigpipe_ok dump_trace die diefunc \
+       unset -f apply_user_patches assert assert_sigpipe_ok \
+               dump_trace die diefunc \
                quiet_mode vecho elog_base eqawarn elog \
                esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \
                KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
@@ -67,6 +68,7 @@ save_ebuild_env() {
                save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
                set_unless_changed unset_unless_changed source_all_bashrcs \
                ebuild_main ebuild_phase ebuild_phase_with_hooks \
+               _eapi5_apply_user_patches _eapi5_src_prepare \
                _ebuild_arg_to_phase _ebuild_phase_funcs default \
                _hasg _hasgq _unpack_tar \
                ${QA_INTERCEPTORS}