public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH cygport] pkg_info.cygpart: Do not detect dependencies on itself in ruby package
@ 2024-02-16 12:51 Daisuke Fujimura
  2024-03-10 13:34 ` Jon Turney
  0 siblings, 1 reply; 3+ messages in thread
From: Daisuke Fujimura @ 2024-02-16 12:51 UTC (permalink / raw)
  To: cygwin-apps

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

Attempting to create a package for ruby-3.3, but it fails when trying
to detect a dependency on itself.

To avoid this, skip them if the target is `ruby`.

[-- Attachment #2: pkg_info-for-ruby.diff --]
[-- Type: application/octet-stream, Size: 1706 bytes --]

diff --git a/lib/pkg_info.cygpart b/lib/pkg_info.cygpart
index 37cfa676..9cd7d06b 100644
--- a/lib/pkg_info.cygpart
+++ b/lib/pkg_info.cygpart
@@ -557,7 +557,7 @@ for suffix, mode, type in imp.get_suffixes(): print(suffix)')
 		done
 	done
 
-	if check_prog ruby
+	if [ "${PN}" != "ruby" ] && check_prog ruby
 	then
 		rbdirs=($(ruby -e 'print($:.join(" "))'))
 		rbdirs+=" ${DEPS_PATH//:/ }"
@@ -597,19 +597,19 @@ for suffix, mode, type in imp.get_suffixes(): print(suffix)')
 				done
 			done
 		done
-	fi
 
-	rbver=( $(find "${@//^_^/ }" -path "usr/*/ruby/vendor_ruby/[0-9].[0-9]/*" \
-	        | sed -E 's!usr/.*/ruby/vendor_ruby/([0-9]).([0-9])/.*!ruby_\1\2!' \
-	        | sort -ru) )
-	if [ "${#rbver[@]}" -gt 1 ]
-	then
-		warning "More than one targeted Ruby version: ${rbver[*]},"
-		warning "using only the latest as dependency: ${rbver[0]}."
-	fi
-	if [ "${#rbver[@]}" -gt 0 ] && [ "${PN}" != "ruby" ]
-	then
-		echo "${rbver[0]}"
+		rbver=( $(find "${@//^_^/ }" -path "usr/*/ruby/vendor_ruby/[0-9].[0-9]/*" \
+				| sed -E 's!usr/.*/ruby/vendor_ruby/([0-9]).([0-9])/.*!ruby_\1\2!' \
+				| sort -ru) )
+		if [ "${#rbver[@]}" -gt 1 ]
+		then
+			warning "More than one targeted Ruby version: ${rbver[*]},"
+			warning "using only the latest as dependency: ${rbver[0]}."
+		fi
+		if [ "${#rbver[@]}" -gt 0 ]
+		then
+			echo "${rbver[0]}"
+		fi
 	fi
 
 	if [ $(find "${@//^_^/ }" -path 'usr/share/doc/*' -prune \
@@ -661,7 +661,7 @@ for suffix, mode, type in imp.get_suffixes(): print(suffix)')
 		cygruby[0-9][0-9]0.dll)
 		    rbver="${dll##*cygruby}"
 		    rbver="${rbver%%0.dll}"
-		    echo "ruby_${rbver}"
+		    [ "${PN}" != "ruby" ] && echo "ruby_${rbver}"
 		    ;;
 	    esac
 	done

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

* Re: [PATCH cygport] pkg_info.cygpart: Do not detect dependencies on itself in ruby package
  2024-02-16 12:51 [PATCH cygport] pkg_info.cygpart: Do not detect dependencies on itself in ruby package Daisuke Fujimura
@ 2024-03-10 13:34 ` Jon Turney
  2024-04-03 14:18   ` Daisuke Fujimura
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Turney @ 2024-03-10 13:34 UTC (permalink / raw)
  To: Daisuke Fujimura; +Cc: cygwin-apps

On 16/02/2024 12:51, Daisuke Fujimura via Cygwin-apps wrote:
> Attempting to create a package for ruby-3.3, but it fails when trying
> to detect a dependency on itself.

Thanks for this patch.

Can you clarify what the "failure" is here?

> To avoid this, skip them if the target is `ruby`.

The second hunk seems like a removes the dependency on ruby_xy for the 
ruby package, which also provides ruby_xy.

Historically, we've allowed self-dependencies like this, because they 
seem to be benign, although it seems like we could do with some generic 
code to suppress them

(e.g. cygport also ends up generating cygwin-debuginfo with a dependency 
on itself, which is harmless but could be suppressed)


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

* Re: [PATCH cygport] pkg_info.cygpart: Do not detect dependencies on itself in ruby package
  2024-03-10 13:34 ` Jon Turney
