public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rubygem-multi_json] rawhide: Backport upstream change to support json 3
Date: Tue, 22 Sep 2026 02:47:03 GMT	[thread overview]
Message-ID: <179004522397.1.1624591735914016275.rpms-rubygem-multi_json-77b90e0ac685@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/rubygem-multi_json
Branch : rawhide
Commit : 77b90e0ac685a7295fdb46c6ad1238d54f2f6caa
Author : Mamoru TASAKA <mtasaka@fedoraproject.org>
Date   : 2026-09-22T11:46:52+09:00
Stats  : +208/-6 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/rubygem-multi_json/c/77b90e0ac685a7295fdb46c6ad1238d54f2f6caa?branch=rawhide

Log:
Backport upstream change to support json 3

---
diff --git a/multi_json-1.15.0-pr13-stop-setting-deprecated-default.patch b/multi_json-1.15.0-pr13-stop-setting-deprecated-default.patch
new file mode 100644
index 0000000..866b506
--- /dev/null
+++ b/multi_json-1.15.0-pr13-stop-setting-deprecated-default.patch
@@ -0,0 +1,47 @@
+From 0e2a6de74517ec850d5b1d533e38e225e257deec Mon Sep 17 00:00:00 2001
+From: Jean Boussier <jean.boussier@gmail.com>
+Date: Fri, 27 Jun 2025 10:25:21 +0200
+Subject: [PATCH 1/2] Stop setting defaults in JsonCommon
+
+`quirks_mode` has been removed from the json gem in 2016:
+https://github.com/ruby/json/commit/7d2ad6d6556da03300a5aeadeeacaec563435773
+
+`create_additions` is false by default when calling `JSON.parse`
+since forever, it's only true by default when calling `JSON.load`
+(and that too is chaning in the future).
+---
+ lib/multi_json/adapters/json_common.rb | 2 --
+ spec/shared/json_common_adapter.rb     | 7 -------
+ 2 files changed, 9 deletions(-)
+
+diff --git a/lib/multi_json/adapters/json_common.rb b/lib/multi_json/adapters/json_common.rb
+index ebc9a884..b2ae018c 100644
+--- a/lib/multi_json/adapters/json_common.rb
++++ b/lib/multi_json/adapters/json_common.rb
+@@ -3,8 +3,6 @@
+ module MultiJson
+   module Adapters
+     class JsonCommon < Adapter
+-      defaults :load, :create_additions => false, :quirks_mode => true
+-
+       PRETTY_STATE_PROTOTYPE = {
+         indent: "  ",
+         space: " ",
+diff --git a/spec/shared/json_common_adapter.rb b/spec/shared/json_common_adapter.rb
+index 01d4a0c5..07189552 100644
+--- a/spec/shared/json_common_adapter.rb
++++ b/spec/shared/json_common_adapter.rb
+@@ -25,11 +25,4 @@
+       end
+     end
+   end
+-
+-  describe '.load' do
+-    it 'passes :quirks_mode option' do
+-      expect(::JSON).to receive(:parse).with('[123]', {:quirks_mode => false, :create_additions => false})
+-      MultiJson.load('[123]', :quirks_mode => false)
+-    end
+-  end
+ end
+
+

diff --git a/multi_json-1.15.0-pr220-remove-json-pretty_state_prototype.patch b/multi_json-1.15.0-pr220-remove-json-pretty_state_prototype.patch
new file mode 100644
index 0000000..add2f65
--- /dev/null
+++ b/multi_json-1.15.0-pr220-remove-json-pretty_state_prototype.patch
@@ -0,0 +1,95 @@
+From 14d85ad2fc91fcb070ea519011b7c1858d8297c2 Mon Sep 17 00:00:00 2001
+From: Jean Boussier <jean.boussier@gmail.com>
+Date: Thu, 24 Apr 2025 18:10:25 +0200
+Subject: [PATCH] Stop referencing `JSON::PRETTY_STATE_PROTOTYPE`
+
+Ref: https://github.com/ruby/json/issues/788
+
+It is private API and will be removed.
+---
+ lib/multi_json/adapters/json_common.rb | 10 +++++++++-
+ spec/shared/json_common_adapter.rb     |  7 ++++++-
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/lib/multi_json/adapters/json_common.rb b/lib/multi_json/adapters/json_common.rb
+index cf65edf..5e9ab32 100644
+--- a/lib/multi_json/adapters/json_common.rb
++++ b/lib/multi_json/adapters/json_common.rb
+@@ -13,7 +13,15 @@ def load(string, options = {})
+       end
+ 
+       def dump(object, options = {})
+-        options.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
++        if options.delete(:pretty)
++          options.merge!({
++            indent: '  ',
++            space: ' ',
++            object_nl: "\n",
++            array_nl: "\n",
++          })
++        end
++
+         object.to_json(options)
+       end
+     end
+diff --git a/spec/shared/json_common_adapter.rb b/spec/shared/json_common_adapter.rb
+index ad18c03..d5f1f44 100644
+--- a/spec/shared/json_common_adapter.rb
++++ b/spec/shared/json_common_adapter.rb
+@@ -7,7 +7,12 @@
+     describe 'with :pretty option set to true' do
+       it 'passes default pretty options' do
+         object = 'foo'
+-        expect(object).to receive(:to_json).with(JSON::PRETTY_STATE_PROTOTYPE.to_h)
++        expect(object).to receive(:to_json).with({
++          indent: '  ',
++          space: ' ',
++          object_nl: "\n",
++          array_nl: "\n",
++        })
+         MultiJson.dump(object, :pretty => true)
+       end
+     end
+From 2a947b518dd4bc156f663957f1bb3d48ad450acf Mon Sep 17 00:00:00 2001
+From: Erik Berlin <sferik@gmail.com>
+Date: Tue, 24 Jun 2025 13:00:41 -0700
+Subject: [PATCH] Factor out PRETTY_STATE_PROTOTYPE constant
+
+---
+ lib/multi_json/adapters/json_common.rb | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/lib/multi_json/adapters/json_common.rb b/lib/multi_json/adapters/json_common.rb
+index 5e3956eb..66599a06 100644
+--- a/lib/multi_json/adapters/json_common.rb
++++ b/lib/multi_json/adapters/json_common.rb
+@@ -5,6 +5,13 @@ module Adapters
+     class JsonCommon < Adapter
+       defaults :load, :create_additions => false, :quirks_mode => true
+ 
++      PRETTY_STATE_PROTOTYPE = {
++        indent: "  ",
++        space: " ",
++        object_nl: "\n",
++        array_nl: "\n"
++      }.freeze
++
+       def load(string, options = {})
+         if string.respond_to?(:force_encoding)
+           string = string.dup.force_encoding(::Encoding::ASCII_8BIT)
+@@ -13,14 +20,7 @@ def load(string, options = {})
+       end
+ 
+       def dump(object, options = {})
+-        if options.delete(:pretty)
+-          options.merge!({
+-            indent: '  ',
+-            space: ' ',
+-            object_nl: "\n",
+-            array_nl: "\n",
+-          })
+-        end
++        options.merge!(PRETTY_STATE_PROTOTYPE) if options.delete(:pretty)
+ 
+         object.to_json(options)
+       end

diff --git a/multi_json-1.15.0-pr67-support-json3.patch b/multi_json-1.15.0-pr67-support-json3.patch
new file mode 100644
index 0000000..9f3e743
--- /dev/null
+++ b/multi_json-1.15.0-pr67-support-json3.patch
@@ -0,0 +1,27 @@
+From f8c3e5ea22f312239f3022c3db61d5955eebe839 Mon Sep 17 00:00:00 2001
+From: Jean Boussier <byroot@ruby-lang.org>
+Date: Wed, 12 Aug 2026 07:59:39 +0200
+Subject: [PATCH] Make multi_json compatible with json 3.x
+
+Ref: https://github.com/ruby/json/releases/tag/v3.0.0.rc1
+
+Unknown keyword arguments will raise `ArgumentError`.
+
+- `quirks_mode:` no longer existing since json 2.0 (~2011).
+- `create_additions` no longer existing in json 3.0.
+---
+ lib/multi_json/adapters/json_gem.rb | 4 ++--
+ test/support/adapter_tests.rb       | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/lib/multi_json/adapters/json_common.rb b/lib/multi_json/adapters/json_common.rb
+@@ -44,7 +44,7 @@ def load(string, options = {})
+         end
+ 
+         options[:symbolize_names] = true if options.delete(:symbolize_keys)
+-        ::JSON.parse(string, options)
++        ::JSON.parse(string, **options)
+       end
+ 
+       def dump(object, options = {})
+

diff --git a/multi_json-1.15.0-support-json3-misc.patch b/multi_json-1.15.0-support-json3-misc.patch
new file mode 100644
index 0000000..b3beb3d
--- /dev/null
+++ b/multi_json-1.15.0-support-json3-misc.patch
@@ -0,0 +1,11 @@
+--- multi_json-1.15.0.orig/spec/multi_json_spec.rb	2026-09-14 16:49:50.372200874 +0900
++++ multi_json-1.15.0/spec/multi_json_spec.rb	2026-09-14 16:51:35.023790873 +0900
+@@ -33,7 +33,7 @@ describe MultiJson do
+   context 'when JSON pure is already loaded' do
+     it 'default_adapter tries to require each adapter in turn and does not assume :json_gem is already loaded' do
+       require 'json/pure'
+-      expect(JSON::JSON_LOADED).to be_truthy
++      expect(JSON::JSON_LOADED).to be_truthy if JSON::VERSION.to_i < 3
+ 
+       undefine_constants :Oj, :Yajl, :Gson, :JrJackson do
+         # simulate that the json_gem is not loaded

diff --git a/rubygem-multi_json.spec b/rubygem-multi_json.spec
index 5494ca9..164d4a8 100644
--- a/rubygem-multi_json.spec
+++ b/rubygem-multi_json.spec
@@ -3,7 +3,7 @@
 
 Name: rubygem-%{gem_name}
 Version: 1.15.0
-Release: 14%{?dist}
+Release: 15%{?dist}
 Summary: A common interface to multiple JSON libraries
 License: MIT
 URL: https://github.com/intridea/multi_json
@@ -14,6 +14,24 @@ Source1: %{gem_name}-%{version}-spec.tar.gz
 # Fix RSpec 3.11.0+ compatibility due to improved kwargs handling.
 # https://github.com/intridea/multi_json/pull/205
 Patch0: rubygem-mulit_json-1.15.0-RSpec-3.11.0-distinguishes-between-hashed-and-Ruby-3.patch
+# https://github.com/intridea/multi_json/pull/220/changes/14d85ad2fc91fcb070ea519011b7c1858d8297c2
+# https://github.com/sferik/multi_json/commit/2a947b518dd4bc156f663957f1bb3d48ad450acf
+# Stop referencing JSON::PRETTY_STATE_PROTOTYPE: it is deprecated in json 2.11 and
+# is removed in json 3
+Patch1: multi_json-1.15.0-pr220-remove-json-pretty_state_prototype.patch
+# Stop setting defaults for deprecated option for json, which is removed in json 3
+# https://github.com/sferik/multi_json/pull/13
+Patch2: multi_json-1.15.0-pr13-stop-setting-deprecated-default.patch
+# Support json 3
+# From https://github.com/sferik/multi_json/pull/67
+# Note that there is some large refactoring in json_common.rb -> json_gem.rb: see
+# https://github.com/sferik/multi_json/pull/11
+Patch3: multi_json-1.15.0-pr67-support-json3.patch
+# Additional fix to support json 3:
+# The file in the patch (and the test in the patch) no longer exists in multi_json 1.21,
+# so this patch won't be upstreamed: removed in the following commit
+# https://github.com/sferik/multi_json/commit/34beaca1531adb72cf2d8574ca1073877e88efe2
+Patch4: multi_json-1.15.0-support-json3-misc.patch
 BuildRequires: ruby(release)
 BuildRequires: rubygems-devel >= 1.3.5
 BuildRequires: ruby
@@ -38,11 +56,12 @@ BuildArch: noarch
 Documentation for %{name}.
 
 %prep
-%setup -q -n %{gem_name}-%{version} -b 1
-
-pushd %{_builddir}
+%setup -q -n %{gem_name}-%{version} -a 1
 %patch 0 -p1
-popd
+%patch 1 -p1
+%patch 2 -p1
+%patch 3 -p1
+%patch 4 -p1
 
 %build
 # Create the gem as gem install only works on a gem file
@@ -58,8 +77,8 @@ cp -a .%{gem_dir}/* \
         %{buildroot}%{gem_dir}/
 
 %check
+cp -a spec .%{gem_instdir}
 pushd .%{gem_instdir}
-ln -s %{_builddir}/spec spec
 
 # json_pures is not available on Fedora.
 sed -i "/require.*json\/pure/ s/^/#/" spec/multi_json_spec.rb
@@ -96,6 +115,9 @@ popd
 %doc %{gem_instdir}/README.md
 
 %changelog
+* Tue Sep 22 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.15.0-15
+- Backport upstream change to support json 3
+
 * Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.0-14
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
 

                 reply	other threads:[~2026-09-22  2:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179004522397.1.1624591735914016275.rpms-rubygem-multi_json-77b90e0ac685@fedoraproject.org \
    --to=mtasaka@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox