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 2021-10-11 15:31:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-bootsnap (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-bootsnap.new.2443 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-bootsnap"

Mon Oct 11 15:31:32 2021 rev:14 rq:924364 version:1.9.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-bootsnap/rubygem-bootsnap.changes        
2021-08-25 20:59:38.377048440 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-bootsnap.new.2443/rubygem-bootsnap.changes  
    2021-10-11 15:32:31.178931772 +0200
@@ -1,0 +2,7 @@
+Sat Oct  9 09:04:24 UTC 2021 - Manuel Schnitzer <mschnit...@suse.com>
+
+- updated to version 1.9.1
+
+  * Removed a forgotten debug statement in JSON precompilation
+
+-------------------------------------------------------------------

Old:
----
  bootsnap-1.7.7.gem

New:
----
  bootsnap-1.9.1.gem

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

Other differences:
------------------
++++++ rubygem-bootsnap.spec ++++++
--- /var/tmp/diff_new_pack.Sus3yL/_old  2021-10-11 15:32:31.602932452 +0200
+++ /var/tmp/diff_new_pack.Sus3yL/_new  2021-10-11 15:32:31.606932458 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-bootsnap
-Version:        1.7.7
+Version:        1.9.1
 Release:        0
 %define mod_name bootsnap
 %define mod_full_name %{mod_name}-%{version}

++++++ bootsnap-1.7.7.gem -> bootsnap-1.9.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2021-08-02 12:15:53.000000000 +0200
+++ new/CHANGELOG.md    2021-09-20 12:01:17.000000000 +0200
@@ -1,5 +1,21 @@
 # Unreleased
 
+# 1.9.1
+
+* Removed a forgotten debug statement in JSON precompilation.
+
+# 1.9.0
+
+* Added a compilation cache for `JSON.load_file`. (#370)
+
+# 1.8.1
+
+* Fixed support for older Psych. (#369)
+
+# 1.8.0
+
+* Improve support for Pysch 4. (#368)
+
 # 1.7.7
 
 * Fix `require_relative` in evaled code on latest ruby 3.1.0-dev. (#366)
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/cli.rb new/lib/bootsnap/cli.rb
--- old/lib/bootsnap/cli.rb     2021-08-02 12:15:53.000000000 +0200
+++ new/lib/bootsnap/cli.rb     2021-09-20 12:01:17.000000000 +0200
@@ -21,7 +21,7 @@
 
     attr_reader :cache_dir, :argv
 
-    attr_accessor :compile_gemfile, :exclude, :verbose, :iseq, :yaml, :jobs
+    attr_accessor :compile_gemfile, :exclude, :verbose, :iseq, :yaml, :json, 
:jobs
 
     def initialize(argv)
       @argv = argv
@@ -32,37 +32,44 @@
       self.jobs = Etc.nprocessors
       self.iseq = true
       self.yaml = true
+      self.json = true
     end
 
     def precompile_command(*sources)
       require 'bootsnap/compile_cache/iseq'
       require 'bootsnap/compile_cache/yaml'
+      require 'bootsnap/compile_cache/json'
 
       fix_default_encoding do
         Bootsnap::CompileCache::ISeq.cache_dir = self.cache_dir
         Bootsnap::CompileCache::YAML.init!
         Bootsnap::CompileCache::YAML.cache_dir = self.cache_dir
+        Bootsnap::CompileCache::JSON.init!
+        Bootsnap::CompileCache::JSON.cache_dir = self.cache_dir
 
         @work_pool = WorkerPool.create(size: jobs, jobs: {
           ruby: method(:precompile_ruby),
           yaml: method(:precompile_yaml),
+          json: method(:precompile_json),
         })
         @work_pool.spawn
 
         main_sources = sources.map { |d| File.expand_path(d) }
         precompile_ruby_files(main_sources)
         precompile_yaml_files(main_sources)
+        precompile_json_files(main_sources)
 
         if compile_gemfile
           # Some gems embed their tests, they're very unlikely to be loaded, 
so not worth precompiling.
           gem_exclude = Regexp.union([exclude, '/spec/', '/test/'].compact)
           precompile_ruby_files($LOAD_PATH.map { |d| File.expand_path(d) }, 
exclude: gem_exclude)
 
-          # Gems that include YAML files usually don't put them in `lib/`.
+          # Gems that include JSON or YAML files usually don't put them in 
`lib/`.
           # So we look at the gem root.
           gem_pattern = 
%r{^#{Regexp.escape(Bundler.bundle_path.to_s)}/?(?:bundler/)?gems\/[^/]+}
           gem_paths = $LOAD_PATH.map { |p| p[gem_pattern] }.compact.uniq
           precompile_yaml_files(gem_paths, exclude: gem_exclude)
+          precompile_json_files(gem_paths, exclude: gem_exclude)
         end
 
         if exitstatus = @work_pool.shutdown
@@ -137,6 +144,29 @@
       end
     end
 
+    def precompile_json_files(load_paths, exclude: self.exclude)
+      return unless json
+
+      load_paths.each do |path|
+        if !exclude || !exclude.match?(path)
+          list_files(path, '**/*.json').each do |json_file|
+            # We ignore hidden files to not match the various .config.json 
files
+            if !File.basename(json_file).start_with?('.') && (!exclude || 
!exclude.match?(json_file))
+              @work_pool.push(:json, json_file)
+            end
+          end
+        end
+      end
+    end
+
+    def precompile_json(*json_files)
+      Array(json_files).each do |json_file|
+        if CompileCache::JSON.precompile(json_file, cache_dir: cache_dir)
+          STDERR.puts(json_file) if verbose
+        end
+      end
+    end
+
     def precompile_ruby_files(load_paths, exclude: self.exclude)
       return unless iseq
 
@@ -240,6 +270,11 @@
           Disable YAML precompilation.
         EOS
         opts.on('--no-yaml', help) { self.yaml = false }
+
+        help = <<~EOS
+          Disable JSON precompilation.
+        EOS
+        opts.on('--no-json', help) { self.json = false }
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/compile_cache/json.rb 
new/lib/bootsnap/compile_cache/json.rb
--- old/lib/bootsnap/compile_cache/json.rb      1970-01-01 01:00:00.000000000 
+0100
+++ new/lib/bootsnap/compile_cache/json.rb      2021-09-20 12:01:17.000000000 
+0200
@@ -0,0 +1,79 @@
+# frozen_string_literal: true
+require('bootsnap/bootsnap')
+
+module Bootsnap
+  module CompileCache
+    module JSON
+      class << self
+        attr_accessor(:msgpack_factory, :cache_dir, :supported_options)
+
+        def input_to_storage(payload, _)
+          obj = ::JSON.parse(payload)
+          msgpack_factory.dump(obj)
+        end
+
+        def storage_to_output(data, kwargs)
+          if kwargs && kwargs.key?(:symbolize_names)
+            kwargs[:symbolize_keys] = kwargs.delete(:symbolize_names)
+          end
+          msgpack_factory.load(data, kwargs)
+        end
+
+        def input_to_output(data, kwargs)
+          ::JSON.parse(data, **(kwargs || {}))
+        end
+
+        def precompile(path, cache_dir: self.cache_dir)
+          Bootsnap::CompileCache::Native.precompile(
+            cache_dir,
+            path.to_s,
+            self,
+          )
+        end
+
+        def install!(cache_dir)
+          self.cache_dir = cache_dir
+          init!
+          if ::JSON.respond_to?(:load_file)
+            ::JSON.singleton_class.prepend(Patch)
+          end
+        end
+
+        def init!
+          require('json')
+          require('msgpack')
+
+          self.msgpack_factory = MessagePack::Factory.new
+          self.supported_options = [:symbolize_names]
+          if ::JSON.parse('["foo"]', freeze: true).first.frozen?
+            self.supported_options = [:freeze]
+          end
+          self.supported_options.freeze
+        end
+      end
+
+      module Patch
+        def load_file(path, *args)
+          return super if args.size > 1
+          if kwargs = args.first
+            return super unless kwargs.is_a?(Hash)
+            return super unless (kwargs.keys - 
::Bootsnap::CompileCache::JSON.supported_options).empty?
+          end
+
+          begin
+            ::Bootsnap::CompileCache::Native.fetch(
+              Bootsnap::CompileCache::JSON.cache_dir,
+              File.realpath(path),
+              ::Bootsnap::CompileCache::JSON,
+              kwargs,
+            )
+          rescue Errno::EACCES
+            ::Bootsnap::CompileCache.permission_error(path)
+          end
+        end
+
+        ruby2_keywords :load_file if respond_to?(:ruby2_keywords, true)
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap/compile_cache/yaml.rb 
new/lib/bootsnap/compile_cache/yaml.rb
--- old/lib/bootsnap/compile_cache/yaml.rb      2021-08-02 12:15:53.000000000 
+0200
+++ new/lib/bootsnap/compile_cache/yaml.rb      2021-09-20 12:01:17.000000000 
+0200
@@ -23,7 +23,11 @@
         end
 
         def input_to_output(data, kwargs)
-          ::YAML.load(data, **(kwargs || {}))
+          if ::YAML.respond_to?(:unsafe_load)
+            ::YAML.unsafe_load(data, **(kwargs || {}))
+          else
+            ::YAML.load(data, **(kwargs || {}))
+          end
         end
 
         def strict_load(payload, *args)
@@ -52,6 +56,13 @@
           require('msgpack')
           require('date')
 
+          if Patch.method_defined?(:unsafe_load_file) && 
!::YAML.respond_to?(:unsafe_load_file)
+            Patch.send(:remove_method, :unsafe_load_file)
+          end
+          if Patch.method_defined?(:load_file) && ::YAML::VERSION >= '4'
+            Patch.send(:remove_method, :load_file)
+          end
+
           # MessagePack serializes symbols as strings by default.
           # We want them to roundtrip cleanly, so we use a custom factory.
           # see: https://github.com/msgpack/msgpack-ruby/pull/122
@@ -126,6 +137,27 @@
         end
 
         ruby2_keywords :load_file if respond_to?(:ruby2_keywords, true)
+
+        def unsafe_load_file(path, *args)
+          return super if args.size > 1
+          if kwargs = args.first
+            return super unless kwargs.is_a?(Hash)
+            return super unless (kwargs.keys - 
::Bootsnap::CompileCache::YAML.supported_options).empty?
+          end
+
+          begin
+            ::Bootsnap::CompileCache::Native.fetch(
+              Bootsnap::CompileCache::YAML.cache_dir,
+              File.realpath(path),
+              ::Bootsnap::CompileCache::YAML,
+              kwargs,
+            )
+          rescue Errno::EACCES
+            ::Bootsnap::CompileCache.permission_error(path)
+          end
+        end
+
+        ruby2_keywords :unsafe_load_file if respond_to?(:ruby2_keywords, true)
       end
     end
   end
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   2021-08-02 12:15:53.000000000 +0200
+++ new/lib/bootsnap/compile_cache.rb   2021-09-20 12:01:17.000000000 +0200
@@ -4,7 +4,7 @@
     Error           = Class.new(StandardError)
     PermissionError = Class.new(Error)
 
-    def self.setup(cache_dir:, iseq:, yaml:)
+    def self.setup(cache_dir:, iseq:, yaml:, json:)
       if iseq
         if supported?
           require_relative('compile_cache/iseq')
@@ -22,6 +22,15 @@
           warn("[bootsnap/setup] YAML parsing caching is not supported on this 
implementation of Ruby")
         end
       end
+
+      if json
+        if supported?
+          require_relative('compile_cache/json')
+          Bootsnap::CompileCache::JSON.install!(cache_dir)
+        elsif $VERBOSE
+          warn("[bootsnap/setup] JSON parsing caching is not supported on this 
implementation of Ruby")
+        end
+      end
     end
 
     def self.permission_error(path)
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 2021-08-02 12:15:53.000000000 +0200
+++ new/lib/bootsnap/version.rb 2021-09-20 12:01:17.000000000 +0200
@@ -1,4 +1,4 @@
 # frozen_string_literal: true
 module Bootsnap
-  VERSION = "1.7.7"
+  VERSION = "1.9.1"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bootsnap.rb new/lib/bootsnap.rb
--- old/lib/bootsnap.rb 2021-08-02 12:15:53.000000000 +0200
+++ new/lib/bootsnap.rb 2021-09-20 12:01:17.000000000 +0200
@@ -43,7 +43,8 @@
     autoload_paths_cache: nil,
     disable_trace: nil,
     compile_cache_iseq: true,
-    compile_cache_yaml: 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. " \
@@ -69,7 +70,8 @@
     Bootsnap::CompileCache.setup(
       cache_dir: cache_dir + '/bootsnap/compile-cache',
       iseq: compile_cache_iseq,
-      yaml: compile_cache_yaml
+      yaml: compile_cache_yaml,
+      json: compile_cache_json,
     )
   end
 
@@ -113,6 +115,7 @@
         load_path_cache:      !ENV['DISABLE_BOOTSNAP_LOAD_PATH_CACHE'],
         compile_cache_iseq:   !ENV['DISABLE_BOOTSNAP_COMPILE_CACHE'] && 
iseq_cache_supported?,
         compile_cache_yaml:   !ENV['DISABLE_BOOTSNAP_COMPILE_CACHE'],
+        compile_cache_json:   !ENV['DISABLE_BOOTSNAP_COMPILE_CACHE'],
       )
 
       if ENV['BOOTSNAP_LOG']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2021-08-02 12:15:53.000000000 +0200
+++ new/metadata        2021-09-20 12:01:17.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: bootsnap
 version: !ruby/object:Gem::Version
-  version: 1.7.7
+  version: 1.9.1
 platform: ruby
 authors:
 - Burke Libbey
 autorequire: 
 bindir: exe
 cert_chain: []
-date: 2021-08-02 00:00:00.000000000 Z
+date: 2021-09-20 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: bundler
@@ -116,6 +116,7 @@
 - lib/bootsnap/cli/worker_pool.rb
 - lib/bootsnap/compile_cache.rb
 - lib/bootsnap/compile_cache/iseq.rb
+- lib/bootsnap/compile_cache/json.rb
 - lib/bootsnap/compile_cache/yaml.rb
 - lib/bootsnap/explicit_require.rb
 - lib/bootsnap/load_path_cache.rb

Reply via email to