@ 2024-04-03 14:18   ` Daisuke Fujimura
  0 siblings, 0 replies; 3+ messages in thread
From: Daisuke Fujimura @ 2024-04-03 14:18 UTC (permalink / raw)
  To: cygwin-apps

Thank you for reviewing this.

> Can you clarify what the "failure" is here?

ruby.cygport and its CI results are as follows.

- https://cygwin.com/cgit/cygwin-packages/ruby/commit/?id=65af41c137b45d09614ea99f78d7a4818b1bdfb1
- https://github.com/cygwin/scallywag/actions/runs/7580195232/job/20645744555#step:6:22939

```
>>> Creating source package
ruby-3.3.0-1.src/
ruby-3.3.0-1.src/2.0.0-cygwin-configure.patch
ruby-3.3.0-1.src/2.0.0-cygwin-rubygems.patch
ruby-3.3.0-1.src/2.5.1-win32-resolv.patch
ruby-3.3.0-1.src/9357.patch
ruby-3.3.0-1.src/ruby-2.1.0-always-use-i386.patch
ruby-3.3.0-1.src/ruby-2.1.0-custom-rubygems-location.patch
ruby-3.3.0-1.src/ruby-2.1.0-Enable-configuration-of-archlibdir.patch
ruby-3.3.0-1.src/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch
ruby-3.3.0-1.src/ruby-2.3.0-ruby_version.patch
ruby-3.3.0-1.src/ruby-3.3.0-Disable-syntax-suggest-test-case.patch
ruby-3.3.0-1.src/ruby-3.3.0.tar.gz
ruby-3.3.0-1.src/ruby-3.4.0-ruby-net-http-Renew-test-certificates.patch
ruby-3.3.0-1.src/ruby.cygport

/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
>>> ruby requires: cygwin libcrypt2 libffi8 libgcc1 libgmp10 libssl3 libyaml0_2 ruby_33 zlib0 ca-certificates
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
>>> ruby-devel requires: pkg-config ruby ruby_33 libcrypt-devel libgmp-devel
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
/usr/share/rubygems/rubygems.rb:8:in `require': cannot load such file
-- rbconfig (LoadError)
from /usr/share/rubygems/rubygems.rb:8:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
>>> ruby-doc requires:
>>> ruby-tcltk requires: ruby-tk
>>> Testing ruby-3.3.0-1.x86_64
:
:
```

LoadError is occurring three times because the ruby.exe used to detect
dependencies in the ruby package is not /usr/bin/ruby.exe but
${D}/usr/bin/ruby.exe.

- https://github.com/cygwin/cygport/blob/0.36.8/lib/pkg_info.cygpart#L562
- https://github.com/cygwin/cygport/blob/0.36.8/lib/pkg_info.cygpart#L564
- https://github.com/cygwin/cygport/blob/0.36.8/lib/pkg_info.cygpart#L565

${D}/usr/bin/ruby.exe is used because ${D} is added to the PATH.

- https://github.com/cygwin/cygport/blob/0.36.8/lib/pkg_info.cygpart#L137

As the ruby package itself does not depend on ruby-* other than its
own sub-packages, we considered that lines 560~600 did not need to be
executed.

- https://github.com/cygwin/cygport/blob/0.36.8/lib/pkg_info.cygpart#L560-L600

As for `ruby_xy`, as pointed out, there should be no diff.


On Sun, Mar 10, 2024 at 10:34 PM Jon Turney <jon.turney@dronecode.org.uk> wrote:
>
> On 16/02/2024 12:51, Daisuke Fujimura via Cygwin-apps wrote:
> > Attempting to create a package for ruby-3.3, but it fails when trying
> > to detect a dependency on itself.
>
> Thanks for this patch.
>
> Can you clarify what the "failure" is here?
>
> > To avoid this, skip them if the target is `ruby`.
>
> The second hunk seems like a removes the dependency on ruby_xy for the
> ruby package, which also provides ruby_xy.
>
> Historically, we've allowed self-dependencies like this, because they
> seem to be benign, although it seems like we could do with some generic
> code to suppress them
>
> (e.g. cygport also ends up generating cygwin-debuginfo with a dependency
> on itself, which is harmless but could be suppressed)
>

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

end of thread, other threads:[~2024-04-03 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 12:51 [PATCH cygport] pkg_info.cygpart: Do not detect dependencies on itself in ruby package Daisuke Fujimura
2024-03-10 13:34 ` Jon Turney
2024-04-03 14:18   ` Daisuke Fujimura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).