Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-bootsnap for 
openSUSE:Factory checked in at 2022-12-13 18:56:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-bootsnap (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-bootsnap.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-bootsnap"

Tue Dec 13 18:56:28 2022 rev:21 rq:1042625 version:1.15.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-bootsnap/rubygem-bootsnap.changes        
2022-08-06 22:08:38.718741528 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-bootsnap.new.1835/rubygem-bootsnap.changes  
    2022-12-13 18:56:43.647606781 +0100
@@ -1,0 +2,19 @@
+Wed Dec  7 11:13:46 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 1.15.0
+ see installed CHANGELOG.md
+
+  # 1.15.0
+  
+  * Add a readonly mode, for environments in which the updated cache wouldn't 
be persisted. See #428 and #423.
+  
+  # 1.14.0
+  
+  * Require Ruby 2.6.
+  * Add a way to skip directories during load path scanning.
+    If you have large non-ruby directories in the middle of your load path, it 
can severely slow down scanning.
+    Typically this is a problem with `node_modules`. See #277.
+  * Fix `Bootsnap.unload_cache!`, it simply wouldn't work at all becaue of a 
merge mistake. See #421.
+  
+
+-------------------------------------------------------------------

Old:
----
  bootsnap-1.13.0.gem

New:
----
  bootsnap-1.15.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-bootsnap.spec ++++++
--- /var/tmp/diff_new_pack.TMqx12/_old  2022-12-13 18:56:44.575611733 +0100
+++ /var/tmp/diff_new_pack.TMqx12/_new  2022-12-13 18:56:44.599611861 +0100
@@ -24,12 +24,12 @@
 #
 
 Name:           rubygem-bootsnap
-Version:        1.13.0
+Version:        1.15.0
 Release:        0
 %define mod_name bootsnap
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  %{rubydevel >= 2.5.0}
+BuildRequires:  %{rubydevel >= 2.6.0}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  ruby-macros >= 5
 BuildRequires:  update-alternatives

++++++ bootsnap-1.13.0.gem -> bootsnap-1.15.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2022-07-28 11:29:35.000000000 +0200
+++ new/CHANGELOG.md    2022-11-25 15:35:55.000000000 +0100
@@ -1,5 +1,17 @@
 # Unreleased
 
+# 1.15.0
+
+* Add a readonly mode, for environments in which the updated cache wouldn't be 
persisted. See #428 and #423.
+
+# 1.14.0
+
+* Require Ruby 2.6.
+* Add a way to skip directories during load path scanning.
+  If you have large non-ruby directories in the middle of your load path, it 
can severely slow down scanning.
+  Typically this is a problem with `node_modules`. See #277.
+* Fix `Bootsnap.unload_cache!`, it simply wouldn't work at all becaue of a 
merge mistake. See #421.
+
 # 1.13.0
 
 * Stop decorating `Kernel.load`. This used to be very useful in development 
because the Rails "classic" autoloader
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2022-07-28 11:29:35.000000000 +0200
+++ new/README.md       2022-11-25 15:35:55.000000000 +0100
@@ -52,10 +52,12 @@
 env = ENV['RAILS_ENV'] || "development"
 Bootsnap.setup(
   cache_dir:            'tmp/cache',          # Path to your cache
+  ignore_directories:   ['node_modules'],     # Directory names to skip.
   development_mode:     env == 'development', # Current working environment, 
e.g. RACK_ENV, RAILS_ENV, etc
   load_path_cache:      true,                 # Optimize the LOAD_PATH with a 
cache
   compile_cache_iseq:   true,                 # Compile Ruby code into ISeq 
cache, breaks coverage reporting.
-  compile_cache_yaml:   true                  # Compile YAML into a cache
+  compile_cache_yaml:   true,                 # Compile YAML into a cache
+  readonly:             true,                 # Use the caches but don't 
update them on miss or stale entries.
 )
 ```
 
@@ -76,7 +78,11 @@
 - `DISABLE_BOOTSNAP` allows to entirely disable bootsnap.
 - `DISABLE_BOOTSNAP_LOAD_PATH_CACHE` allows to disable load path caching.
 - `DISABLE_BOOTSNAP_COMPILE_CACHE` allows to disable ISeq and YAML caches.
+- `BOOTSNAP_READONLY` configure bootsnap to not update the cache on miss or 
stale entries.
 - `BOOTSNAP_LOG` configure bootsnap to log all caches misses to STDERR.
+- `BOOTSNAP_IGNORE_DIRECTORIES` a comma separated list of directories that 
shouldn't be scanned.
+  Useful when you have large directories of non-ruby files inside `$LOAD_PATH`.
+  It default to ignore any directory named `node_modules`.
 
 ### Environments
 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/bootsnap/bootsnap.c new/ext/bootsnap/bootsnap.c
--- old/ext/bootsnap/bootsnap.c 2022-07-28 11:29:35.000000000 +0200
+++ new/ext/bootsnap/bootsnap.c 2022-11-25 15:35:55.000000000 +0100
@@ -90,9 +90,11 @@
 static VALUE sym_miss;
 static VALUE sym_stale;
 static bool instrumentation_enabled = false;
+static bool readonly = false;
 
 /* Functions exposed as module functions on Bootsnap::CompileCache::Native */
 static VALUE bs_instrumentation_enabled_set(VALUE self, VALUE enabled);
+static VALUE bs_readonly_set(VALUE self, VALUE enabled);
 static VALUE bs_compile_option_crc32_set(VALUE self, VALUE crc32_v);
 static VALUE bs_rb_fetch(VALUE self, VALUE cachedir_v, VALUE path_v, VALUE 
handler, VALUE args);
 static VALUE bs_rb_precompile(VALUE self, VALUE cachedir_v, VALUE path_v, 
VALUE handler);
@@ -166,6 +168,7 @@
   rb_global_variable(&sym_stale);
 
   rb_define_module_function(rb_mBootsnap, "instrumentation_enabled=", 
bs_instrumentation_enabled_set, 1);
+  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "readonly=", 
bs_readonly_set, 1);
   rb_define_module_function(rb_mBootsnap_CompileCache_Native, 
"coverage_running?", bs_rb_coverage_running, 0);
   rb_define_module_function(rb_mBootsnap_CompileCache_Native, "fetch", 
bs_rb_fetch, 4);
   rb_define_module_function(rb_mBootsnap_CompileCache_Native, "precompile", 
bs_rb_precompile, 3);
@@ -182,6 +185,13 @@
   return enabled;
 }
 
+static VALUE
+bs_readonly_set(VALUE self, VALUE enabled)
+{
+  readonly = RTEST(enabled);
+  return enabled;
+}
+
 /*
  * Bootsnap's ruby code registers a hook that notifies us via this function
  * when compile_option changes. These changes invalidate all existing caches.
@@ -945,12 +955,17 @@
 static int
 bs_input_to_storage(VALUE handler, VALUE args, VALUE input_data, VALUE 
pathval, VALUE * storage_data)
 {
-  int state;
-  struct i2s_data i2s_data = {
-    .handler    = handler,
-    .input_data = input_data,
-    .pathval    = pathval,
-  };
-  *storage_data = rb_protect(try_input_to_storage, (VALUE)&i2s_data, &state);
-  return state;
+  if (readonly) {
+    *storage_data = rb_cBootsnap_CompileCache_UNCOMPILABLE;
+    return 0;
+  } else {
+    int state;
+    struct i2s_data i2s_data = {
+      .handler    = handler,
+      .input_data = input_data,
+      .pathval    = pathval,
+    };
+    *storage_data = rb_protect(try_input_to_storage, (VALUE)&i2s_data, &state);
+    return state;
+  }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/compile_cache.rb 
new/lib/bootsnap/compile_cache.rb
--- old/lib/bootsnap/compile_cache.rb   2022-07-28 11:29:35.000000000 +0200
+++ new/lib/bootsnap/compile_cache.rb   2022-11-25 15:35:55.000000000 +0100
@@ -10,7 +10,7 @@
     Error = Class.new(StandardError)
     PermissionError = Class.new(Error)
 
-    def self.setup(cache_dir:, iseq:, yaml:, json:)
+    def self.setup(cache_dir:, iseq:, yaml:, json:, readonly: false)
       if iseq
         if supported?
           require_relative("compile_cache/iseq")
@@ -37,6 +37,10 @@
           warn("[bootsnap/setup] JSON parsing caching is not supported on this 
implementation of Ruby")
         end
       end
+
+      if supported? && defined?(Bootsnap::CompileCache::Native)
+        Bootsnap::CompileCache::Native.readonly = readonly
+      end
     end
 
     def self.permission_error(path)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/load_path_cache/change_observer.rb 
new/lib/bootsnap/load_path_cache/change_observer.rb
--- old/lib/bootsnap/load_path_cache/change_observer.rb 2022-07-28 
11:29:35.000000000 +0200
+++ new/lib/bootsnap/load_path_cache/change_observer.rb 2022-11-25 
15:35:55.000000000 +0100
@@ -66,7 +66,7 @@
       end
 
       def self.unregister(arr)
-        return unless arr.instance_variable_get(:@lpc_observer)
+        return unless arr.instance_variable_defined?(:@lpc_observer) && 
arr.instance_variable_get(:@lpc_observer)
 
         ArrayMixin.instance_methods.each do |method_name|
           arr.singleton_class.send(:remove_method, method_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/lib/bootsnap/load_path_cache/loaded_features_index.rb 
new/lib/bootsnap/load_path_cache/loaded_features_index.rb
--- old/lib/bootsnap/load_path_cache/loaded_features_index.rb   2022-07-28 
11:29:35.000000000 +0200
+++ new/lib/bootsnap/load_path_cache/loaded_features_index.rb   2022-11-25 
15:35:55.000000000 +0100
@@ -40,7 +40,7 @@
 
             # /a/b/lib/my/foo.rb
             #          ^^^^^^^^^
-            short = feat[(lpe.length + 1)..-1]
+            short = feat[(lpe.length + 1)..]
             stripped = strip_extension_if_elidable(short)
             @lfi[short] = hash
             @lfi[stripped] = hash
@@ -76,7 +76,7 @@
       end
 
       def identify(short, cursor)
-        $LOADED_FEATURES[cursor..-1].detect do |feat|
+        $LOADED_FEATURES[cursor..].detect do |feat|
           offset = 0
           while (offset = feat.index(short, offset))
             if feat.index(".", offset + 1) && !feat.index("/", offset + 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/load_path_cache/path_scanner.rb 
new/lib/bootsnap/load_path_cache/path_scanner.rb
--- old/lib/bootsnap/load_path_cache/path_scanner.rb    2022-07-28 
11:29:35.000000000 +0200
+++ new/lib/bootsnap/load_path_cache/path_scanner.rb    2022-11-25 
15:35:55.000000000 +0100
@@ -15,7 +15,11 @@
         ""
       end
 
+      @ignored_directories = %w(node_modules)
+
       class << self
+        attr_accessor :ignored_directories
+
         def call(path)
           path = File.expand_path(path.to_s).freeze
           return [[], []] unless File.directory?(path)
@@ -50,6 +54,8 @@
 
             absolute_path = "#{absolute_dir_path}/#{name}"
             if File.directory?(absolute_path)
+              next if ignored_directories.include?(name)
+
               if yield relative_path, absolute_path, true
                 walk(absolute_path, relative_path, &block)
               end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/load_path_cache/store.rb 
new/lib/bootsnap/load_path_cache/store.rb
--- old/lib/bootsnap/load_path_cache/store.rb   2022-07-28 11:29:35.000000000 
+0200
+++ new/lib/bootsnap/load_path_cache/store.rb   2022-11-25 15:35:55.000000000 
+0100
@@ -13,10 +13,11 @@
       NestedTransactionError = Class.new(StandardError)
       SetOutsideTransactionNotAllowed = Class.new(StandardError)
 
-      def initialize(store_path)
+      def initialize(store_path, readonly: false)
         @store_path = store_path
         @txn_mutex = Mutex.new
         @dirty = false
+        @readonly = readonly
         load_data
       end
 
@@ -63,7 +64,7 @@
       end
 
       def commit_transaction
-        if @dirty
+        if @dirty && !@readonly
           dump_data
           @dirty = false
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/load_path_cache.rb 
new/lib/bootsnap/load_path_cache.rb
--- old/lib/bootsnap/load_path_cache.rb 2022-07-28 11:29:35.000000000 +0200
+++ new/lib/bootsnap/load_path_cache.rb 2022-11-25 15:35:55.000000000 +0100
@@ -28,17 +28,18 @@
       alias_method :enabled?, :enabled
       remove_method(:enabled)
 
-      def setup(cache_path:, development_mode:)
+      def setup(cache_path:, development_mode:, ignore_directories:, readonly: 
false)
         unless supported?
           warn("[bootsnap/setup] Load path caching is not supported on this 
implementation of Ruby") if $VERBOSE
           return
         end
 
-        store = Store.new(cache_path)
+        store = Store.new(cache_path, readonly: readonly)
 
         @loaded_features_index = LoadedFeaturesIndex.new
 
         @load_path_cache = Cache.new(store, $LOAD_PATH, development_mode: 
development_mode)
+        PathScanner.ignored_directories = ignore_directories if 
ignore_directories
         @enabled = true
         require_relative("load_path_cache/core_ext/kernel_require")
         require_relative("load_path_cache/core_ext/loaded_features")
@@ -50,7 +51,6 @@
         @realpath_cache = nil
         @load_path_cache = nil
         ChangeObserver.unregister($LOAD_PATH)
-        ::Kernel.alias_method(:require_relative, 
:require_relative_without_bootsnap)
       end
 
       def supported?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/version.rb new/lib/bootsnap/version.rb
--- old/lib/bootsnap/version.rb 2022-07-28 11:29:35.000000000 +0200
+++ new/lib/bootsnap/version.rb 2022-11-25 15:35:55.000000000 +0100
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module Bootsnap
-  VERSION = "1.13.0"
+  VERSION = "1.15.0"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap.rb new/lib/bootsnap.rb
--- old/lib/bootsnap.rb 2022-07-28 11:29:35.000000000 +0200
+++ new/lib/bootsnap.rb 2022-11-25 15:35:55.000000000 +0100
@@ -39,32 +39,18 @@
       cache_dir:,
       development_mode: true,
       load_path_cache: true,
-      autoload_paths_cache: nil,
-      disable_trace: nil,
+      ignore_directories: nil,
+      readonly: false,
       compile_cache_iseq: true,
       compile_cache_yaml: true,
       compile_cache_json: true
     )
-      unless autoload_paths_cache.nil?
-        warn "[DEPRECATED] Bootsnap's `autoload_paths_cache:` option is 
deprecated and will be removed. " \
-             "If you use Zeitwerk this option is useless, and if you are still 
using the classic autoloader " \
-             "upgrading is recommended."
-      end
-
-      unless disable_trace.nil?
-        warn "[DEPRECATED] Bootsnap's `disable_trace:` option is deprecated 
and will be removed. " \
-             "If you use Ruby 2.5 or newer this option is useless, if not 
upgrading is recommended."
-      end
-
-      if compile_cache_iseq && !iseq_cache_supported?
-        warn "Ruby 2.5 has a bug that break code tracing when code is loaded 
from cache. It is recommened " \
-             "to turn `compile_cache_iseq` off on Ruby 2.5"
-      end
-
       if load_path_cache
         Bootsnap::LoadPathCache.setup(
           cache_path: "#{cache_dir}/bootsnap/load-path-cache",
           development_mode: development_mode,
+          ignore_directories: ignore_directories,
+          readonly: readonly,
         )
       end
 
@@ -73,20 +59,14 @@
         iseq: compile_cache_iseq,
         yaml: compile_cache_yaml,
         json: compile_cache_json,
+        readonly: readonly,
       )
     end
 
-    def self.unload_cache!
+    def unload_cache!
       LoadPathCache.unload!
     end
 
-    def iseq_cache_supported?
-      return @iseq_cache_supported if defined? @iseq_cache_supported
-
-      ruby_version = Gem::Version.new(RUBY_VERSION)
-      @iseq_cache_supported = ruby_version < Gem::Version.new("2.5.0") || 
ruby_version >= Gem::Version.new("2.6.0")
-    end
-
     def default_setup
       env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || ENV["ENV"]
       development_mode = ["", nil, "development"].include?(env)
@@ -113,13 +93,19 @@
           cache_dir = File.join(app_root, "tmp", "cache")
         end
 
+        ignore_directories = if ENV.key?("BOOTSNAP_IGNORE_DIRECTORIES")
+          ENV["BOOTSNAP_IGNORE_DIRECTORIES"].split(",")
+        end
+
         setup(
           cache_dir: cache_dir,
           development_mode: development_mode,
           load_path_cache: !ENV["DISABLE_BOOTSNAP_LOAD_PATH_CACHE"],
-          compile_cache_iseq: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"] && 
iseq_cache_supported?,
+          compile_cache_iseq: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"],
           compile_cache_yaml: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"],
           compile_cache_json: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"],
+          readonly: !!ENV["BOOTSNAP_READONLY"],
+          ignore_directories: ignore_directories,
         )
 
         if ENV["BOOTSNAP_LOG"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2022-07-28 11:29:35.000000000 +0200
+++ new/metadata        2022-11-25 15:35:55.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: bootsnap
 version: !ruby/object:Gem::Version
-  version: 1.13.0
+  version: 1.15.0
 platform: ruby
 authors:
 - Burke Libbey
 autorequire: 
 bindir: exe
 cert_chain: []
-date: 2022-07-28 00:00:00.000000000 Z
+date: 2022-11-25 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: msgpack
@@ -76,7 +76,7 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: 2.5.0
+      version: 2.6.0
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="

Reply via email to