[rubygem-activerecord] Add patch for SQLite 3.2.8

Josef Stribny jstribny at fedoraproject.org
Thu Dec 12 12:15:50 UTC 2013


commit b750f71ccce5169fa981f7d23d3207a55e011dcd
Author: Josef Stribny <jstribny at redhat.com>
Date:   Thu Dec 12 13:15:17 2013 +0100

    Add patch for SQLite 3.2.8

 rubygem-activerecord-sqlite-3.8.2-fix.patch |   14 ++++++++++++++
 rubygem-activerecord.spec                   |   22 ++++++++++++++++++----
 2 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/rubygem-activerecord-sqlite-3.8.2-fix.patch b/rubygem-activerecord-sqlite-3.8.2-fix.patch
new file mode 100644
index 0000000..897fbe5
--- /dev/null
+++ b/rubygem-activerecord-sqlite-3.8.2-fix.patch
@@ -0,0 +1,14 @@
+diff --git a/lib/active_record/connection_adapters/sqlite3_adapter.rb b/lib/active_record/connection_adapters/sqlite3_adapter.rb
+index e5ad08b..8edf2df 100644
+--- a/lib/active_record/connection_adapters/sqlite3_adapter.rb
++++ b/lib/active_record/connection_adapters/sqlite3_adapter.rb
+@@ -595,7 +595,8 @@ module ActiveRecord
+ 
+         def translate_exception(exception, message)
+           case exception.message
+-          when /column(s)? .* (is|are) not unique/
++          # Different error message for sqlite < 3.8.2 and >= 3.8.2
++          when /column(s)? .* (is|are) not unique/, /UNIQUE constraint failed: .*/
+             RecordNotUnique.new(message, exception)
+           else
+             super
diff --git a/rubygem-activerecord.spec b/rubygem-activerecord.spec
index 2e46287..8075c75 100644
--- a/rubygem-activerecord.spec
+++ b/rubygem-activerecord.spec
@@ -1,13 +1,13 @@
 # Generated from activerecord-1.15.5.gem by gem2rpm -*- rpm-spec -*-
 %global gem_name activerecord
 
-%global bootstrap 1
+%global bootstrap 0
 
 Summary: Implements the ActiveRecord pattern for ORM
 Name: rubygem-%{gem_name}
 Epoch: 1
 Version: 4.0.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 Group: Development/Languages
 License: MIT
 URL: http://www.rubyonrails.org
@@ -17,6 +17,9 @@ Source0: http://rubygems.org/downloads/activerecord-%{version}.gem
 # git checkout v4.0.2
 # tar czvf activerecord-4.0.2-tests.tgz test/
 Source1: activerecord-%{version}-tests.tgz
+# SQLite 3.8.2 changed the error message for unique constraint
+# https://github.com/rails/rails/pull/13291
+Patch0: rubygem-activerecord-sqlite-3.8.2-fix.patch
 Requires: ruby(release)
 Requires: ruby(rubygems)
 Requires: rubygem(activesupport) = %{version}
@@ -60,10 +63,17 @@ BuildArch: noarch
 Documentation for %{name}
 
 %prep
-%setup -n %{name}-%{version} -q -c -T
-%gem_install -n %{SOURCE0}
+gem unpack %{SOURCE0}
+%setup -q -D -T -n  %{gem_name}-%{version}
+
+gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
+
+%patch0 -p1
 
 %build
+gem build %{gem_name}.gemspec
+%gem_install
+
 
 %install
 mkdir -p %{buildroot}%{gem_dir}
@@ -109,6 +119,10 @@ popd
 %doc %{gem_instdir}/examples
 
 %changelog
+* Wed Dec 11 2013 Josef Stribny <jstribny at redhat.com> - 1:4.0.2-2
+- Enable tests
+- Patch for new sqlite
+
 * Thu Dec 05 2013 Josef Stribny <jstribny at redhat.com> - 1:4.0.2-1
 - Update to ActiveRecord 4.0.2
 - Disable tests


More information about the scm-commits mailing list