Update to activesupport 6.1.1.

f38
Pavel Valena 4 years ago
parent be9180ca9a
commit 851ceb8f99

@ -1,34 +0,0 @@
From 91d852fe2c6a6bf51287a1ad95ef6e21ffa9d261 Mon Sep 17 00:00:00 2001
From: Eugene Kenny <elkenny@gmail.com>
Date: Fri, 1 Jan 2021 16:05:37 +0000
Subject: [PATCH] Fix rounding NaN and Infinity on newer BigDecimal
Since BigDecimal 2.0.3, BigDecimal#round returns an integer if the
requested precision is less than 1:
https://github.com/ruby/bigdecimal/commit/e8fc98050167fd943574609988b8754414e0a7c1
NaN and Infinity cannot be represented as an integer, so rounding these
values now raises a FloatDomainError. This is a regression of the fix in
081a3963ea2aab617a92874d7ef59ce98eee6a64.
Specifying the rounding mode restores the previous behaviour.
This isn't a problem on master or 6-1-stable, as the rounding mode is
always specified there since 7905bdfd8b2ae50319cd7a9a74ee1f8c865d648d.
---
.../lib/active_support/number_helper/rounding_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/activesupport/lib/active_support/number_helper/rounding_helper.rb b/activesupport/lib/active_support/number_helper/rounding_helper.rb
index 2ad8d49c4edb..7f7242f8651a 100644
--- a/activesupport/lib/active_support/number_helper/rounding_helper.rb
+++ b/activesupport/lib/active_support/number_helper/rounding_helper.rb
@@ -26,7 +26,7 @@ def digit_count(number)
private
def round_without_significant(number)
- number = number.round(precision)
+ number = number.round(precision, BigDecimal.mode(BigDecimal::ROUND_MODE))
number = number.to_i if precision == 0 && number.finite?
number = number.abs if number.zero? # prevent showing negative zeros
number

@ -1,44 +0,0 @@
From a4d2493b26ff166aa3605684f22e0abb174c0752 Mon Sep 17 00:00:00 2001
From: Akira Matsuda <ronnie@dio.jp>
Date: Sat, 21 Nov 2020 09:54:43 +0900
Subject: [PATCH] Let AS::SafeBuffer#[] and * return value be an instance of
SafeBuffer in Ruby 3
Ruby 3 introduces an incompatibility that String methods return String instances when called on a subclass instance.
https://bugs.ruby-lang.org/issues/10845
https://github.com/ruby/ruby/pull/3701
---
.../active_support/core_ext/string/output_safety.rb | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 635f9cf45780..60e39d58ca5c 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -153,12 +153,12 @@ def initialize
def [](*args)
if html_safe?
- new_safe_buffer = super
+ new_string = super
- if new_safe_buffer
- new_safe_buffer.instance_variable_set :@html_safe, true
- end
+ return unless new_string
+ new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
+ new_safe_buffer.instance_variable_set :@html_safe, true
new_safe_buffer
else
to_str[*args]
@@ -214,7 +214,8 @@ def +(other)
end
def *(*)
- new_safe_buffer = super
+ new_string = super
+ new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
new_safe_buffer.instance_variable_set(:@html_safe, @html_safe)
new_safe_buffer
end

@ -1,33 +0,0 @@
From fdbc55b9d55ae9d2b5b39be3ef4af5f60f6954a3 Mon Sep 17 00:00:00 2001
From: Yasuo Honda <yasuo.honda@gmail.com>
Date: Mon, 22 Jun 2020 21:19:21 +0900
Subject: [PATCH] Use
Array(ActiveSupport::ToJsonWithActiveSupportEncoder)#to_json and
Hash(ActiveSupport::ToJsonWithActiveSupportEncoder)#to_json for Ruby 2.8.0
This pull request addresses failures at https://buildkite.com/rails/rails/builds/70219#79d96882-6c51-4854-8cab-28f50ac8bca1
According to https://bugs.ruby-lang.org/issues/16973 This is an expected change in Ruby.
These failures has been addressed by changing the order of prepend as suggested.
Refer
https://github.com/ruby/ruby/pull/3181
https://github.com/ruby/ruby/pull/2936
https://bugs.ruby-lang.org/issues/9573
https://github.com/rails/rails/pull/19413
---
activesupport/lib/active_support/core_ext/object/json.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb
index d92af19137cd..dcfbe8b40f2a 100644
--- a/activesupport/lib/active_support/core_ext/object/json.rb
+++ b/activesupport/lib/active_support/core_ext/object/json.rb
@@ -45,7 +45,7 @@ def to_json(options = nil)
end
end
-[Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].reverse_each do |klass|
+[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass|
klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder)
end

