Created
July 26, 2022 12:27
-
-
Save pvalena/31f04c6e6b827d6f305886ba077cbeb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- rubygem-image_processing/.generated.spec 2022-07-26 14:18:04.610278006 +0200 | |
+++ rubygem-image_processing/rubygem-image_processing.spec 2022-07-26 13:21:47.207000731 +0200 | |
@@ -1,7 +1,9 @@ | |
-Downloaded image_processing-1.12.2 | |
-# Generated from image_processing-1.12.2.gem by gem2rpm -*- rpm-spec -*- | |
+# Generated from image_processing-1.11.0.gem by gem2rpm -*- rpm-spec -*- | |
%global gem_name image_processing | |
+# dhash-vips gem is not in Fedora yet | |
+%bcond_with dhash-vips | |
+ | |
Name: rubygem-%{gem_name} | |
Version: 1.12.2 | |
Release: 1%{?dist} | |
@@ -9,14 +11,20 @@ | |
License: MIT | |
URL: https://github.com/janko/image_processing | |
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem | |
+# Tests are not shipped with the gem, you may check them out like so: | |
+# git clone --no-checkout https://github.com/janko/image_processing | |
+# cd image_processing && git archive -v -o image_processing-1.12.2-tests.txz v1.12.2 test/ | |
+Source1: %{gem_name}-%{version}-tests.txz | |
+ | |
BuildRequires: ruby(release) | |
BuildRequires: rubygems-devel | |
BuildRequires: ruby >= 2.3 | |
-# BuildRequires: rubygem(minitest) >= 5.8 | |
-# BuildRequires: rubygem(minitest) < 6 | |
-# BuildRequires: rubygem(minitest-hooks) >= 1.4.2 | |
-# BuildRequires: rubygem(minispec-metadata) | |
-# BuildRequires: rubygem(dhash-vips) | |
+BuildRequires: rubygem(minitest) >= 5.8 | |
+BuildRequires: rubygem(mini_magick) | |
+%if %{with dhash-vips} | |
+BuildRequires: rubygem(dhash-vips) | |
+%endif | |
+BuildRequires: rubygem(ruby-vips) | |
BuildArch: noarch | |
%description | |
@@ -33,14 +41,15 @@ | |
Documentation for %{name}. | |
%prep | |
-%setup -q -n %{gem_name}-%{version} | |
+%setup -q -n %{gem_name}-%{version} -b1 | |
+ | |
+# dhash-vips is not in Fedora yet. | |
+%if %{without dhash-vips} | |
+%gemspec_remove_dep -d -g dhash-vips | |
+%endif | |
%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 | |
@@ -48,11 +57,31 @@ | |
cp -a .%{gem_dir}/* \ | |
%{buildroot}%{gem_dir}/ | |
- | |
- | |
%check | |
pushd .%{gem_instdir} | |
-# ruby -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' | |
+ln -s %{_builddir}/test . | |
+ | |
+# Tests dependencies that are not needed | |
+sed -i '/require .minitest.hooks/ s/^/#/g' test/test_helper.rb | |
+sed -i '/require .minispec-metadata/ s/^/#/g' test/test_helper.rb | |
+sed -i '/require .bundler./ s/^/#/g' test/test_helper.rb | |
+ | |
+%if %{without dhash-vips} | |
+sed -i -e '/require .dhash-vips./ s/^/#/g' \ | |
+ -e '/^ def distance(image1, image2)/ a \ | |
+ skip ' test/test_helper.rb | |
+ | |
+%endif | |
+ | |
+# Use the RUBY_ENGINE check to avoid phashion dependency | |
+sed -i '/RUBY_ENGINE == "jruby"/ s/jruby/ruby/' test/test_helper.rb | |
+ | |
+# Test output has changed with vips or rubygems-vips version | |
+# https://github.com/janko/image_processing/issues/98 | |
+sed -i '/it "raises correct Vips::Error on unknown saver" do/ a\ | |
+ skip ' test/vips_test.rb | |
+ | |
+ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' | |
popd | |
%files | |
@@ -66,8 +95,26 @@ | |
%doc %{gem_docdir} | |
%doc %{gem_instdir}/CHANGELOG.md | |
%doc %{gem_instdir}/README.md | |
-%{gem_instdir}/image_processing.gemspec | |
+%{gem_instdir}/%{gem_name}.gemspec | |
%changelog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment