public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls
@ 2023-06-15 15:52 Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 02/11] ruby-ng.eclass: optimize: use pattern substitution Sam James
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Not much improvement on a grand scale, but for dev-ruby/sinatra at least, we get:
```
$ pk pkg source $(pkg) --repo ~/g/ --bench 5s # before
dev-ruby/sinatra-3.0.5::/home/sam/g/: mean: 76.25ms, min: 59.23ms, max: 83.674ms, σ = 4.247ms, N = 66
dev-ruby/sinatra-3.0.5-r1::/home/sam/g/: mean: 77.465ms, min: 61.782ms, max: 85.127ms, σ = 3.592ms, N = 65
dev-ruby/sinatra-3.0.6::/home/sam/g/: mean: 80.192ms, min: 60.922ms, max: 84.951ms, σ = 3.899ms, N = 63
dev-ruby/sinatra-2.2.3::/home/sam/g/: mean: 80.389ms, min: 56.818ms, max: 86.915ms, σ = 4.508ms, N = 63

$ pk pkg source $(pkg) --repo ~/g/ --bench 5s # after
dev-ruby/sinatra-3.0.6::/home/sam/g/: mean: 72.761ms, min: 58.627ms, max: 76.161ms, σ = 3.276ms, N = 69
dev-ruby/sinatra-3.0.5-r1::/home/sam/g/: mean: 72.967ms, min: 60.127ms, max: 76.75ms, σ = 3.176ms, N = 69
dev-ruby/sinatra-3.0.5::/home/sam/g/: mean: 69.004ms, min: 58.344ms, max: 73.661ms, σ = 3.3ms, N = 73
dev-ruby/sinatra-2.2.3::/home/sam/g/: mean: 71.061ms, min: 55.144ms, max: 74.563ms, σ = 3.848ms, N = 71
```

A tiny, but seemingly consistent improvement.

Thanks to mgorny for the idea.

Bug: https://bugs.gentoo.org/908465
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 8befa086ef020..5a6edb1bf6080 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -107,7 +107,7 @@ _ruby_get_all_impls() {
 	for i in ${USE_RUBY}; do
 		case ${i} in
 			# removed implementations
-			ruby19|ruby20|ruby21|ruby22|ruby23|ruby24|ruby25|ruby26|ruby27|jruby)
+			ruby19|ruby2[0-7]|jruby)
 				;;
 			*)
 				found_valid_impl=1
-- 
2.41.0



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

* [gentoo-dev] [PATCH 02/11] ruby-ng.eclass: optimize: use pattern substitution
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 03/11] ruby-ng.eclass: optimize: avoid subshell for ruby_get_all_impls Sam James
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

We can save a little bit (consistently a few ms) by using patsubs in some
obvious cases.

Not really any difference globally, but for sinatra:
```
$ pk pkg source $(pkg) --repo ~/g/ --bench 5s # before
dev-ruby/sinatra-3.0.5::/home/sam/g/: mean: 76.25ms, min: 59.23ms, max: 83.674ms, σ = 4.247ms, N = 66
dev-ruby/sinatra-3.0.5-r1::/home/sam/g/: mean: 77.465ms, min: 61.782ms, max: 85.127ms, σ = 3.592ms, N = 65
dev-ruby/sinatra-3.0.6::/home/sam/g/: mean: 80.192ms, min: 60.922ms, max: 84.951ms, σ = 3.899ms, N = 63
dev-ruby/sinatra-2.2.3::/home/sam/g/: mean: 80.389ms, min: 56.818ms, max: 86.915ms, σ = 4.508ms, N = 63

$ pk pkg source $(pkg) --repo ~/g/ --bench 5s # after
dev-ruby/sinatra-2.2.3::/home/sam/g/: mean: 66.68ms, min: 56.938ms, max: 74.248ms, σ = 4.832ms, N = 75
dev-ruby/sinatra-3.0.6::/home/sam/g/: mean: 73.618ms, min: 60.153ms, max: 77.978ms, σ = 3.195ms, N = 68
dev-ruby/sinatra-3.0.5::/home/sam/g/: mean: 72.069ms, min: 58.736ms, max: 78.223ms, σ = 3.277ms, N = 70
dev-ruby/sinatra-3.0.5-r1::/home/sam/g/: mean: 73.265ms, min: 60.738ms, max: 81.06ms, σ = 3.227ms, N = 69
```

Bug: https://bugs.gentoo.org/908465
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 5a6edb1bf6080..2bf1885d38031 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -183,11 +183,11 @@ _ruby_wrap_conditions() {
 	local conditions="$1"
 	local atoms="$2"
 
-	for condition in $conditions; do
+	for condition in ${conditions}; do
 		atoms="${condition}? ( ${atoms} )"
 	done
 
-	echo "$atoms"
+	echo "${atoms}"
 }
 
 # @FUNCTION: ruby_add_rdepend
