public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset
@ 2023-04-07 10:14 Sam James
  2023-04-07 10:14 ` [gentoo-dev] [PATCH 2/2] ruby-fakegem.eclass: include ${PF} in global-scope eqawarn Sam James
  2023-04-10  8:24 ` [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Hans de Graaff
  0 siblings, 2 replies; 4+ messages in thread
From: Sam James @ 2023-04-07 10:14 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

This might prevent an ebuild installing no files, but the main aim here is
to give a better error message earlier on rather than the classic
"Unable to generate gemspec file".

The output looks like:
```
 * Failed to determine a path for ${RUBY} for USE=ruby_targets_ruby31:
 *  ruby_implementation_command returned an empty RUBY for ruby31
 * ERROR: dev-ruby/mercenary-0.4.0-r1::gentoo failed (setup phase):
 *   Could not find RUBY for ruby31. Is dev-lang/ruby:3.1 installed?
```

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

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index b81038237a6b2..d808b7bd98b3a 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -419,6 +419,13 @@ _ruby_each_implementation() {
 		use ruby_targets_${_ruby_implementation} || continue
 
 		RUBY=$(ruby_implementation_command ${_ruby_implementation})
+
+		if [[ -z ${RUBY} ]]; then
+			eerror "Failed to determine a path for \${RUBY} for USE=ruby_targets_${_ruby_implementation}:"
+			eerror " ruby_implementation_command returned an empty RUBY for ${_ruby_implementation}"
+			die "Could not find RUBY for ${_ruby_implementation}. Is $(_ruby_implementation_depend ${_ruby_implementation}) installed?"
+		fi
+
 		invoked=yes
 
 		if [[ -n "$1" ]]; then
-- 
2.40.0



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

* [gentoo-dev] [PATCH 2/2] ruby-fakegem.eclass: include ${PF} in global-scope eqawarn
  2023-04-07 10:14 [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Sam James
@ 2023-04-07 10:14 ` Sam James
  2023-04-10  8:24 ` [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Hans de Graaff
  1 sibling, 0 replies; 4+ messages in thread
From: Sam James @ 2023-04-07 10:14 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

This makes it a lot easier to narrow down the culprit given it warns in global scope.

(Apparently ${EBUILD} isn't defined in PMS.)

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

diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index b3262dc5cdb49..5dc653e1598e4 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -202,7 +202,7 @@ case ${RUBY_FAKEGEM_RECIPE_TEST} in
 	none)
 		;;
 	*)
-		eqawarn "Unknown test recipe '${RUBY_FAKEGEM_RECIPE_TEST}' specified, using 'none'"
+		eqawarn "${CATEGORY}/${PF}: Unknown test recipe '${RUBY_FAKEGEM_RECIPE_TEST}' specified, using 'none'"
 		RUBY_FAKEGEM_RECIPE_TEST="none"
 		;;
 esac
-- 
2.40.0



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

* Re: [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset
  2023-04-07 10:14 [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Sam James
  2023-04-07 10:14 ` [gentoo-dev] [PATCH 2/2] ruby-fakegem.eclass: include ${PF} in global-scope eqawarn Sam James
@ 2023-04-10  8:24 ` Hans de Graaff
  2023-04-10  8:54   ` Sam James
  1 sibling, 1 reply; 4+ messages in thread
From: Hans de Graaff @ 2023-04-10  8:24 UTC (permalink / raw
  To: gentoo-dev

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

On Fri, 2023-04-07 at 11:14 +0100, Sam James wrote:
> This might prevent an ebuild installing no files, but the main aim
> here is
> to give a better error message earlier on rather than the classic
> "Unable to generate gemspec file".

Looks good to me. Better to error out as fast as possible with a clear
message.

Hans

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset
  2023-04-10  8:24 ` [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Hans de Graaff
@ 2023-04-10  8:54   ` Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2023-04-10  8:54 UTC (permalink / raw
  To: gentoo-dev

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


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

> [[PGP Signed Part:Undecided]]
> On Fri, 2023-04-07 at 11:14 +0100, Sam James wrote:
>> This might prevent an ebuild installing no files, but the main aim
>> here is
>> to give a better error message earlier on rather than the classic
>> "Unable to generate gemspec file".
>
> Looks good to me. Better to error out as fast as possible with a clear
> message.

Thanks!

>
> Hans
>
> [[End of PGP Signed Part]]


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

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

end of thread, other threads:[~2023-04-10  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-07 10:14 [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Sam James
2023-04-07 10:14 ` [gentoo-dev] [PATCH 2/2] ruby-fakegem.eclass: include ${PF} in global-scope eqawarn Sam James
2023-04-10  8:24 ` [gentoo-dev] [PATCH 1/2] ruby-ng.eclass: error out earlier if RUBY is unset Hans de Graaff
2023-04-10  8:54   ` Sam James

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