public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: dosym -r, attempt two
@ 2021-06-25 19:50 Michał Górny
  2021-06-25 19:50 ` [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Defer wrapping scripts until after root-merge Michał Górny
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Michał Górny @ 2021-06-25 19:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Hi,

The original EAPI 8 patch series did not switch distutils-r1.eclass
to 'dosym -r' correctly.  The call was originally done inside
a temporary build root (!= ${ED}).  While we hacked around to make
'dosym -r' work, our hack did not work correctly in Prefix.

To avoid this, let's merge the temporary build root first and then
perform the wrapping inside ${ED}.


Michał Górny (4):
  distutils-r1.eclass: Defer wrapping scripts until after root-merge
  distutils-r1.eclass: Eliminate path arg to ..._wrap_scripts
  distutils-r1.eclass: Use 'dosym -r' in EAPI 8
  python-utils-r1.eclass: Remove _python_ln_rel

 eclass/distutils-r1.eclass    | 27 +++++++++++------------
 eclass/python-utils-r1.eclass | 40 -----------------------------------
 2 files changed, 14 insertions(+), 53 deletions(-)

-- 
2.32.0



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

* [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Defer wrapping scripts until after root-merge
  2021-06-25 19:50 [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: dosym -r, attempt two Michał Górny
@ 2021-06-25 19:50 ` Michał Górny
  2021-06-25 19:50 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Eliminate path arg to ..._wrap_scripts Michał Górny
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2021-06-25 19:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Defer wrapping installed Python scripts until the files are merged
from impl-specific directory into ${ED}.  This should clear the way
into using 'dosym -r'.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index a26130f7a194..e194731ba6bb 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -921,8 +921,8 @@ distutils-r1_python_install() {
 	fi
 
 	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
-		_distutils-r1_wrap_scripts "${root}" "${scriptdir}"
 		multibuild_merge_root "${root}" "${D%/}"
+		_distutils-r1_wrap_scripts "${D%/}" "${scriptdir}"
 	fi
 }
 
-- 
2.32.0



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