@@ -322,11 +322,9 @@ ruby_get_use_implementations() {
 ruby_get_use_targets() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local t implementation
-	for implementation in $(_ruby_get_all_impls); do
-		t+=" ruby_targets_${implementation}"
-	done
-	echo $t
+
+	local impls="$(_ruby_get_all_impls)"
+	echo "${impls//ruby/ruby_targets_ruby}"
 }
 
 # @FUNCTION: ruby_implementations_depend
-- 
2.41.0



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

* [gentoo-dev] [PATCH 03/11] ruby-ng.eclass: optimize: avoid subshell for ruby_get_all_impls
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 02/11] ruby-ng.eclass: optimize: use pattern substitution Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 04/11] ruby-ng.eclass: optimize: avoid subshells for _ruby_atoms_samelib* Sam James
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

We go from ~4s -> ~3.5s for sourcing dev-ruby/*.

For sinatra:

```
$ pk pkg source $(pkg) --repo ~/g/ --bench 5s # before
dev-ruby/sinatra-2.2.3::/home/sam/g/: mean: 66.68ms, min: 56.938ms, max: 74.248ms, σ = 4.832ms, N = 75
dev-ruby/sinatra-3.0.6::/home/sam/g/: mean: 73.618ms, min: 60.153ms, max: 77.978ms, σ = 3.195ms, N = 68
dev-ruby/sinatra-3.0.5::/home/sam/g/: mean: 72.069ms, min: 58.736ms, max: 78.223ms, σ = 3.277ms, N = 70
dev-ruby/sinatra-3.0.5-r1::/home/sam/g/: mean: 73.265ms, min: 60.738ms, max: 81.06ms, σ = 3.227ms, N = 69

$ pk pkg source $(pkg) --repo ~/g/ --bench 5s # after
dev-ruby/sinatra-3.0.5-r1::/home/sam/g/: mean: 59.677ms, min: 49.141ms, max: 63.282ms, σ = 2.511ms, N = 84
dev-ruby/sinatra-3.0.6::/home/sam/g/: mean: 59.693ms, min: 48.637ms, max: 62.862ms, σ = 2.628ms, N = 84
dev-ruby/sinatra-3.0.5::/home/sam/g/: mean: 56.697ms, min: 46.782ms, max: 60.367ms, σ = 2.822ms, N = 89
dev-ruby/sinatra-2.2.3::/home/sam/g/: mean: 54.915ms, min: 45.832ms, max: 59.513ms, σ = 3.52ms, N = 92
```

Bug: https://bugs.gentoo.org/908465
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 2bf1885d38031..ee2e6b89edb41 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -102,6 +102,7 @@ ruby_implementation_depend() {
 # @DESCRIPTION:
 # Return a list of valid implementations in USE_RUBY, skipping the old
 # implementations that are no longer supported.
+_RUBY_GET_ALL_IMPLS=()
 _ruby_get_all_impls() {
 	local i found_valid_impl
 	for i in ${USE_RUBY}; do
@@ -111,7 +112,8 @@ _ruby_get_all_impls() {
 				;;
 			*)
 				found_valid_impl=1
-				echo ${i};;
+				_RUBY_GET_ALL_IMPLS+=( ${i} )
+				;;
 		esac
 	done
 
@@ -131,7 +133,7 @@ ruby_samelib() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	local res=
-	for _ruby_implementation in $(_ruby_get_all_impls); do
+	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		has -${_ruby_implementation} $@ || \
 			res="${res}ruby_targets_${_ruby_implementation}(-)?,"
 	done
@@ -174,7 +176,7 @@ ruby_implementation_command() {
 _ruby_atoms_samelib() {
 	local atoms=$(_ruby_atoms_samelib_generic "$*")
 
-	for _ruby_implementation in $(_ruby_get_all_impls); do
+	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
 	done
 }
@@ -310,7 +312,7 @@ ruby_get_use_implementations() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	local i implementation
-	for implementation in $(_ruby_get_all_impls); do
+	for implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		use ruby_targets_${implementation} && i+=" ${implementation}"
 	done
 	echo $i
@@ -322,8 +324,8 @@ ruby_get_use_implementations() {
 ruby_get_use_targets() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-
-	local impls="$(_ruby_get_all_impls)"
+	_ruby_get_all_impls
+	local impls="${_RUBY_GET_ALL_IMPLS[@]}"
 	echo "${impls//ruby/ruby_targets_ruby}"
 }
 
@@ -346,13 +348,14 @@ ruby_get_use_targets() {
 ruby_implementations_depend() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local depend
-	for _ruby_implementation in $(_ruby_get_all_impls); do
+	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
 	done
 	echo "${depend}"
 }
 
+_ruby_get_all_impls
+
 IUSE+=" $(ruby_get_use_targets)"
 # If you specify RUBY_OPTIONAL you also need to take care of
 # ruby useflag and dependency.
@@ -412,7 +415,7 @@ _ruby_invoke_environment() {
 
 _ruby_each_implementation() {
 	local invoked=no
-	for _ruby_implementation in $(_ruby_get_all_impls); do
+	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		# only proceed if it's requested
 		use ruby_targets_${_ruby_implementation} || continue
 
@@ -435,7 +438,7 @@ _ruby_each_implementation() {
 
 	if [[ ${invoked} == "no" ]]; then
 		eerror "You need to select at least one compatible Ruby installation target via RUBY_TARGETS in make.conf."
-		eerror "Compatible targets for this package are: $(_ruby_get_all_impls)"
+		eerror "Compatible targets for this package are: ${_RUBY_GET_ALL_IMPLS[@]}"
 		eerror
 		eerror "See https://www.gentoo.org/proj/en/prog_lang/ruby/index.xml#doc_chap3 for more information."
 		eerror
-- 
2.41.0



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

* [gentoo-dev] [PATCH 04/11] ruby-ng.eclass: optimize: avoid subshells for _ruby_atoms_samelib*
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 02/11] ruby-ng.eclass: optimize: use pattern substitution Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 03/11] ruby-ng.eclass: optimize: avoid subshell for ruby_get_all_impls Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 05/11] ruby-ng.eclass: optimize: avoid subshells for ruby_implementations_depend, ruby_get_use_targets Sam James
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

- Inline ruby_atoms_samelib (only used by one caller)
- Avoid repeated (subshell) calls to _ruby_atoms_samelib_generic by using a result
  variable instead.

We go from 3.5s -> 2.5s to source dev-ruby/*.

Thanks to mgorny for the ideas here.

Bug: https://bugs.gentoo.org/908465
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 57 ++++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index ee2e6b89edb41..cf66fcec2f05d 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -141,23 +141,6 @@ ruby_samelib() {
 	echo "[${res%,}]"
 }
 
-_ruby_atoms_samelib_generic() {
-	eshopts_push -o noglob
-	echo "RUBYTARGET? ("
-	for token in $*; do
-		case "$token" in
-			"||" | "(" | ")" | *"?")
-				echo "${token}" ;;
-			*])
-				echo "${token%[*}[RUBYTARGET(-),${token/*[}" ;;
-			*)
-				echo "${token}[RUBYTARGET(-)]" ;;
-		esac
-	done
-	echo ")"
-	eshopts_pop
-}
-
 # @FUNCTION: ruby_implementation_command
 # @RETURN: the path to the given ruby implementation
 # @DESCRIPTION:
@@ -173,11 +156,29 @@ ruby_implementation_command() {
 	echo $(type -p ${_ruby_name} 2>/dev/null)
 }
 
+_RUBY_ATOMS_SAMELIB_RESULT=""
 _ruby_atoms_samelib() {
-	local atoms=$(_ruby_atoms_samelib_generic "$*")
+	_RUBY_ATOMS_SAMELIB_RESULT=""
+
+	eshopts_push -o noglob
+	local token
+	local atoms=" RUBYTARGET? ("
+	for token in $*; do
+		case "${token}" in
+			"||" | "(" | ")" | *"?")
+				atoms+=" ${token}" ;;
+			*])
+				atoms+=" ${token%[*}[RUBYTARGET(-),${token/*[}" ;;
+			*)
+				atoms+=" ${token}[RUBYTARGET(-)]" ;;
+		esac
+	done
+	atoms+=" ) "
+	eshopts_pop
 
+	local _ruby_implementation
 	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
-		echo "${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
+		_RUBY_ATOMS_SAMELIB_RESULT+="${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
 	done
 }
 
@@ -226,15 +227,15 @@ ruby_add_rdepend() {
 			;;
 	esac
 
-	local dependency=$(_ruby_atoms_samelib "$1")
+	_ruby_atoms_samelib "$1"
 
-	RDEPEND="${RDEPEND} $dependency"
+	RDEPEND="${RDEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}"
 
 	# Add the dependency as a test-dependency since we're going to
 	# execute the code during test phase.
 	case ${EAPI} in
-		6) DEPEND="${DEPEND} test? ( ${dependency} )" ;;
-		*) BDEPEND="${BDEPEND} test? ( ${dependency} )" ;;
+		6) DEPEND="${DEPEND} test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;;
+		*) BDEPEND="${BDEPEND} test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;;
 	esac
 	if ! has test "$IUSE"; then
 		IUSE+=" test"
@@ -273,11 +274,11 @@ ruby_add_bdepend() {
 			;;
 	esac
 
-	local dependency=$(_ruby_atoms_samelib "$1")
+	_ruby_atoms_samelib "$1"
 
 	case ${EAPI} in
-		6) DEPEND="${DEPEND} $dependency" ;;
-		*) BDEPEND="${BDEPEND} $dependency" ;;
+		6) DEPEND="${DEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
+		*) BDEPEND="${BDEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
 	esac
 	RDEPEND="${RDEPEND}"
 }
@@ -300,9 +301,9 @@ ruby_add_depend() {
 		*) die "bad number of arguments to $0" ;;
 	esac
 
-	local dependency=$(_ruby_atoms_samelib "$1")
+	_ruby_atoms_samelib "$1"
 
-	DEPEND="${DEPEND} $dependency"
+	DEPEND="${DEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}"
 }
 
 # @FUNCTION: ruby_get_use_implementations
-- 
2.41.0



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

* [gentoo-dev] [PATCH 05/11] ruby-ng.eclass: optimize: avoid subshells for ruby_implementations_depend, ruby_get_use_targets
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (2 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 04/11] ruby-ng.eclass: optimize: avoid subshells for _ruby_atoms_samelib* Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 06/11] ruby-ng.eclass: use bash += Sam James
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

We go from 2.5s -> 1.9s to source dev-ruby/*.

Bug: https://bugs.gentoo.org/908465
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index cf66fcec2f05d..6c5666ddeabb0 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -325,9 +325,20 @@ ruby_get_use_implementations() {
 ruby_get_use_targets() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	_ruby_get_all_impls
+	_ruby_get_use_targets
+	echo "${_RUBY_GET_USE_TARGETS}"
+}
+
+# @FUNCTION: _ruby_get_use_targets
+# @INTERNAL
+# @DESCRIPTION:
+# Gets an array of ruby use targets that the ebuild sets
+_RUBY_GET_USE_TARGETS=""
+_ruby_get_use_targets() {
+	debug-print-function ${FUNCNAME} "${@}"
+
 	local impls="${_RUBY_GET_ALL_IMPLS[@]}"
-	echo "${impls//ruby/ruby_targets_ruby}"
+	_RUBY_GET_USE_TARGETS="${impls//ruby/ruby_targets_ruby}"
 }
 
 # @FUNCTION: ruby_implementations_depend
@@ -346,27 +357,36 @@ ruby_get_use_targets() {
 # ...
 # DEPEND="ruby? ( $(ruby_implementations_depend) )"
 # RDEPEND="${DEPEND}"
+_RUBY_IMPLEMENTATIONS_DEPEND=""
 ruby_implementations_depend() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_ruby_implementations_depend
+	echo "${_RUBY_IMPLEMENTATIONS_DEPEND}"
+}
+
+_ruby_implementations_depend() {
+	local depend _ruby_implementation
 	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
 	done
-	echo "${depend}"
+	_RUBY_IMPLEMENTATIONS_DEPEND="${depend}"
 }
 
 _ruby_get_all_impls
+_ruby_get_use_targets
+_ruby_implementations_depend
 
-IUSE+=" $(ruby_get_use_targets)"
+IUSE+=" ${_RUBY_GET_USE_TARGETS}"
 # If you specify RUBY_OPTIONAL you also need to take care of
 # ruby useflag and dependency.
 if [[ ${RUBY_OPTIONAL} != yes ]]; then
-	DEPEND="${DEPEND} $(ruby_implementations_depend)"
-	RDEPEND="${RDEPEND} $(ruby_implementations_depend)"
-	REQUIRED_USE+=" || ( $(ruby_get_use_targets) )"
+	DEPEND="${DEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}"
+	RDEPEND="${RDEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}"
+	REQUIRED_USE+=" || ( ${_RUBY_GET_USE_TARGETS} )"
 	case ${EAPI} in
 		6) ;;
-		*) BDEPEND="${BDEPEND} $(ruby_implementations_depend)" ;;
+		*) BDEPEND="${BDEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}" ;;
 	esac
 fi
 
-- 
2.41.0



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

* [gentoo-dev] [PATCH 06/11] ruby-ng.eclass: use bash +=
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (3 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 05/11] ruby-ng.eclass: optimize: avoid subshells for ruby_implementations_depend, ruby_get_use_targets Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 07/11] ruby-ng.eclass: use bash tests Sam James
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Easier to read.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 6c5666ddeabb0..b20c3b4629155 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -229,13 +229,13 @@ ruby_add_rdepend() {
 
 	_ruby_atoms_samelib "$1"
 
-	RDEPEND="${RDEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}"
+	RDEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}"
 
 	# Add the dependency as a test-dependency since we're going to
 	# execute the code during test phase.
 	case ${EAPI} in
-		6) DEPEND="${DEPEND} test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;;
-		*) BDEPEND="${BDEPEND} test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;;
+		6) DEPEND+=" test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;;
+		*) BDEPEND+=" test? ( ${_RUBY_ATOMS_SAMELIB_RESULT} )" ;;
 	esac
 	if ! has test "$IUSE"; then
 		IUSE+=" test"
@@ -277,8 +277,8 @@ ruby_add_bdepend() {
 	_ruby_atoms_samelib "$1"
 
 	case ${EAPI} in
-		6) DEPEND="${DEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
-		*) BDEPEND="${BDEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
+		6) DEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
+		*) BDEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
 	esac
 	RDEPEND="${RDEPEND}"
 }
@@ -303,7 +303,7 @@ ruby_add_depend() {
 
 	_ruby_atoms_samelib "$1"
 
-	DEPEND="${DEPEND} ${_RUBY_ATOMS_SAMELIB_RESULT}"
+	DEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}"
 }
 
 # @FUNCTION: ruby_get_use_implementations
@@ -381,12 +381,12 @@ IUSE+=" ${_RUBY_GET_USE_TARGETS}"
 # If you specify RUBY_OPTIONAL you also need to take care of
 # ruby useflag and dependency.
 if [[ ${RUBY_OPTIONAL} != yes ]]; then
-	DEPEND="${DEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}"
-	RDEPEND="${RDEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}"
+	DEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}"
+	RDEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}"
 	REQUIRED_USE+=" || ( ${_RUBY_GET_USE_TARGETS} )"
 	case ${EAPI} in
 		6) ;;
-		*) BDEPEND="${BDEPEND} ${_RUBY_IMPLEMENTATIONS_DEPEND}" ;;
+		*) BDEPEND+=" ${_RUBY_IMPLEMENTATIONS_DEPEND}" ;;
 	esac
 fi
 
-- 
2.41.0



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

* [gentoo-dev] [PATCH 07/11] ruby-ng.eclass: use bash tests
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (4 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 06/11] ruby-ng.eclass: use bash += Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 08/11] ruby-ng.eclass: drop no-op RDEPEND assignment Sam James
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index b20c3b4629155..f10c987ac44a7 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -392,7 +392,7 @@ fi
 
 _ruby_invoke_environment() {
 	old_S=${S}
-	if [ -z "${RUBY_S}" ]; then
+	if [[ -z ${RUBY_S} ]]; then
 		sub_S=${P}
 	else
 		sub_S=${RUBY_S}
@@ -728,7 +728,7 @@ ruby-ng_rspec() {
 
 	# Explicitly pass the expected spec directory since the versioned
 	# rspec wrappers don't handle this automatically.
-	if [ ${#@} -eq 0 ]; then
+	if [[ $# -eq 0 ]]; then
 		files="spec"
 	fi
 
-- 
2.41.0



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

* [gentoo-dev] [PATCH 08/11] ruby-ng.eclass: drop no-op RDEPEND assignment
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (5 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 07/11] ruby-ng.eclass: use bash tests Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 09/11] ruby-ng.eclass: cater to USE_RUBY conditional calls Sam James
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 1 -
 1 file changed, 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index f10c987ac44a7..3269ed52cafe0 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -280,7 +280,6 @@ ruby_add_bdepend() {
 		6) DEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
 		*) BDEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}" ;;
 	esac
-	RDEPEND="${RDEPEND}"
 }
 
 # @FUNCTION: ruby_add_depend
-- 
2.41.0



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

* [gentoo-dev] [PATCH 09/11] ruby-ng.eclass: cater to USE_RUBY conditional calls
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (6 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 08/11] ruby-ng.eclass: drop no-op RDEPEND assignment Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass Sam James
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Packages may try to restrict their test dependencies to ease bootstrapping/porting
if they're not yet available for a newer Ruby implementation by setting
USE_RUBY="<some subset of original USE_RUBY>" ruby_add_bdepend ...

For example, dev-ruby/parallel does:
```
 # Rails isn't yet ruby32-ready in Gentoo
 USE_RUBY="ruby27 ruby30 ruby31" ruby_add_bdepend "
         test? ( dev-ruby/activerecord[sqlite] )
```

This isn't ideal, but we don't have a ruby_gen_cond_dep right now, so
cater to this usecase by invalidating the caches we've previously added
if we've detected USE_RUBY changed.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 40 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 3269ed52cafe0..14f4414337d6f 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -102,8 +102,9 @@ ruby_implementation_depend() {
 # @DESCRIPTION:
 # Return a list of valid implementations in USE_RUBY, skipping the old
 # implementations that are no longer supported.
-_RUBY_GET_ALL_IMPLS=()
 _ruby_get_all_impls() {
+	_RUBY_GET_ALL_IMPLS=()
+
 	local i found_valid_impl
 	for i in ${USE_RUBY}; do
 		case ${i} in
@@ -132,6 +133,8 @@ _ruby_get_all_impls() {
 ruby_samelib() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_ruby_set_globals_invalidate_if_stale
+
 	local res=
 	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		has -${_ruby_implementation} $@ || \
@@ -176,6 +179,7 @@ _ruby_atoms_samelib() {
 	atoms+=" ) "
 	eshopts_pop
 
+	_ruby_set_globals_invalidate_if_stale
 	local _ruby_implementation
 	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		_RUBY_ATOMS_SAMELIB_RESULT+="${atoms//RUBYTARGET/ruby_targets_${_ruby_implementation}}"
@@ -227,6 +231,7 @@ ruby_add_rdepend() {
 			;;
 	esac
 
+	_ruby_set_globals_invalidate_if_stale
 	_ruby_atoms_samelib "$1"
 
 	RDEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}"
@@ -274,6 +279,7 @@ ruby_add_bdepend() {
 			;;
 	esac
 
+	_ruby_set_globals_invalidate_if_stale
 	_ruby_atoms_samelib "$1"
 
 	case ${EAPI} in
@@ -300,6 +306,7 @@ ruby_add_depend() {
 		*) die "bad number of arguments to $0" ;;
 	esac
 
+	_ruby_set_globals_invalidate_if_stale
 	_ruby_atoms_samelib "$1"
 
 	DEPEND+=" ${_RUBY_ATOMS_SAMELIB_RESULT}"
@@ -311,6 +318,8 @@ ruby_add_depend() {
 ruby_get_use_implementations() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_ruby_set_globals_invalidate_if_stale
+
 	local i implementation
 	for implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		use ruby_targets_${implementation} && i+=" ${implementation}"
@@ -324,6 +333,7 @@ ruby_get_use_implementations() {
 ruby_get_use_targets() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_ruby_set_globals_invalidate_if_stale
 	_ruby_get_use_targets
 	echo "${_RUBY_GET_USE_TARGETS}"
 }
@@ -336,6 +346,8 @@ _RUBY_GET_USE_TARGETS=""
 _ruby_get_use_targets() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_ruby_set_globals_invalidate_if_stale
+
 	local impls="${_RUBY_GET_ALL_IMPLS[@]}"
 	_RUBY_GET_USE_TARGETS="${impls//ruby/ruby_targets_ruby}"
 }
@@ -360,11 +372,14 @@ _RUBY_IMPLEMENTATIONS_DEPEND=""
 ruby_implementations_depend() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_ruby_set_globals_invalidate_if_stale
 	_ruby_implementations_depend
 	echo "${_RUBY_IMPLEMENTATIONS_DEPEND}"
 }
 
 _ruby_implementations_depend() {
+	_ruby_set_globals_invalidate_if_stale
+
 	local depend _ruby_implementation
 	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		depend="${depend}${depend+ }ruby_targets_${_ruby_implementation}? ( $(ruby_implementation_depend $_ruby_implementation) )"
@@ -372,9 +387,24 @@ _ruby_implementations_depend() {
 	_RUBY_IMPLEMENTATIONS_DEPEND="${depend}"
 }
 
-_ruby_get_all_impls
-_ruby_get_use_targets
-_ruby_implementations_depend
+_ruby_set_globals() {
+	_RUBY_SET_GLOBALS_USE_RUBY="${USE_RUBY}"
+	_ruby_get_all_impls
+	_ruby_get_use_targets
+	_ruby_implementations_depend
+}
+
+_ruby_set_globals_invalidate_if_stale() {
+	# Packages may try to restrict their test dependencies to ease bootstrapping/porting
+	# if they're not yet available for a newer Ruby implementation by setting
+	# USE_RUBY="<some subset of original USE_RUBY>" ruby_add_bdepend ...
+	if [[ ${_RUBY_SET_GLOBALS_USE_RUBY} != ${USE_RUBY} && -z ${_RUBY_SET_GLOBALS_INVALIDATING} ]] ; then
+		local _RUBY_SET_GLOBALS_INVALIDATING=1
+		_ruby_set_globals
+	fi
+}
+
+_ruby_set_globals
 
 IUSE+=" ${_RUBY_GET_USE_TARGETS}"
 # If you specify RUBY_OPTIONAL you also need to take care of
@@ -434,6 +464,8 @@ _ruby_invoke_environment() {
 }
 
 _ruby_each_implementation() {
+	_ruby_set_globals_invalidate_if_stale
+
 	local invoked=no
 	for _ruby_implementation in "${_RUBY_GET_ALL_IMPLS[@]}"; do
 		# only proceed if it's requested
-- 
2.41.0



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

* [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (7 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 09/11] ruby-ng.eclass: cater to USE_RUBY conditional calls Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 16:27   ` Petr Vaněk
  2023-06-15 18:07   ` Hans de Graaff
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 11/11] ruby-ng.eclass: add _ruby_get_use_targets comment Sam James
  2023-06-15 18:08 ` [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Hans de Graaff
  10 siblings, 2 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

ulm points out that estack.eclass is particularly inefficient (although
it'll get slightly better once https://github.com/gentoo/gentoo/pull/31437
is fixed).

Let's just manually roll it like llvm.eclass does.

Bug: https://bugs.gentoo.org/908465
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 14f4414337d6f..8fe26057e7ffe 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -163,7 +163,8 @@ _RUBY_ATOMS_SAMELIB_RESULT=""
 _ruby_atoms_samelib() {
 	_RUBY_ATOMS_SAMELIB_RESULT=""
 
-	eshopts_push -o noglob
+        local shopt_save=$(shopt -p -o noglob)
+	set -f
 	local token
 	local atoms=" RUBYTARGET? ("
 	for token in $*; do
@@ -177,7 +178,7 @@ _ruby_atoms_samelib() {
 		esac
 	done
 	atoms+=" ) "
-	eshopts_pop
+	${shopt_save}
 
 	_ruby_set_globals_invalidate_if_stale
 	local _ruby_implementation
-- 
2.41.0



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

* [gentoo-dev] [PATCH 11/11] ruby-ng.eclass: add _ruby_get_use_targets comment
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (8 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass Sam James
@ 2023-06-15 15:52 ` Sam James
  2023-06-15 18:08 ` [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Hans de Graaff
  10 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 15:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

I don't see us adding a non-ruby* target any time soon so this should be fine.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index 8fe26057e7ffe..043e3eefcbd68 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -105,6 +105,8 @@ ruby_implementation_depend() {
 _ruby_get_all_impls() {
 	_RUBY_GET_ALL_IMPLS=()
 
+	# XXX: Please update _ruby_get_use_targets if adding a non-'ruby*'
+	# target.
 	local i found_valid_impl
 	for i in ${USE_RUBY}; do
 		case ${i} in
@@ -350,6 +352,7 @@ _ruby_get_use_targets() {
 	_ruby_set_globals_invalidate_if_stale
 
 	local impls="${_RUBY_GET_ALL_IMPLS[@]}"
+	# XXX: This assumes all targets begin with 'ruby'.
 	_RUBY_GET_USE_TARGETS="${impls//ruby/ruby_targets_ruby}"
 }
 
-- 
2.41.0



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

* Re: [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass Sam James
@ 2023-06-15 16:27   ` Petr Vaněk
  2023-06-15 21:12     ` Sam James
  2023-06-15 18:07   ` Hans de Graaff
  1 sibling, 1 reply; 17+ messages in thread
From: Petr Vaněk @ 2023-06-15 16:27 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

On Thu, Jun 15, 2023 at 04:52:37PM +0100, Sam James wrote:
> ulm points out that estack.eclass is particularly inefficient (although
> it'll get slightly better once https://github.com/gentoo/gentoo/pull/31437
> is fixed).
> 
> Let's just manually roll it like llvm.eclass does.
> 
> Bug: https://bugs.gentoo.org/908465
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
>  eclass/ruby-ng.eclass | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
> index 14f4414337d6f..8fe26057e7ffe 100644
> --- a/eclass/ruby-ng.eclass
> +++ b/eclass/ruby-ng.eclass
> @@ -163,7 +163,8 @@ _RUBY_ATOMS_SAMELIB_RESULT=""
>  _ruby_atoms_samelib() {
>  	_RUBY_ATOMS_SAMELIB_RESULT=""
>  
> -	eshopts_push -o noglob
> +        local shopt_save=$(shopt -p -o noglob)
   ^~~~~~~~
	Wrong indentation - expanded tab instead of tab
> +	set -f
>  	local token
>  	local atoms=" RUBYTARGET? ("
>  	for token in $*; do
> @@ -177,7 +178,7 @@ _ruby_atoms_samelib() {
>  		esac
>  	done
>  	atoms+=" ) "
> -	eshopts_pop
> +	${shopt_save}
>  
>  	_ruby_set_globals_invalidate_if_stale
>  	local _ruby_implementation
> -- 
> 2.41.0
> 
> 


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

* Re: [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass Sam James
  2023-06-15 16:27   ` Petr Vaněk
@ 2023-06-15 18:07   ` Hans de Graaff
  2023-06-15 21:11     ` Sam James
  1 sibling, 1 reply; 17+ messages in thread
From: Hans de Graaff @ 2023-06-15 18:07 UTC (permalink / raw
  To: gentoo-dev

On Thu, 1970-01-01 at 00:00 +0000, Sam James wrote:
> ulm points out that estack.eclass is particularly inefficient
> (although
> it'll get slightly better once
> https://github.com/gentoo/gentoo/pull/31437
> is fixed).
> 
> Let's just manually roll it like llvm.eclass does.

It looks like that was the only use for inhering estack? If so that
inherit can go too, right?

Hans


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

* Re: [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls
  2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
                   ` (9 preceding siblings ...)
  2023-06-15 15:52 ` [gentoo-dev] [PATCH 11/11] ruby-ng.eclass: add _ruby_get_use_targets comment Sam James
@ 2023-06-15 18:08 ` Hans de Graaff
  2023-06-15 21:12   ` Sam James
  10 siblings, 1 reply; 17+ messages in thread
From: Hans de Graaff @ 2023-06-15 18:08 UTC (permalink / raw
  To: gentoo-dev

On Thu, 1970-01-01 at 00:00 +0000, Sam James wrote:
> Not much improvement on a grand scale, but for dev-ruby/sinatra at
> least, we get:

Reviewed all patches and they look good to me.

Thanks!

Hans


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

* Re: [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass
  2023-06-15 18:07   ` Hans de Graaff
@ 2023-06-15 21:11     ` Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 21:11 UTC (permalink / raw
  To: gentoo-dev

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


Hans de Graaff <graaff@gentoo.org> writes:

> On Thu, 1970-01-01 at 00:00 +0000, Sam James wrote:
>> ulm points out that estack.eclass is particularly inefficient
>> (although
>> it'll get slightly better once
>> https://github.com/gentoo/gentoo/pull/31437
>> is fixed).
>> 
>> Let's just manually roll it like llvm.eclass does.
>
> It looks like that was the only use for inhering estack? If so that
> inherit can go too, right?

Good spot - thanks!
>
> Hans

best,
sam

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

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

* Re: [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls
  2023-06-15 18:08 ` [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Hans de Graaff
@ 2023-06-15 21:12   ` Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 21:12 UTC (permalink / raw
  To: gentoo-dev

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


Hans de Graaff <graaff@gentoo.org> writes:

> On Thu, 1970-01-01 at 00:00 +0000, Sam James wrote:
>> Not much improvement on a grand scale, but for dev-ruby/sinatra at
>> least, we get:
>
> Reviewed all patches and they look good to me.
>
> Thanks!

And thank you!

>
> Hans

best,
sam

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

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

* Re: [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass
  2023-06-15 16:27   ` Petr Vaněk
@ 2023-06-15 21:12     ` Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-06-15 21:12 UTC (permalink / raw
  To: Petr Vaněk; +Cc: gentoo-dev, ruby

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


Petr Vaněk <arkamar@atlas.cz> writes:

> On Thu, Jun 15, 2023 at 04:52:37PM +0100, Sam James wrote:
>> ulm points out that estack.eclass is particularly inefficient (although
>> it'll get slightly better once https://github.com/gentoo/gentoo/pull/31437
>> is fixed).
>> 
>> Let's just manually roll it like llvm.eclass does.
>> 
>> Bug: https://bugs.gentoo.org/908465
>> Signed-off-by: Sam James <sam@gentoo.org>
>> ---
>>  eclass/ruby-ng.eclass | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
>> index 14f4414337d6f..8fe26057e7ffe 100644
>> --- a/eclass/ruby-ng.eclass
>> +++ b/eclass/ruby-ng.eclass
>> @@ -163,7 +163,8 @@ _RUBY_ATOMS_SAMELIB_RESULT=""
>>  _ruby_atoms_samelib() {
>>  	_RUBY_ATOMS_SAMELIB_RESULT=""
>>  
>> -	eshopts_push -o noglob
>> +        local shopt_save=$(shopt -p -o noglob)
>    ^~~~~~~~
> 	Wrong indentation - expanded tab instead of tab
>> +	set -f

Thanks!

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

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

end of thread, other threads:[~2023-06-15 21:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15 15:52 [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 02/11] ruby-ng.eclass: optimize: use pattern substitution Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 03/11] ruby-ng.eclass: optimize: avoid subshell for ruby_get_all_impls Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 04/11] ruby-ng.eclass: optimize: avoid subshells for _ruby_atoms_samelib* Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 05/11] ruby-ng.eclass: optimize: avoid subshells for ruby_implementations_depend, ruby_get_use_targets Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 06/11] ruby-ng.eclass: use bash += Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 07/11] ruby-ng.eclass: use bash tests Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 08/11] ruby-ng.eclass: drop no-op RDEPEND assignment Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 09/11] ruby-ng.eclass: cater to USE_RUBY conditional calls Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 10/11] ruby-ng.eclass: use shopt directly, not via estack.eclass Sam James
2023-06-15 16:27   ` Petr Vaněk
2023-06-15 21:12     ` Sam James
2023-06-15 18:07   ` Hans de Graaff
2023-06-15 21:11     ` Sam James
2023-06-15 15:52 ` [gentoo-dev] [PATCH 11/11] ruby-ng.eclass: add _ruby_get_use_targets comment Sam James
2023-06-15 18:08 ` [gentoo-dev] [PATCH 01/11] ruby-ng.eclass: optimize: use pattern for old ruby impls Hans de Graaff
2023-06-15 21:12   ` Sam James

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