commit:     f07caad01728dd2dddd4c7a7fc48812b2fb10bf0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  3 04:41:25 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr  3 05:07:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f07caad0

dev-ruby/sprockets: enable ruby31 for 3.7.2

Apply some desperate life support for now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/sprockets-3.7.2-ruby31-host-uri.patch    | 65 ++++++++++++++++++++++
 dev-ruby/sprockets/sprockets-3.7.2-r3.ebuild       | 65 ++++++++++++++++++++++
 2 files changed, 130 insertions(+)

diff --git a/dev-ruby/sprockets/files/sprockets-3.7.2-ruby31-host-uri.patch 
b/dev-ruby/sprockets/files/sprockets-3.7.2-ruby31-host-uri.patch
new file mode 100644
index 000000000000..1594c18fc8ec
--- /dev/null
+++ b/dev-ruby/sprockets/files/sprockets-3.7.2-ruby31-host-uri.patch
@@ -0,0 +1,65 @@
+https://github.com/rails/sprockets/commit/39490de3bdda3cb0b3aed16544b38b3771fbcca7
+
+From 39490de3bdda3cb0b3aed16544b38b3771fbcca7 Mon Sep 17 00:00:00 2001
+From: Benoit Daloze <[email protected]>
+Date: Mon, 19 Dec 2022 21:16:29 +0100
+Subject: [PATCH] Make the URI tests pass with ruby-head
+
+* host is "" instead of nil, following the upstream change:
+  https://github.com/ruby/uri/commit/81263c9e94bd67ca01deee238842a88c2c8885f3
+
+--- a/lib/sprockets/uri_utils.rb
++++ b/lib/sprockets/uri_utils.rb
+@@ -50,7 +50,7 @@ module Sprockets
+       # Hack for parsing Windows "file:///C:/Users/IEUser" paths
+       path.gsub!(/^\/([a-zA-Z]:)/, '\1'.freeze)
+ 
+-      [scheme, host, path, query]
++      [scheme, host || '', path, query]
+     end
+ 
+     # Internal: Join file: URI component parts into String.
+--- a/test/test_uri_utils.rb
++++ b/test/test_uri_utils.rb
+@@ -38,22 +38,22 @@ class TestURIUtils < MiniTest::Test
+     assert_equal ['file', 'localhost', '/etc/fstab', nil], parts
+ 
+     parts = split_file_uri("file:///etc/fstab")
+-    assert_equal ['file', nil, '/etc/fstab', nil], parts
++    assert_equal ['file', '', '/etc/fstab', nil], parts
+ 
+     parts = split_file_uri("file:///usr/local/bin/ruby%20on%20rails")
+-    assert_equal ['file', nil, '/usr/local/bin/ruby on rails', nil], parts
++    assert_equal ['file', '', '/usr/local/bin/ruby on rails', nil], parts
+ 
+     parts = 
split_file_uri("file:///usr/local/var/github/app/assets/javascripts/application.js")
+-    assert_equal ['file', nil, 
'/usr/local/var/github/app/assets/javascripts/application.js', nil], parts
++    assert_equal ['file', '', 
'/usr/local/var/github/app/assets/javascripts/application.js', nil], parts
+ 
+     parts = 
split_file_uri("file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc")
+-    assert_equal ['file', nil, 'C:/Documents and 
Settings/davris/FileSchemeURIs.doc', nil], parts
++    assert_equal ['file', '', 'C:/Documents and 
Settings/davris/FileSchemeURIs.doc', nil], parts
+ 
+     parts = split_file_uri("file:///D:/Program%20Files/Viewer/startup.htm")
+-    assert_equal ['file', nil, 'D:/Program Files/Viewer/startup.htm', nil], 
parts
++    assert_equal ['file', '', 'D:/Program Files/Viewer/startup.htm', nil], 
parts
+ 
+     parts = 
split_file_uri("file:///C:/Program%20Files/Music/Web%20Sys/main.html?REQUEST=RADIO")
+-    assert_equal ['file', nil, 'C:/Program Files/Music/Web Sys/main.html', 
'REQUEST=RADIO'], parts
++    assert_equal ['file', '', 'C:/Program Files/Music/Web Sys/main.html', 
'REQUEST=RADIO'], parts
+   end
+ 
+   def test_join_uri_path
+@@ -61,10 +61,10 @@ class TestURIUtils < MiniTest::Test
+       join_file_uri('file', 'localhost', '/etc/fstab', nil)
+ 
+     assert_equal "file:///etc/fstab",
+-      join_file_uri('file', nil, '/etc/fstab', nil)
++      join_file_uri('file', '', '/etc/fstab', nil)
+ 
+     assert_equal "file:///usr/local/bin/ruby%20on%20rails",
+-      join_file_uri('file', nil, '/usr/local/bin/ruby on rails', nil)
++      join_file_uri('file', '', '/usr/local/bin/ruby on rails', nil)
+   end
+ 
+   def test_inverse_file_uri_functions

diff --git a/dev-ruby/sprockets/sprockets-3.7.2-r3.ebuild 
b/dev-ruby/sprockets/sprockets-3.7.2-r3.ebuild
new file mode 100644
index 000000000000..81d0d002ca66
--- /dev/null
+++ b/dev-ruby/sprockets/sprockets-3.7.2-r3.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+USE_RUBY="ruby26 ruby27 ruby30 ruby31"
+
+RUBY_FAKEGEM_TASK_DOC=""
+RUBY_FAKEGEM_EXTRADOC="README.md"
+
+RUBY_FAKEGEM_GEMSPEC="sprockets.gemspec"
+
+RUBY_FAKEGEM_BINWRAP=""
+
+inherit ruby-fakegem
+
+DESCRIPTION="Ruby library for compiling and serving web assets"
+HOMEPAGE="https://github.com/rails/sprockets";
+SRC_URI="https://github.com/rails/sprockets/archive/v${PV}.tar.gz -> 
${P}-git.tgz"
+
+LICENSE="MIT"
+SLOT="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux 
~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+PATCHES=(
+       "${FILESDIR}/${P}-erb-deprecation.patch"
+       "${FILESDIR}/${P}-kwargs.patch"
+       "${FILESDIR}/${P}-ruby31-host-uri.patch"
+)
+
+ruby_add_rdepend "
+       dev-ruby/concurrent-ruby:1
+       >=dev-ruby/rack-1:* <dev-ruby/rack-3:*"
+
+ruby_add_bdepend "test? (
+               dev-ruby/json
+               dev-ruby/rack-test
+               =dev-ruby/coffee-script-2*
+               =dev-ruby/execjs-2*
+               =dev-ruby/sass-3* >=dev-ruby/sass-3.1
+               dev-ruby/uglifier
+       )"
+
+all_ruby_prepare() {
+       # Avoid tests for template types that we currently don't package:
+       # eco and ejs.
+       sed -i -e '/eco templates/,/end/ s:^:#:' \
+               -e '/ejs templates/,/end/ s:^:#:' test/test_environment.rb || 
die
+       sed -i -e '/.ejs/ s:^:#:' test/test_asset.rb || die
+       rm -f test/test_require.rb 
test/test_{closure,eco,ejs,yui}_{compressor,processor}.rb || die
+       sed -i -e "/bundler/d" Rakefile || die
+}
+
+each_ruby_prepare() {
+       sed -i -e "s:ruby:${RUBY}:" test/test_sprocketize.rb || die
+}
+
+each_ruby_test() {
+       # Make sure we have completely separate copies. Hardlinks won't work
+       # for this test suite.
+       cp -R test test-new || die
+       rm -rf test || die
+       mv test-new test || die
+
+       each_fakegem_test
+}

Reply via email to