@ -1,42 +0,0 @@
From 3fed62cfb1f43d8df5a5ff31229a5ad03264186e Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@hawthorn.email>
Date: Fri, 17 Jan 2020 11:12:32 -0800
Subject: [PATCH] Reduce FILENAME_MAX_SIZE to accomodate large PIDs
The max size here is designed around Ruby's Dir::Tmpname.create which
creates temporary filenames in the format
$TIMESTAMP-$PID-$RANDOM
I believe the previous value of this field was based on the assumption
that PIDs are 1-65535, which isn't necessarily the case on 64 bit Linux
systems, which can be up to 2**22.
$ uname -a
Linux zergling 5.4.11-arch1-1 #1 SMP PREEMPT Sun, 12 Jan 2020 12:15:27 +0000 x86_64 GNU/Linux
$ cat /proc/sys/kernel/pid_max
4194304
I've chosen a new value based on what I believe the largest possible
tempname is:
255 - "20200117-4194304-#{0x100000000.to_s(36)}.lock".length #=> 226
(cherry picked from commit a98f330fb138fe4a78c270788218309849440026)
---
activesupport/lib/active_support/cache/file_store.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb
index cbce9d891533..8b248efd14de 100644
--- a/activesupport/lib/active_support/cache/file_store.rb
+++ b/activesupport/lib/active_support/cache/file_store.rb
@@ -16,7 +16,7 @@ class FileStore < Store
attr_reader :cache_path
DIR_FORMATTER = "%03X"
- FILENAME_MAX_SIZE = 228 # max filename size on file system is 255, minus room for timestamp and random characters appended by Tempfile (used by atomic write)
+ FILENAME_MAX_SIZE = 226 # max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write)
FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
GITKEEP_FILES = [".gitkeep", ".keep"].freeze

@ -1,28 +0,0 @@
From 5611f4b430881bcfa788044ff3f42118370c61a2 Mon Sep 17 00:00:00 2001
From: Jonathan Hefner <jonathan@hefner.pro>
Date: Mon, 7 Sep 2020 16:44:21 -0500
Subject: [PATCH] Anchor BacktraceCleaner gem filter regexp
This ensures the default gem filter does not affect backtrace lines that
have a subpath incidentally matching a gem path.
Fixes #40196.
---
activesupport/test/clean_backtrace_test.rb | 6 ++++++
1 files changed, 6 insertions(+)
diff --git a/activesupport/test/clean_backtrace_test.rb b/activesupport/test/clean_backtrace_test.rb
index a846312d68f2..dd62ef359b73 100644
--- a/activesupport/test/clean_backtrace_test.rb
+++ b/activesupport/test/clean_backtrace_test.rb
@@ -124,4 +124,10 @@ def setup
result = @bc.clean(backtrace)
assert_empty result
end
+
+ test "should preserve lines that have a subpath matching a gem path" do
+ backtrace = [Gem.default_dir, *Gem.path].map { |path| "/parent#{path}/gems/nosuchgem-1.2.3/lib/foo.rb" }
+
+ assert_equal backtrace, @bc.clean(backtrace)
+ end
end

