Wrap rexml depedency with fedora release

Add upstream patch for rouge change
Add upstream patch to silence warnings from minitest
This commit is contained in:
Mamoru TASAKA 2021-01-23 16:18:14 +09:00
parent 90fe9df295
commit 4e0193a472
3 changed files with 103 additions and 3 deletions

View File

@ -0,0 +1,45 @@
From dd1bab4ee32324db3a11f5712718792164bd38c8 Mon Sep 17 00:00:00 2001
From: Thomas Leitner <t_leitner@gmx.at>
Date: Sat, 27 Jun 2020 11:35:15 +0200
Subject: [PATCH] Use assert_equal instead of .must_equal in test cases
---
test/test_location.rb | 4 ++--
test/test_string_scanner_kramdown.rb | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/test_location.rb b/test/test_location.rb
index 41295dc4..d2642c78 100644
--- a/test/test_location.rb
+++ b/test/test_location.rb
@@ -18,7 +18,7 @@
def check_element_for_location(element)
if (match = /^line-(\d+)/.match(element.attr['class'] || ''))
expected_line = match[1].to_i
- element.options[:location].must_equal(expected_line)
+ assert_equal(expected_line, element.options[:location])
end
element.children.each do |child|
check_element_for_location(child)
@@ -187,7 +187,7 @@ def check_element_for_location(element)
*[duplicate]: The second definition
)
doc = Kramdown::Document.new(test_string.strip)
- doc.warnings.must_equal ["Duplicate abbreviation ID 'duplicate' on line 4 - overwriting"]
+ assert_equal(["Duplicate abbreviation ID 'duplicate' on line 4 - overwriting"], doc.warnings)
end
it 'handles abbreviations' do
diff --git a/test/test_string_scanner_kramdown.rb b/test/test_string_scanner_kramdown.rb
index a2c91ebc..713c03c4 100644
--- a/test/test_string_scanner_kramdown.rb
+++ b/test/test_string_scanner_kramdown.rb
@@ -21,7 +21,7 @@
it "computes the correct current_line_number for example ##{i + 1}" do
str_sc = Kramdown::Utils::StringScanner.new(test_string)
scan_regexes.each {|scan_re| str_sc.scan_until(scan_re) }
- str_sc.current_line_number.must_equal expect
+ assert_equal(expect, str_sc.current_line_number)
end
end
end

View File

@ -0,0 +1,35 @@
From e1beb51af7fe4ecb85dbab7328f47a23c86c7df2 Mon Sep 17 00:00:00 2001
From: Thomas Leitner <t_leitner@gmx.at>
Date: Wed, 6 Jan 2021 16:05:10 +0100
Subject: [PATCH] Fix failing tests due to changes in rouge
---
Rakefile | 2 +-
test/testcases/block/06_codeblock/rouge/multiple.html | 2 +-
test/testcases/block/06_codeblock/rouge/simple.html | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/testcases/block/06_codeblock/rouge/multiple.html b/test/testcases/block/06_codeblock/rouge/multiple.html
index 03eddb47..6ece5432 100644
--- a/test/testcases/block/06_codeblock/rouge/multiple.html
+++ b/test/testcases/block/06_codeblock/rouge/multiple.html
@@ -6,6 +6,6 @@
</code></pre>
</div></div></div>
-<div class="language-php highlighter-rouge"><div class="custom-class"><div class="highlight"><pre class="highlight"><code><span class="nv">$foo</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Bar</span><span class="p">;</span>
+<div class="language-php highlighter-rouge"><div class="custom-class"><div class="highlight"><pre class="highlight"><code><span class="nv">$foo</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Bar</span><span class="p">;</span>
</code></pre>
</div></div></div>
diff --git a/test/testcases/block/06_codeblock/rouge/simple.html b/test/testcases/block/06_codeblock/rouge/simple.html
index 10f280a3..1c2259af 100644
--- a/test/testcases/block/06_codeblock/rouge/simple.html
+++ b/test/testcases/block/06_codeblock/rouge/simple.html
@@ -5,6 +5,6 @@
</code></pre>
</div></div>
-<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$foo</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Bar</span><span class="p">;</span>
+<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$foo</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">Bar</span><span class="p">;</span>
</code></pre>
</div></div>

View File

@ -3,7 +3,7 @@
Name: rubygem-%{gem_name}
Version: 2.2.1
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Fast, pure-Ruby Markdown-superset converter
License: MIT
@ -13,10 +13,16 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# https://github.com/gettalong/kramdown/commit/1b8fd33c3120bfc6e5164b449e2c2fc9c9306fde
# CVE-2020-14001
Patch1: rubygem-kramdown-2.2.1-0001-Add-option-forbidden_inline_options.patch
# https://github.com/gettalong/kramdown/commit/e1beb51af7fe4ecb85dbab7328f47a23c86c7df2
Patch2: rubygem-kramdown-2.2.1-rouge-3_26_0-testsuite.patch
# https://github.com/gettalong/kramdown/commit/dd1bab4ee32324db3a11f5712718792164bd38c8
Patch3: rubygem-kramdown-2.2.1-minitest-warning-must_equal.patch
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: rubygem(minitest) >= 5
%if 0%{?fedora} >= 34
BuildRequires: rubygem(rexml)
%endif
BuildRequires: rubygem(rouge)
BuildRequires: rubygem(test-unit)
BuildRequires: rubygem(stringex)
@ -53,7 +59,15 @@ Documentation for %{name}
gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
# 2.2.1 explicily adds rexml runtime dependency, which is actually required from
# ruby 3.0
# for ruby < 3.0, see bug 1838185
%if 0%{?fedora} < 34
sed -i %{gem_name}.gemspec -e '\@rexml@d'
%endif
%build
gem build %{gem_name}.gemspec
@ -86,8 +100,9 @@ LANG=C.UTF-8
pushd .%{gem_instdir}
# Test suite is now failing, need investigating
ruby -Ilib -e 'Dir.glob "./test/test_*.rb", &method(:require)' \
|| echo "Needs investigating"
export RUBYLIB=$(pwd)/lib
ruby -e 'Dir.glob "./test/test_*.rb", &method(:require)' \
|| false
popd
%files
@ -112,6 +127,11 @@ popd
%doc %{gem_docdir}
%changelog
* Sat Jan 23 2021 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.2.1-8
- Wrap rexml depedency with fedora release
- Add upstream patch for rouge change
- Add upstream patch to silence warnings from minitest
* Wed Jan 13 2021 Igor Raits <ignatenkobrain@fedoraproject.org> - 2.2.1-7
- Re-add rexml dependency