* [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Eliminate path arg to ..._wrap_scripts
  2021-06-25 19:50 [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: dosym -r, attempt two Michał Górny
  2021-06-25 19:50 ` [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Defer wrapping scripts until after root-merge Michał Górny
@ 2021-06-25 19:50 ` Michał Górny
  2021-06-25 19:51 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8 Michał Górny
  2021-06-25 19:51 ` [gentoo-dev] [PATCH 4/4] python-utils-r1.eclass: Remove _python_ln_rel Michał Górny
  3 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2021-06-25 19:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Eliminate the path argument to _distutils-r1_wrap_scripts, and inline
the use of ${D} instead.  This should make the code less confusing.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e194731ba6bb..87091951fafa 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -740,24 +740,23 @@ distutils-r1_python_compile() {
 }
 
 # @FUNCTION: _distutils-r1_wrap_scripts
-# @USAGE: <path> <bindir>
+# @USAGE: <bindir>
 # @INTERNAL
 # @DESCRIPTION:
 # Moves and wraps all installed scripts/executables as necessary.
 _distutils-r1_wrap_scripts() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	[[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>"
-	local path=${1}
-	local bindir=${2}
+	[[ ${#} -eq 1 ]] || die "usage: ${FUNCNAME} <bindir>"
+	local bindir=${1}
 
 	local scriptdir=$(python_get_scriptdir)
 	local f python_files=() non_python_files=()
 
-	if [[ -d ${path}${scriptdir} ]]; then
-		for f in "${path}${scriptdir}"/*; do
+	if [[ -d ${D%/}${scriptdir} ]]; then
+		for f in "${D%/}${scriptdir}"/*; do
 			[[ -d ${f} ]] && die "Unexpected directory: ${f}"
-			debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
+			debug-print "${FUNCNAME}: found executable at ${f#${D%/}/}"
 
 			local shebang
 			read -r shebang < "${f}"
@@ -769,22 +768,22 @@ _distutils-r1_wrap_scripts() {
 				non_python_files+=( "${f}" )
 			fi
 
-			mkdir -p "${path}${bindir}" || die
+			mkdir -p "${D%/}${bindir}" || die
 		done
 
 		for f in "${python_files[@]}"; do
 			local basename=${f##*/}
 
 			debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
-			_python_ln_rel "${path}${EPREFIX}"/usr/lib/python-exec/python-exec2 \
-				"${path}${bindir}/${basename}" || die
+			_python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
+				"${D%/}${bindir}/${basename}" || die
 		done
 
 		for f in "${non_python_files[@]}"; do
 			local basename=${f##*/}
 
-			debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
-			mv "${f}" "${path}${bindir}/${basename}" || die
+			debug-print "${FUNCNAME}: moving ${f#${D%/}/} to ${bindir}/${basename}"
+			mv "${f}" "${D%/}${bindir}/${basename}" || die
 		done
 	fi
 }
@@ -922,7 +921,7 @@ distutils-r1_python_install() {
 
 	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
 		multibuild_merge_root "${root}" "${D%/}"
-		_distutils-r1_wrap_scripts "${D%/}" "${scriptdir}"
+		_distutils-r1_wrap_scripts "${scriptdir}"
 	fi
 }
 
-- 
2.32.0



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

* [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8
  2021-06-25 19:50 [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: dosym -r, attempt two Michał Górny
  2021-06-25 19:50 ` [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Defer wrapping scripts until after root-merge Michał Górny
  2021-06-25 19:50 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Eliminate path arg to ..._wrap_scripts Michał Górny
@ 2021-06-25 19:51 ` Michał Górny
  2021-06-26  7:58   ` Ulrich Mueller
  2021-06-25 19:51 ` [gentoo-dev] [PATCH 4/4] python-utils-r1.eclass: Remove _python_ln_rel Michał Górny
  3 siblings, 1 reply; 7+ messages in thread
From: Michał Górny @ 2021-06-25 19:51 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 87091951fafa..749809378c93 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -775,8 +775,10 @@ _distutils-r1_wrap_scripts() {
 			local basename=${f##*/}
 
 			debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
-			_python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
-				"${D%/}${bindir}/${basename}" || die
+			local dosym=dosym
+			[[ ${EAPI} == [67] ]] && dosym=dosym8
+			"${dosym}" -r /usr/lib/python-exec/python-exec2 \
+				"${bindir#${EPREFIX}}/${basename}"
 		done
 
 		for f in "${non_python_files[@]}"; do
-- 
2.32.0



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

* [gentoo-dev] [PATCH 4/4] python-utils-r1.eclass: Remove _python_ln_rel
  2021-06-25 19:50 [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: dosym -r, attempt two Michał Górny
                   ` (2 preceding siblings ...)
  2021-06-25 19:51 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8 Michał Górny
@ 2021-06-25 19:51 ` Michał Górny
  3 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2021-06-25 19:51 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/python-utils-r1.eclass | 40 -----------------------------------
 1 file changed, 40 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 7022d3b7d88a..7488802332f6 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -549,46 +549,6 @@ python_get_scriptdir() {
 	echo "${PYTHON_SCRIPTDIR}"
 }
 
-# @FUNCTION: _python_ln_rel
-# @USAGE: <from> <to>
-# @INTERNAL
-# @DESCRIPTION:
-# Create a relative symlink.
-_python_ln_rel() {
-	debug-print-function ${FUNCNAME} "${@}"
-
-	local target=${1}
-	local symname=${2}
-
-	local tgpath=${target%/*}/
-	local sympath=${symname%/*}/
-	local rel_target=
-
-	while [[ ${sympath} ]]; do
-		local tgseg= symseg=
-
-		while [[ ! ${tgseg} && ${tgpath} ]]; do
-			tgseg=${tgpath%%/*}
-			tgpath=${tgpath#${tgseg}/}
-		done
-
-		while [[ ! ${symseg} && ${sympath} ]]; do
-			symseg=${sympath%%/*}
-			sympath=${sympath#${symseg}/}
-		done
-
-		if [[ ${tgseg} != ${symseg} ]]; then
-			rel_target=../${rel_target}${tgseg:+${tgseg}/}
-		fi
-	done
-	rel_target+=${tgpath}${target##*/}
-
-	debug-print "${FUNCNAME}: ${symname} -> ${target}"
-	debug-print "${FUNCNAME}: rel_target = ${rel_target}"
-
-	ln -fs "${rel_target}" "${symname}"
-}
-
 # @FUNCTION: python_optimize
 # @USAGE: [<directory>...]
 # @DESCRIPTION:
-- 
2.32.0



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

* Re: [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8
  2021-06-25 19:51 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8 Michał Górny
@ 2021-06-26  7:58   ` Ulrich Mueller
  2021-06-26 11:19     ` Michał Górny
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Mueller @ 2021-06-26  7:58 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-dev

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

>>>>> On Fri, 25 Jun 2021, Michał Górny wrote:

> +			local dosym=dosym
> +			[[ ${EAPI} == [67] ]] && dosym=dosym8
> +			"${dosym}" -r /usr/lib/python-exec/python-exec2 \
> +				"${bindir#${EPREFIX}}/${basename}"

Shouldn't the eclass inherit eapi8-dosym in EAPIs 6 and 7?

Ulrich

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

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

* Re: [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8
  2021-06-26  7:58   ` Ulrich Mueller
@ 2021-06-26 11:19     ` Michał Górny
  0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2021-06-26 11:19 UTC (permalink / raw
  To: gentoo-dev

On Sat, 2021-06-26 at 09:58 +0200, Ulrich Mueller wrote:
> > > > > > On Fri, 25 Jun 2021, Michał Górny wrote:
> 
> > +			local dosym=dosym
> > +			[[ ${EAPI} == [67] ]] && dosym=dosym8
> > +			"${dosym}" -r /usr/lib/python-exec/python-
> > exec2 \
> > +				"${bindir#${EPREFIX}}/${basename}"
> 
> Shouldn't the eclass inherit eapi8-dosym in EAPIs 6 and 7?

It relies on python-utils-r1 taking care of that.

-- 
Best regards,
Michał Górny




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

end of thread, other threads:[~2021-06-26 11:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-25 19:50 [gentoo-dev] [PATCH 0/4] distutils-r1.eclass: dosym -r, attempt two Michał Górny
2021-06-25 19:50 ` [gentoo-dev] [PATCH 1/4] distutils-r1.eclass: Defer wrapping scripts until after root-merge Michał Górny
2021-06-25 19:50 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Eliminate path arg to ..._wrap_scripts Michał Górny
2021-06-25 19:51 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use 'dosym -r' in EAPI 8 Michał Górny
2021-06-26  7:58   ` Ulrich Mueller
2021-06-26 11:19     ` Michał Górny
2021-06-25 19:51 ` [gentoo-dev] [PATCH 4/4] python-utils-r1.eclass: Remove _python_ln_rel Michał Górny

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