@ -1,26 +0,0 @@
From 5611f4b430881bcfa788044ff3f42118370c61a2 Mon Sep 17 00:00:00 2001
From: Jonathan Hefner <jonathan@hefner.pro>
Date: Mon, 7 Sep 2020 16:44:21 -0500
Subject: [PATCH] Anchor BacktraceCleaner gem filter regexp
This ensures the default gem filter does not affect backtrace lines that
have a subpath incidentally matching a gem path.
Fixes #40196.
---
activesupport/lib/active_support/backtrace_cleaner.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/activesupport/lib/active_support/backtrace_cleaner.rb b/activesupport/lib/active_support/backtrace_cleaner.rb
index ad80b8855f3f..405db9a6fe6c 100644
--- a/activesupport/lib/active_support/backtrace_cleaner.rb
+++ b/activesupport/lib/active_support/backtrace_cleaner.rb
@@ -91,7 +91,7 @@ def add_gem_filter
gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) }
return if gems_paths.empty?
- gems_regexp = %r{(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)}
+ gems_regexp = %r{\A(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)}
gems_result = '\3 (\4) \5'
add_filter { |line| line.sub(gems_regexp, gems_result) }
end

@ -1,24 +0,0 @@
From e9425abe33924623b1dce62bd817eace757c2b4e Mon Sep 17 00:00:00 2001
From: Phil Ross <phil.ross@gmail.com>
Date: Fri, 29 Dec 2017 12:47:10 +0000
Subject: [PATCH] Update to TZInfo v2.0.0
Co-authored-by: Jared Beck <jared@jaredbeck.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
---
time_zone_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 4b5f3dceee6f..646b9e1d3199 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -22,7 +29,7 @@ def test_local_to_utc
def test_period_for_local
zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"]
- assert_instance_of TZInfo::TimezonePeriod, zone.period_for_local(Time.utc(2000))
+ assert_kind_of TZInfo::TimezonePeriod, zone.period_for_local(Time.utc(2000))
end
ActiveSupport::TimeZone::MAPPING.each_key do |name|

@ -1,119 +0,0 @@
From e9425abe33924623b1dce62bd817eace757c2b4e Mon Sep 17 00:00:00 2001
From: Phil Ross <phil.ross@gmail.com>
Date: Fri, 29 Dec 2017 12:47:10 +0000
Subject: [PATCH] Update to TZInfo v2.0.0
Co-authored-by: Jared Beck <jared@jaredbeck.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
---
time_with_zone.rb | 20 +++++++++++++++-----
values/time_zone.rb | 14 ++++++--------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 3be5f6f7b595..9a4c33ab0f19 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -57,12 +57,12 @@ def initialize(utc_time, time_zone, local_time = nil, period = nil)
# Returns a <tt>Time</tt> instance that represents the time in +time_zone+.
def time
- @time ||= period.to_local(@utc)
+ @time ||= incorporate_utc_offset(@utc, utc_offset)
end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
def utc
- @utc ||= period.to_utc(@time)
+ @utc ||= incorporate_utc_offset(@time, -utc_offset)
end
alias_method :comparable_time, :utc
alias_method :getgm, :utc
@@ -104,13 +104,13 @@ def dst?
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# Time.zone.now.utc? # => false
def utc?
- period.offset.abbreviation == :UTC || period.offset.abbreviation == :UCT
+ zone == "UTC" || zone == "UCT"
end
alias_method :gmt?, :utc?
# Returns the offset from current time to UTC time in seconds.
def utc_offset
- period.utc_total_offset
+ period.observed_utc_offset
end
alias_method :gmt_offset, :utc_offset
alias_method :gmtoff, :utc_offset
@@ -132,7 +132,7 @@ def formatted_offset(colon = true, alternate_utc_string = nil)
# Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
# Time.zone.now.zone # => "EST"
def zone
- period.zone_identifier.to_s
+ period.abbreviation
end
# Returns a string of the object's date, time, zone, and offset from UTC.
@@ -524,6 +524,16 @@ def method_missing(sym, *args, &block)
end
private
+ SECONDS_PER_DAY = 86400
+
+ def incorporate_utc_offset(time, offset)
+ if time.kind_of?(Date)
+ time + Rational(offset, SECONDS_PER_DAY)
+ else
+ time + offset
+ end
+ end
+
def get_period_and_ensure_valid_local_time(period)
# we don't want a Time.local instance enforcing its own DST rules as well,
# so transfer time values to a utc constructor if necessary
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 90830b89bda3..2e5d9d3e9d4c 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -203,7 +203,7 @@ def seconds_to_utc_offset(seconds, colon = true)
end
def find_tzinfo(name)
- TZInfo::Timezone.new(MAPPING[name] || name)
+ TZInfo::Timezone.get(MAPPING[name] || name)
end
alias_method :create, :new
@@ -273,7 +273,7 @@ def load_country_zones(code)
memo
end
else
- create(tz_id, nil, TZInfo::Timezone.new(tz_id))
+ create(tz_id, nil, TZInfo::Timezone.get(tz_id))
end
end.sort!
end
@@ -302,11 +302,7 @@ def initialize(name, utc_offset = nil, tzinfo = nil)
# Returns the offset of this time zone from UTC in seconds.
def utc_offset
- if @utc_offset
- @utc_offset
- else
- tzinfo.current_period.utc_offset if tzinfo && tzinfo.current_period
- end
+ @utc_offset || tzinfo&.current_period&.base_utc_offset
end
# Returns a formatted string of the offset from UTC, or an alternative
@@ -503,7 +499,9 @@ def yesterday
# represented by +self+. Returns a Time.utc() instance -- if you want an
# ActiveSupport::TimeWithZone instance, use Time#in_time_zone() instead.
def utc_to_local(time)
- tzinfo.utc_to_local(time)
+ tzinfo.utc_to_local(time).yield_self do |t|
+ Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction)
+ end
end
# Adjust the given time to the simultaneous time in UTC. Returns a

@ -1,11 +1,11 @@
%global gem_name activesupport
#%%global prerelease .rc1
#%%global prerelease
Name: rubygem-%{gem_name}
Epoch: 1
Version: 6.0.3.4
Release: 3%{?dist}
Version: 6.1.1
Release: 1%{?dist}
Summary: A support libraries and Ruby core extensions extracted from the Rails framework
License: MIT
URL: http://rubyonrails.org
@ -13,35 +13,13 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}%{?prerelease}.gem
# The activesupport gem doesn't ship with the test suite.
# You may check it out like so
# git clone http://github.com/rails/rails.git
# cd rails/activesupport && git archive -v -o activesupport-6.0.3.4-tests.txz v6.0.3.4 test/
# cd rails/activesupport && git archive -v -o activesupport-6.1.1-tests.txz v6.1.1 test/
Source1: %{gem_name}-%{version}%{?prerelease}-tests.txz
# The tools are needed for the test suite, are however unpackaged in gem file.
# You may get them like so
# git clone http://github.com/rails/rails.git --no-checkout
# cd rails && git archive -v -o rails-6.0.3.4-tools.txz v6.0.3.4 tools/
# cd rails && git archive -v -o rails-6.1.1-tools.txz v6.1.1 tools/
Source2: rails-%{version}%{?prerelease}-tools.txz
# Fix TZInfo 2.0 compatibility.
# https://github.com/rails/rails/pull/34799
# https://github.com/rails/rails/pull/38081
Patch1: rubygem-activesupport-6.1.0-Update-to-TZInfo-v2.0.0.patch
Patch2: rubygem-activesupport-6.1.0-Update-to-TZInfo-v2.0.0-tests.patch
# Fix flaky `FileStoreTest#test_filename_max_size` test.
# https://github.com/rails/rails/pull/40085
Patch3: rubygem-activesupport-6.0.4-Reduce-FILENAME_MAX_SIZE-to-accomodate-large-PIDs.patch
# Fix evaluator test from web-console.
# https://github.com/rails/rails/pull/40198
Patch4: rubygem-activesupport-6.1.0-Anchor-BacktraceCleaner-gem-filter-regexp.patch
Patch5: rubygem-activesupport-6.1.0-Anchor-BacktraceCleaner-gem-filter-regexp-test.patch
# Fix `ActiveSupport::NumberHelper::NumberHelperTest#test_number_to_percentage`
# test failure.
# https://github.com/rails/rails/commit/91d852fe2c6a6bf51287a1ad95ef6e21ffa9d261
Patch6: rubygem-activesupport-6.0.3.4-Fix-rounding-NaN-and-Infinity-on-newer-BigDecimal.patch
# Fix `SafeBuffer` test failures.
# https://github.com/rails/rails/pull/40663
Patch7: rubygem-activesupport-6.0.3.4-Mark-scrub-as-an-unsafe-method-on-SafeBuffer.patch
# Fix test/json/encoding_test.rb test failures.
# https://github.com/rails/rails/pull/39697
Patch8: rubygem-activesupport-6.0.3.4-Use-Hash-ActiveSupport-ToJsonWithActiveSupportEncoder-to_json-for-Ruby-2.8.0.patch
# ruby package has just soft dependency on rubygem({bigdecimal,json}), while
# ActiveSupport always requires them.
@ -60,7 +38,7 @@ BuildRequires: rubygem(dalli)
BuildRequires: (rubygem(i18n) >= 0.7 with rubygem(i18n) < 2)
BuildRequires: rubygem(minitest) >= 5.0.0
BuildRequires: rubygem(rack)
BuildRequires: rubygem(tzinfo) >= 1.1
BuildRequires: rubygem(tzinfo) >= 2.0
BuildRequires: rubygem(listen)
BuildRequires: rubygem(redis)
BuildRequires: rubygem(rexml)
@ -84,21 +62,6 @@ Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}%{?prerelease} -b1 -b2
%patch1 -p2
%patch3 -p2
%patch4 -p2
%patch6 -p2
%patch7 -p2
%patch8 -p2
pushd %{_builddir}
%patch2 -p2
%patch5 -p2
popd
%gemspec_remove_dep -g tzinfo "~> 1.1"
%gemspec_add_dep -g tzinfo [">= 1.1", "< 3"]
%build
gem build ../%{gem_name}-%{version}%{?prerelease}.gemspec
%gem_install
@ -131,6 +94,8 @@ sed -i '/def test_iso8601_output_and_reparsing$/,/^ end$/ s/^/#/' test/core_ext
# https://bugs.ruby-lang.org/issues/16498
sed -i '/assert_nil mapped\[:b\]/ s/^/#/' test/core_ext/hash/transform_values_test.rb
sed -i '/require .bundler./ s/^/#/' test/abstract_unit.rb
memcached &
mPID=$!
sleep 1
@ -151,6 +116,9 @@ popd
%doc %{gem_instdir}/README.rdoc
%changelog
* Wed Jan 27 2021 Pavel Valena <pvalena@redhat.com> - 1:6.1.1-1
- Update to activesupport 6.1.1.
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:6.0.3.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

@ -1,3 +1,3 @@
SHA512 (activesupport-6.0.3.4.gem) = 98668d420f2b3d207ae1513bf9736089b51becb3e9272d5f30e2ca616ee69ee47ce91e30f5e76ada7e9711f08d0acb513697686a7b83fa9582064c280c634117
SHA512 (activesupport-6.0.3.4-tests.txz) = 483cdb18696eb8e5a4a65e31e98256f0add1081800c8f7a85dede2a96ec8e42b5f6a5bf89e238cf46cc68435ec8e26031e364e13086ff9a1578d15b0eba08890
SHA512 (rails-6.0.3.4-tools.txz) = b40d90e55da9c31462bd21c62394198900aa42f161d30f8edd32f7217d904fbdd98d2cfba7c5d542d5b89578424669fcaffbe0006f6efd62cc676065100daac3
SHA512 (activesupport-6.1.1.gem) = 172525c97ab71edc4288dd9f71cb476daec547b53fb042ed7d8883c867cb9df2e75a381f240f3db8a70f89d022201ae51c4d007e9ae7eb57b074cbbf1f4975f3
SHA512 (activesupport-6.1.1-tests.txz) = 9a3ac9cd05fcf5c4f6c1b2e24395f7538f92a1eeb2791dd76d1e85869d6a6b26183fc91856376f3218e511db84bdf522d24700ee38ebe9b558046d0bdf0d936a
SHA512 (rails-6.1.1-tools.txz) = 6852616efe73dfa6d7319c1bfb941ebfa0d2413ba9ae0c3b9f5bbb1e11e407e8137764f1dd64243af200006d7865b3ab3a0f03677c2318467fafc496853e7a0a

Loading…
Cancel
Save