From 4e0193a472336fc8700f143ea522b9f8d2335eb0 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Sat, 23 Jan 2021 16:18:14 +0900 Subject: [PATCH] Wrap rexml depedency with fedora release Add upstream patch for rouge change Add upstream patch to silence warnings from minitest --- ...wn-2.2.1-minitest-warning-must_equal.patch | 45 +++++++++++++++++++ ...ramdown-2.2.1-rouge-3_26_0-testsuite.patch | 35 +++++++++++++++ rubygem-kramdown.spec | 26 +++++++++-- 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 rubygem-kramdown-2.2.1-minitest-warning-must_equal.patch create mode 100644 rubygem-kramdown-2.2.1-rouge-3_26_0-testsuite.patch diff --git a/rubygem-kramdown-2.2.1-minitest-warning-must_equal.patch b/rubygem-kramdown-2.2.1-minitest-warning-must_equal.patch new file mode 100644 index 0000000..f81a5ee --- /dev/null +++ b/rubygem-kramdown-2.2.1-minitest-warning-must_equal.patch @@ -0,0 +1,45 @@ +From dd1bab4ee32324db3a11f5712718792164bd38c8 Mon Sep 17 00:00:00 2001 +From: Thomas Leitner +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 diff --git a/rubygem-kramdown-2.2.1-rouge-3_26_0-testsuite.patch b/rubygem-kramdown-2.2.1-rouge-3_26_0-testsuite.patch new file mode 100644 index 0000000..ebc8bf1 --- /dev/null +++ b/rubygem-kramdown-2.2.1-rouge-3_26_0-testsuite.patch @@ -0,0 +1,35 @@ +From e1beb51af7fe4ecb85dbab7328f47a23c86c7df2 Mon Sep 17 00:00:00 2001 +From: Thomas Leitner +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 @@ + + + +-
$foo = new Bar;
++
$foo = new Bar;
+ 
+
+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 @@ +
+
+ +-
$foo = new Bar;
++
$foo = new Bar;
+ 
+
diff --git a/rubygem-kramdown.spec b/rubygem-kramdown.spec index dc4c4c7..72f3d9c 100644 --- a/rubygem-kramdown.spec +++ b/rubygem-kramdown.spec @@ -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 - 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 - 2.2.1-7 - Re-add rexml dependency