public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] __dyn_test: Make fallback to WORKDIR conditional.
@ 2019-03-09  8:16 Ulrich Müller
  2019-03-19  0:30 ` Zac Medico
  0 siblings, 1 reply; 2+ messages in thread
From: Ulrich Müller @ 2019-03-09  8:16 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]

When the fallback from S to WORKDIR was made conditional in EAPI 4,
src_test() was originally omitted. This has been fixed retroactively
in PMS:
https://gitweb.gentoo.org/proj/pms.git/commit/?id=0038f90a942f0856ae2533b26f709002a3ec80ae

There should be no issues with backwards compatibility of existing
ebuilds. The feature is not used in the Gentoo repository. Plus, the
scenario is very unlikely, because in src_test the fallback to WORKDIR
could only happen for an ebuild that:
- Has no files in A to be unpacked.
- Doesn't define any of the unpack, prepare, configure, compile or
  install phases (otherwise it would die in one of these phases).

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
 bin/phase-functions.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d8ebf3d3e..4c6420bfa 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -358,7 +358,7 @@ __abort_install() {
 
 __has_phase_defined_up_to() {
 	local phase
-	for phase in unpack prepare configure compile install; do
+	for phase in unpack prepare configure compile test install; do
 		has ${phase} ${DEFINED_PHASES} && return 0
 		[[ ${phase} == $1 ]] && return 1
 	done
@@ -497,8 +497,12 @@ __dyn_test() {
 
 	if [ -d "${S}" ]; then
 		cd "${S}"
-	else
+	elif ___eapi_has_S_WORKDIR_fallback; then
+		cd "${WORKDIR}"
+	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to test; then
 		cd "${WORKDIR}"
+	else
+		die "The source directory '${S}' doesn't exist"
 	fi
 
 	if has test ${RESTRICT} ; then
-- 
2.20.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] __dyn_test: Make fallback to WORKDIR conditional.
  2019-03-09  8:16 [gentoo-portage-dev] [PATCH] __dyn_test: Make fallback to WORKDIR conditional Ulrich Müller
@ 2019-03-19  0:30 ` Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2019-03-19  0:30 UTC (permalink / raw
  To: gentoo-portage-dev, Ulrich Müller


[-- Attachment #1.1: Type: text/plain, Size: 1802 bytes --]

On 3/9/19 12:16 AM, Ulrich Müller wrote:
> When the fallback from S to WORKDIR was made conditional in EAPI 4,
> src_test() was originally omitted. This has been fixed retroactively
> in PMS:
> https://gitweb.gentoo.org/proj/pms.git/commit/?id=0038f90a942f0856ae2533b26f709002a3ec80ae
> 
> There should be no issues with backwards compatibility of existing
> ebuilds. The feature is not used in the Gentoo repository. Plus, the
> scenario is very unlikely, because in src_test the fallback to WORKDIR
> could only happen for an ebuild that:
> - Has no files in A to be unpacked.
> - Doesn't define any of the unpack, prepare, configure, compile or
>   install phases (otherwise it would die in one of these phases).
> 
> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
> ---
>  bin/phase-functions.sh | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
> index d8ebf3d3e..4c6420bfa 100644
> --- a/bin/phase-functions.sh
> +++ b/bin/phase-functions.sh
> @@ -358,7 +358,7 @@ __abort_install() {
>  
>  __has_phase_defined_up_to() {
>  	local phase
> -	for phase in unpack prepare configure compile install; do
> +	for phase in unpack prepare configure compile test install; do
>  		has ${phase} ${DEFINED_PHASES} && return 0
>  		[[ ${phase} == $1 ]] && return 1
>  	done
> @@ -497,8 +497,12 @@ __dyn_test() {
>  
>  	if [ -d "${S}" ]; then
>  		cd "${S}"
> -	else
> +	elif ___eapi_has_S_WORKDIR_fallback; then
> +		cd "${WORKDIR}"
> +	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to test; then
>  		cd "${WORKDIR}"
> +	else
> +		die "The source directory '${S}' doesn't exist"
>  	fi
>  
>  	if has test ${RESTRICT} ; then
> 

Looks good. Please merge.
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-19  0:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-09  8:16 [gentoo-portage-dev] [PATCH] __dyn_test: Make fallback to WORKDIR conditional Ulrich Müller
2019-03-19  0:30 ` Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox