diff --git a/Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files-test.patch b/Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files-test.patch new file mode 100644 index 0000000000000000000000000000000000000000..1495385953697268954d1e9048eb04e6f78e04f8 --- /dev/null +++ b/Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files-test.patch @@ -0,0 +1,24 @@ +From 72202aab5e5b3602ece4e8748bcdeefe2d789ab5 Mon Sep 17 00:00:00 2001 +From: Jean Boussier +Date: Fri, 13 Jan 2023 09:21:17 +0100 +Subject: [PATCH] Use `RbConfig::CONFIG["rubylibdir"]` to check for stdlib + files + +Ref: https://github.com/Shopify/bootsnap/issues/431 +--- + test/load_path_cache/path_test.rb | 2 +- + 1 file changed, 1 insertions(+), 1 deletions(-) + +diff --git a/test/load_path_cache/path_test.rb b/test/load_path_cache/path_test.rb +index 5425ed9..2c1c289 100644 +--- a/test/load_path_cache/path_test.rb ++++ b/test/load_path_cache/path_test.rb +@@ -16,7 +16,7 @@ def test_stability + volatile = Path.new(__FILE__) + stable = Path.new(time_file) + unknown = Path.new("/who/knows") +- lib = Path.new("#{RbConfig::CONFIG['libdir']}/a") ++ lib = Path.new("#{RbConfig::CONFIG['rubylibdir']}/a") + site = Path.new("#{RbConfig::CONFIG['sitedir']}/b") + absolute_prefix = RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/ ? ENV["SystemDrive"] : "" + bundler = Path.new("#{absolute_prefix}/bp/3") diff --git a/Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files.patch b/Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files.patch new file mode 100644 index 0000000000000000000000000000000000000000..264a221ec2b6408c5780047ec7fac86a72467d71 --- /dev/null +++ b/Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files.patch @@ -0,0 +1,28 @@ +From 72202aab5e5b3602ece4e8748bcdeefe2d789ab5 Mon Sep 17 00:00:00 2001 +From: Jean Boussier +Date: Fri, 13 Jan 2023 09:21:17 +0100 +Subject: [PATCH] Use `RbConfig::CONFIG["rubylibdir"]` to check for stdlib + files + +Ref: https://github.com/Shopify/bootsnap/issues/431 +--- + lib/bootsnap/load_path_cache/path.rb | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 1aadf9e..f38db3b 100644 +diff --git a/lib/bootsnap/load_path_cache/path.rb b/lib/bootsnap/load_path_cache/path.rb +index 626740c..e000c60 100644 +--- a/lib/bootsnap/load_path_cache/path.rb ++++ b/lib/bootsnap/load_path_cache/path.rb +@@ -116,8 +116,8 @@ def latest_mtime(path, dirs) + VOLATILE = :volatile + + # Built-in ruby lib stuff doesn't change, but things can occasionally be +- # installed into sitedir, which generally lives under libdir. +- RUBY_LIBDIR = RbConfig::CONFIG["libdir"] ++ # installed into sitedir, which generally lives under rubylibdir. ++ RUBY_LIBDIR = RbConfig::CONFIG["rubylibdir"] + RUBY_SITEDIR = RbConfig::CONFIG["sitedir"] + + def stability diff --git a/bootsnap-1.15.0-tests.txz b/bootsnap-1.15.0-tests.txz new file mode 100644 index 0000000000000000000000000000000000000000..07d2ee3375524f17bf510e40b31cc0f237987306 Binary files /dev/null and b/bootsnap-1.15.0-tests.txz differ diff --git a/bootsnap-1.15.0.gem b/bootsnap-1.15.0.gem new file mode 100644 index 0000000000000000000000000000000000000000..b02c3040a2caa77d8fffbc484a7eac6f9a6b0e0d Binary files /dev/null and b/bootsnap-1.15.0.gem differ diff --git a/bootsnap-1.3.2.gem b/bootsnap-1.3.2.gem deleted file mode 100644 index e4ab3093829c312af86768bda26196704adbea40..0000000000000000000000000000000000000000 Binary files a/bootsnap-1.3.2.gem and /dev/null differ diff --git a/fix-no-implicit-conversion-of-String-into-Integer.patch b/fix-no-implicit-conversion-of-String-into-Integer.patch deleted file mode 100644 index 6f61e994065c16364356a100c45c7bb7e4c0c4b2..0000000000000000000000000000000000000000 --- a/fix-no-implicit-conversion-of-String-into-Integer.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 97dd9c266fbaac188d39f7d545aa54aef80c3070 Mon Sep 17 00:00:00 2001 -From: wu-leilei -Date: Thu, 27 Jan 2022 09:35:50 +0800 -Subject: [PATCH] test 3 - ---- - ext/bootsnap/bootsnap.c | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/ext/bootsnap/bootsnap.c b/ext/bootsnap/bootsnap.c -index e0c5307..d29219a 100644 ---- a/ext/bootsnap/bootsnap.c -+++ b/ext/bootsnap/bootsnap.c -@@ -94,6 +94,7 @@ static int cache_key_equal(struct bs_cache_key * k1, struct bs_cache_key * k2); - static VALUE bs_fetch(char * path, VALUE path_v, char * cache_path, VALUE handler); - static int open_current_file(char * path, struct bs_cache_key * key, char ** errno_provenance); - static int fetch_cached_data(int fd, ssize_t data_size, VALUE handler, VALUE * output_data, int * exception_tag, char ** errno_provenance); -+static uint32_t get_ruby_revision(void); - static uint32_t get_ruby_platform(void); - - /* -@@ -134,7 +135,7 @@ Init_bootsnap(void) - rb_mBootsnap_CompileCache_Native = rb_define_module_under(rb_mBootsnap_CompileCache, "Native"); - rb_eBootsnap_CompileCache_Uncompilable = rb_define_class_under(rb_mBootsnap_CompileCache, "Uncompilable", rb_eStandardError); - -- current_ruby_revision = FIX2INT(rb_const_get(rb_cObject, rb_intern("RUBY_REVISION"))); -+ current_ruby_revision = get_ruby_revision(); - current_ruby_platform = get_ruby_platform(); - - uncompilable = rb_intern("__bootsnap_uncompilable__"); -@@ -191,6 +192,26 @@ fnv1a_64(const char *str) - return fnv1a_64_iter(h, str); - } - -+/* -+ * Ruby's revision may be Integer or String. CRuby 2.7 or later uses -+ * Git commit ID as revision. It's String. -+ */ -+static uint32_t -+get_ruby_revision(void) -+{ -+ VALUE ruby_revision; -+ -+ ruby_revision = rb_const_get(rb_cObject, rb_intern("RUBY_REVISION")); -+ if (RB_TYPE_P(ruby_revision, RUBY_T_FIXNUM)) { -+ return FIX2INT(ruby_revision); -+ } else { -+ uint64_t hash; -+ -+ hash = fnv1a_64(StringValueCStr(ruby_revision)); -+ return (uint32_t)(hash >> 32); -+ } -+} -+ - /* - * When ruby's version doesn't change, but it's recompiled on a different OS - * (or OS version), we need to invalidate the cache. --- -2.23.0 - diff --git a/rubygem-bootsnap.spec b/rubygem-bootsnap.spec index 34d661fdec0a10775ddc92464c984a8cd68ff2f6..a89aac023ff99c038067c249d820315db2698db8 100644 --- a/rubygem-bootsnap.spec +++ b/rubygem-bootsnap.spec @@ -1,15 +1,21 @@ %global gem_name bootsnap Name: rubygem-%{gem_name} -Version: 1.3.2 -Release: 4 +Version: 1.15.0 +Release: 1 Summary: Boot large ruby/rails apps faster License: MIT URL: https://github.com/Shopify/bootsnap Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem -Source1: https://github.com/Shopify/bootsnap/archive/v1.3.2.tar.gz -Patch1: fix-no-implicit-conversion-of-String-into-Integer.patch +# git clone http://github.com/Shopify/bootsnap.git --no-checkout +# cd bootsnap && git archive -v -o bootsnap-1.15.0-tests.txz v1.15.0 test/ +Source1: %{gem_name}-%{version}-tests.txz +# https://github.com/Shopify/bootsnap/issues/431 +# https://github.com/Shopify/bootsnap/commit/72202aab5e5b3602ece4e8748bcdeefe2d789ab5 +Patch0: Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files.patch +Patch1: Use-RbConfig-CONFIG-rubylibdir-to-check-for-stdlib-files-test.patch BuildRequires: ruby(release) rubygems-devel ruby-devel >= 2.0.0 rubygem(minitest) BuildRequires: rubygem(mocha) rubygem(msgpack) gcc +BuildRequires: rubygem(bundler) ExcludeArch: armv7hl %description Bootsnap is a library that plugs into Ruby, with optional support @@ -23,8 +29,11 @@ BuildArch: noarch Documentation for %{name}. %prep -%setup -q -n %{gem_name}-%{version} +%setup -q -n %{gem_name}-%{version} -b 1 +%patch0 -p1 +pushd %{_builddir} %patch1 -p1 +popd sed -i -e "/^\s*\$CFLAGS / s/^/#/g" \ ext/bootsnap/extconf.rb @@ -41,28 +50,31 @@ cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri}/ cp -a .%{gem_extdir_mri}/%{gem_name}/*.so %{buildroot}%{gem_extdir_mri}/%{gem_name} rm -rf %{buildroot}%{gem_instdir}/ext/ +mkdir -p %{buildroot}%{_bindir} +cp -a .%{_bindir}/* \ + %{buildroot}%{_bindir}/ + +find %{buildroot}%{gem_instdir}/exe -type f | xargs chmod a+x + %check pushd .%{gem_instdir} -tar xzvf %{SOURCE1} -ln -s %{gem_name}-%{version}/test test -sed -i 'N;38a\ if RUBY_REVISION.is_a?(String)\n exp = [Help.fnv1a_64(RUBY_REVISION) >> 32].pack("L")\n else\n exp = [RUBY_REVISION].pack("L")\n end' bootsnap-1.3.2/test/compile_cache_key_format_test.rb -sed -i '38 d' bootsnap-1.3.2/test/compile_cache_key_format_test.rb -sed -i -e "/require 'bundler/ s/^/#/g" \ - test/test_helper.rb -sed -i -e "/^\s*assert stable.stable?,/ s/^/#/g" \ - -e "/^\s*refute stable.volatile?,/ s/^/#/g" \ - -e "/^\s*assert bundler.stable?,/ s/^/#/g" \ - -e "/^\s*Bundler/ s/^/#/g" \ - test/load_path_cache/path_test.rb -ruby -Ilib:test:ext -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' +ln -s %{_builddir}/test test +cat < Gemfile +gem "minitest" +gem "mocha" +gem "msgpack" +GEMFILE + +RUBYOPT="-I$(dirs +1)%{gem_extdir_mri}:$(dirs +1)%{gem_libdir}" \ + ruby -Itest -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' popd %files %dir %{gem_instdir} +%{_bindir}/bootsnap %{gem_extdir_mri} -%exclude %{gem_instdir}/.* %license %{gem_instdir}/LICENSE.txt -%exclude %{gem_instdir}/bootsnap.gemspec +%{gem_instdir}/exe %{gem_libdir} %exclude %{gem_cache} %{gem_spec} @@ -70,17 +82,12 @@ popd %files doc %doc %{gem_docdir} %doc %{gem_instdir}/CHANGELOG.md -%doc %{gem_instdir}/CONTRIBUTING.md -%{gem_instdir}/Gemfile -%doc %{gem_instdir}/README.jp.md %doc %{gem_instdir}/README.md -%{gem_instdir}/Rakefile -%{gem_instdir}/dev.yml -%{gem_instdir}/shipit.rubygems.yml -%{gem_instdir}/bin -%doc %{gem_instdir}/CODE_OF_CONDUCT.md %changelog +* Tue Aug 01 2023 yaoxin - 1.15.0-1 +- Update to 1.15.0 + * Tue Jul 05 2022 xu_ping - 1.3.2-4 - fixed mocha/minitest dependency issue due to rubygem-mocha upgrade diff --git a/v1.3.2.tar.gz b/v1.3.2.tar.gz deleted file mode 100644 index 399810c77341c328b7bc6f1794cfca6e9bbd1a58..0000000000000000000000000000000000000000 Binary files a/v1.3.2.tar.gz and /dev/null differ