diff --git a/mustermann-1.1.1-ruby32-regex_match-for-object-2.patch b/mustermann-1.1.1-ruby32-regex_match-for-object-2.patch new file mode 100644 index 0000000..257e314 --- /dev/null +++ b/mustermann-1.1.1-ruby32-regex_match-for-object-2.patch @@ -0,0 +1,27 @@ +From 82d5efc5796e8e4864e495da6280c6edd7d09375 Mon Sep 17 00:00:00 2001 +From: Olle Jonsson +Date: Thu, 17 Dec 2020 14:10:06 +0100 +Subject: [PATCH] Avoid "deprecated Object#=~ is called on Integer" + +In a test suite I was using, I saw this warning printed liberally: + + warning: deprecated Object#=~ is called on Integer; it always returns nil + +Change inspired by the same kind of fix here: https://github.com/rails/rails/commit/eafff15a023670974bd71efaec51e4c80364b95d +--- + mustermann/lib/mustermann/ast/translator.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mustermann/lib/mustermann/ast/translator.rb b/mustermann/lib/mustermann/ast/translator.rb +index 596e362..87b90c7 100644 +--- a/mustermann/lib/mustermann/ast/translator.rb ++++ b/mustermann/lib/mustermann/ast/translator.rb +@@ -120,7 +120,7 @@ def decorator_for(node) + # @!visibility private + def escape(char, parser: URI::DEFAULT_PARSER, escape: parser.regexp[:UNSAFE], also_escape: nil) + escape = Regexp.union(also_escape, escape) if also_escape +- char =~ escape ? parser.escape(char, Regexp.union(*escape)) : char ++ char.to_s =~ escape ? parser.escape(char, Regexp.union(*escape)) : char + end + end + end diff --git a/mustermann-2.0.2-ruby32-regex_match-for-object.patch b/mustermann-2.0.2-ruby32-regex_match-for-object.patch new file mode 100644 index 0000000..59d65aa --- /dev/null +++ b/mustermann-2.0.2-ruby32-regex_match-for-object.patch @@ -0,0 +1,23 @@ +From 8be5bd4ac3642d9c9582d0a7258f3197fa54bb96 Mon Sep 17 00:00:00 2001 +From: Paul Padier +Date: Wed, 20 Jul 2022 22:32:25 +0900 +Subject: [PATCH] Don't call #=~ on objects that don't respond to it + +`Kernel` defined `#=~` up until Ruby 3.2, but it just returned `nil` when the method wasn't redefined by a child class. +--- + mustermann/lib/mustermann/ast/expander.rb | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/mustermann/lib/mustermann/ast/expander.rb b/mustermann/lib/mustermann/ast/expander.rb +index 6cb9110..f5ca874 100644 +--- a/mustermann/lib/mustermann/ast/expander.rb ++++ b/mustermann/lib/mustermann/ast/expander.rb +@@ -124,6 +124,8 @@ def error_for(values) + # @see Mustermann::AST::Translator#expand + # @!visibility private + ruby2_keywords def escape(string, *args) ++ return super unless string.respond_to?(:=~) ++ + # URI::Parser is pretty slow, let's not send every string to it, even if it's unnecessary + string =~ /\A\w*\Z/ ? string : super + end diff --git a/rubygem-mustermann.spec b/rubygem-mustermann.spec index 3b744c4..03c6d3a 100644 --- a/rubygem-mustermann.spec +++ b/rubygem-mustermann.spec @@ -6,7 +6,7 @@ Name: rubygem-%{gem_name} Version: 1.1.1 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Your personal string matching expert License: MIT URL: https://github.com/sinatra/mustermann @@ -17,6 +17,11 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source1: %{gem_name}-%{version}-support.tgz # tar czvf mustermann-1.1.1-mustermann-contrib.tgz mustermann-contrib/ Source2: %{gem_name}-%{version}-mustermann-contrib.tgz +# https://github.com/sinatra/mustermann/commit/8be5bd4ac3642d9c9582d0a7258f3197fa54bb96 +# Ruby3.2 removes Object#:~ +Patch0: %{gem_name}-2.0.2-ruby32-regex_match-for-object.patch +# Similarly, from https://github.com/sinatra/mustermann/pull/113 +Patch1: %{gem_name}-1.1.1-ruby32-regex_match-for-object-2.patch BuildRequires: ruby(release) BuildRequires: rubygems-devel BuildRequires: ruby >= 2.2.0 @@ -42,6 +47,8 @@ Documentation for %{name}. %prep %setup -q -n %{gem_name}-%{version} -b 1 -b 2 +%patch0 -p2 +%patch1 -p2 # Drop ruby2_keywords dependency that is required by Ruby < 2.7. %gemspec_remove_dep -g ruby2_keywords @@ -95,6 +102,9 @@ popd %{gem_instdir}/spec %changelog +* Thu Nov 17 2022 Mamoru TASAKA - 1.1.1-8 +- Backport upstream fix for ruby32 Object#:~ removal + * Sat Jul 23 2022 Fedora Release Engineering - 1.1.1-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild