[rubygem-rdiscount] Recent usage of %gem_install to modify source
Mamoru TASAKA
mtasaka at fedoraproject.org
Thu Jan 29 05:40:37 UTC 2015
commit 7649ed00435157e8ae66ee7b56da3d942bbac78a
Author: John <mtasaka at fedoraproject.org>
Date: Thu Jan 29 14:40:27 2015 +0900
Recent usage of %gem_install to modify source
- Use system libmarkdown
rubygem-rdiscount.spec | 100 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 86 insertions(+), 14 deletions(-)
---
diff --git a/rubygem-rdiscount.spec b/rubygem-rdiscount.spec
index 7932359..1d9483f 100644
--- a/rubygem-rdiscount.spec
+++ b/rubygem-rdiscount.spec
@@ -3,14 +3,15 @@
Summary: Fast Implementation of Gruber's Markdown in C
Name: rubygem-%{gem_name}
Version: 2.1.7.1
-Release: 5%{?dist}
+Release: 7%{?dist}
Group: Development/Languages
License: ASL 1.1
URL: http://github.com/rtomayko/rdiscount
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: rubygems-devel
BuildRequires: ruby-devel
-BuildRequires: rubygem(minitest)
+BuildRequires: libmarkdown-devel
+BuildRequires: rubygem(test-unit)
%package doc
@@ -33,10 +34,58 @@ This package contains Rakefile, test directory and documentation for
%prep
-%setup -q -c -T
+gem unpack %{SOURCE0}
+%setup -q -D -T -n %{gem_name}-%{version}
+gem spec %{SOURCE0} -l --ruby | sed -e 's|,|,\n|g' > %{gem_name}.gemspec
+
+sed -i ext/extconf.rb \
+ -e '\@check_sizeof at s| == 4|== size|'
+
+# Remove files in discount-2.1.7
+cat >> discount_files<<EOF
+Csio.c
+amalloc.c
+basename.c
+css.c
+docheader.c
+dumptree.c
+emmatch.c
+flags.c
+generate.c
+github_flavoured.c
+html5.c
+main.c
+makepage.c
+markdown.c
+mkd2html.c
+mkdio.c
+mktags.c
+pgm_options.c
+resource.c
+setup.c
+tags.c
+theme.c
+toc.c
+xml.c
+xmlpage.c
+mkdio.h
+EOF
+
+cat discount_files | while read f ; do
+ rm -f ext/$f
+ sed -i %{gem_name}.gemspec -e "\@ext/$f at d"
+done
+
+sed -i ext/extconf.rb \
+ -e '\@create_makefile at i \$libs = "-lmarkdown"' \
+ %{nil}
%build
-%gem_install -n %{SOURCE0}
+rm -rf ./%{gem_extdir_mri}
+rm -rf ./%{gem_instdir}
+gem build %{gem_name}.gemspec
+
+%gem_install
%install
rm -rf %{buildroot}
@@ -60,17 +109,33 @@ rm -rf %{buildroot}
%check
pushd .%{gem_instdir}
+# Once
+ruby -Ilib:ext:. \
+ -e 'gem "test-unit" ; Dir.glob("test/*_test.rb").sort.each {|f| require f}' || :
+
+remove_fail_test() {
+ filename=$1
+ shift
+ num=$#
+ while [ $num -gt 0 ]
+ do
+ if [ ! -f ${filename}.orig ] ; then
+ cp -p $filename ${filename}.orig
+ fi
+ start=$(cat -n $filename | sed -n -e "\@^[ \t]*[1-9][0-9]*[ \t]*def $1 at p" | sed -e 's|^[ \t]*||' -e 's|def.*$||')
+ end=$(cat -n $filename | sed -n -e "\@^[ \t]*[1-9][0-9]*[ \t]*def $1@,\@^[ \t]*[1-9][0-9]*[ \t]*def at p" | tail -n 1 | sed -e 's|^[ \t]*||' -e 's|def.*$||')
+ end=$((end - 1))
+ sed -i -e "${start},${end}d" $filename
+ shift
+ num=$((num - 1))
+ done
+}
+# test_that_extra_definition_lists_work needs --with-dl=Both is added to discount configure option
+# test_that_tags_can_have_dashes_and_underscores needs --with-github-tags is added to discount configure option
+remove_fail_test test/rdiscount_test.rb test_that_extra_definition_lists_work test_that_tags_can_have_dashes_and_underscores
+ruby -Ilib:ext:. \
+ -e 'gem "test-unit" ; Dir.glob("test/*_test.rb").sort.each {|f| require f}'
-# Run test suite against Minitest 5.x needs some hacks.
-# TODO: Upstream these changes if possible.
-sed -i "/test\/unit/ s/^/#/" test/*.rb
-# assert_nothing_raised is not supported by minitest.
-sed -i "/assert_nothing_raised/ s/^/#/" test/*.rb
-ruby -rminitest/autorun -I$(dirs +1)%{gem_extdir_mri} - << \EOF
- Test = Minitest
- Minitest::Test.send :alias_method, :assert_not_equal, :refute_equal
- Dir.glob "./test/*_test.rb", &method(:require)
-EOF
popd
%files
@@ -98,6 +163,13 @@ popd
%changelog
+* Thu Jan 29 2015 Mamoru TASAKA <mtasaka at fedoraproject.org> - 2.1.7.1-7
+- Recent usage of %%gem_install to modify source
+- Use system libmarkdown
+
+* Thu Jan 29 2015 Mamoru TASAKA <mtasaka at fedoraproject.org> - 2.1.7.1-6
+- Simply use test-unit
+
* Fri Jan 16 2015 Vít Ondruch <vondruch at redhat.com> - 2.1.7.1-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_2.2
More information about the scm-commits
mailing list