From 74f12a36089e6a95de72697d8f860fe7c3f7e42c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 27 Apr 2020 11:54:23 +0200 Subject: [PATCH] Update to Mustache 1.1.1. Resolves: rhbz#1321203 Resolves: rhbz#1800018 --- .gitignore | 1 + ...stache-1.1.1-Fix-test-race-condition.patch | 36 +++++++++++++++++++ rubygem-mustache.spec | 28 +++++++++++---- sources | 2 +- 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 rubygem-mustache-1.1.1-Fix-test-race-condition.patch diff --git a/.gitignore b/.gitignore index 5cc3b4c..b10afd8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /mustache-0.99.4.gem /mustache-0.99.5.gem /mustache-1.0.2.gem +/mustache-1.1.1.gem diff --git a/rubygem-mustache-1.1.1-Fix-test-race-condition.patch b/rubygem-mustache-1.1.1-Fix-test-race-condition.patch new file mode 100644 index 0000000..824825b --- /dev/null +++ b/rubygem-mustache-1.1.1-Fix-test-race-condition.patch @@ -0,0 +1,36 @@ +From 407c6a5db6c1f1cfb40bd6113f07f067d07885a4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= +Date: Mon, 27 Apr 2020 11:16:17 +0200 +Subject: [PATCH] Fix test race condition. + +The test suite randomly fails with errors such as: + +~~~ + 1) Failure: +AutoloadingTest#test_autoload_lowercase [/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]: +Expected: Comments + Actual: nil +~~~ + +This happens when `test_namespaced*` test cases are executed earlier +than the remaining test cases, because they are defining +`view_namespace` but not cleaning up afterwards. +--- + test/autoloading_test.rb | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/test/autoloading_test.rb b/test/autoloading_test.rb +index 0a7ad762..77eb3557 100644 +--- a/test/autoloading_test.rb ++++ b/test/autoloading_test.rb +@@ -7,6 +7,10 @@ def setup + Mustache.view_path = File.dirname(__FILE__) + '/fixtures' + end + ++ def teardown ++ Mustache.remove_instance_variable(:@view_namespace) if Mustache.instance_variable_defined?(:@view_namespace) ++ end ++ + def test_autoload + klass = Mustache.view_class(:Comments) + assert_equal Comments, klass diff --git a/rubygem-mustache.spec b/rubygem-mustache.spec index 629bc57..34c41c0 100644 --- a/rubygem-mustache.spec +++ b/rubygem-mustache.spec @@ -1,12 +1,15 @@ %global gem_name mustache Name: rubygem-%{gem_name} -Version: 1.0.2 -Release: 10%{?dist} +Version: 1.1.1 +Release: 1%{?dist} Summary: Mustache is a framework-agnostic way to render logic-free views License: MIT URL: https://github.com/mustache/mustache Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# Fix test race condition. +# https://github.com/mustache/mustache/pull/258 +Patch0: rubygem-mustache-1.1.1-Fix-test-race-condition.patch BuildRequires: ruby(release) BuildRequires: rubygems-devel BuildRequires: ruby @@ -36,16 +39,24 @@ BuildArch: noarch Documentation for %{name}. %prep -%setup -q -c -T -%gem_install -n %{SOURCE0} +%setup -q -n %{gem_name}-%{version} + +%patch0 -p1 %build +# Create the gem as gem install only works on a gem file +gem build ../%{gem_name}-%{version}.gemspec + +# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir +# by default, so that we can move it into the buildroot in %%install +%gem_install %install mkdir -p %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* \ %{buildroot}%{gem_dir}/ + mkdir -p %{buildroot}%{_bindir} cp -a .%{_bindir}/* \ %{buildroot}%{_bindir}/ @@ -63,8 +74,8 @@ cp -a .%{gem_instdir}/man/*.html . %check pushd .%{gem_instdir} -# We are not interested in code quality that much. -sed -r -i '/[Cc]ode[Cc]limate/ s/^/#/' test/helper.rb +# Code coverage is not really interesting for Fedora. +sed -i '/simplecov/,/^end$/ s/^/#/' test/helper.rb # UTF8 environment has to be set. # https://github.com/mustache/mustache/issues/208 @@ -91,6 +102,11 @@ popd %{gem_instdir}/test %changelog +* Mon Apr 27 2020 Vít Ondruch - 1.1.1-1 +- Update to Mustache 1.1.1. + Resolves: rhbz#1321203 + Resolves: rhbz#1800018 + * Thu Jan 30 2020 Fedora Release Engineering - 1.0.2-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/sources b/sources index bd7467c..76bd4cc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -74f451ce0995fb2143a46a8d418886a5 mustache-1.0.2.gem +SHA512 (mustache-1.1.1.gem) = 91a18a374a0348317d0801d6784fedd0782d7a08f128d3ab7050e631b34e45cecd49c4b1e2a9e17204f70bf169c107a92a1e210532bd3faa98edf8b1b5e8e43c