From 91bfebaaadad978aba60c844615b38071b8d93b6 Mon Sep 17 00:00:00 2001 From: Vít Ondruch Date: Dec 15 2016 15:04:39 +0000 Subject: Update to bson 4.2.0. --- diff --git a/.gitignore b/.gitignore index da997fc..f564a3a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /bson-1.10.2-tests.tgz /bson-1.10.2.gem /bson-4.1.1.gem +/bson-4.2.0.gem diff --git a/bson-4.1.1-Fix-Big-Endian-detection.patch b/bson-4.1.1-Fix-Big-Endian-detection.patch deleted file mode 100644 index 0159472..0000000 --- a/bson-4.1.1-Fix-Big-Endian-detection.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ext/bson/native-endian.h.orig 2016-12-07 13:28:27.715599434 +0100 -+++ ext/bson/native-endian.h 2016-12-07 13:56:53.564406614 +0100 -@@ -36,11 +36,19 @@ - #endif - - #ifndef BSON_BYTE_ORDER -+#if defined(__BYTE_ORDER__) -+# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+# define BSON_BYTE_ORDER 1234 -+# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -+# define BSON_BYTE_ORDER 4321 -+# endif -+#elif defined(BYTE_ORDER) - # if BYTE_ORDER == LITTLE_ENDIAN - # define BSON_BYTE_ORDER 1234 - # elif BYTE_ORDER == BIG_ENDIAN - # define BSON_BYTE_ORDER 4321 - # endif -+#endif - #endif - - #if defined(__sun) -@@ -59,7 +59,7 @@ - # define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64(v) - # endif - #elif defined(__GNUC__) && (__GNUC__ >= 4) --# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3 -+# if __GNUC__ > 4 || (defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3) - # define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 ((uint32_t)v) - # define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 ((uint64_t)v) - # endif diff --git a/bson-4.2.0-Force-unpacking-Q-and-update-big-endian-byte-order-check.patch b/bson-4.2.0-Force-unpacking-Q-and-update-big-endian-byte-order-check.patch new file mode 100644 index 0000000..54d165b --- /dev/null +++ b/bson-4.2.0-Force-unpacking-Q-and-update-big-endian-byte-order-check.patch @@ -0,0 +1,108 @@ +From 47a77e729d4759c06c9340bd6ae1a3f8de8006d6 Mon Sep 17 00:00:00 2001 +From: Emily +Date: Tue, 13 Dec 2016 13:40:31 +0100 +Subject: [PATCH 1/2] RUBY-1173 Force unpacking Q< and update big endian byte + order check + +--- + ext/bson/native-endian.h | 18 ++++++++++-------- + lib/bson/decimal128.rb | 2 +- + spec/bson/decimal128_spec.rb | 6 +++++- + 3 files changed, 16 insertions(+), 10 deletions(-) + +diff --git a/ext/bson/native-endian.h b/ext/bson/native-endian.h +index 49b4517..ffc0aed 100644 +--- a/ext/bson/native-endian.h ++++ b/ext/bson/native-endian.h +@@ -26,6 +26,16 @@ + #define BSON_BIG_ENDIAN 4321 + #define BSON_LITTLE_ENDIAN 1234 + ++/* See a similar check in ruby's sha2.h */ ++# ifndef BSON_BYTE_ORDER ++# ifdef WORDS_BIGENDIAN ++# define BSON_BYTE_ORDER BSON_BIG_ENDIAN ++# else ++# define BSON_BYTE_ORDER BSON_LITTLE_ENDIAN ++# endif ++# endif /* BSON_BYTE_ORDER */ ++ ++ + #if defined(__sun) + # include + # if defined(_LITTLE_ENDIAN) +@@ -35,14 +45,6 @@ + # endif + #endif + +-#ifndef BSON_BYTE_ORDER +-# if BYTE_ORDER == LITTLE_ENDIAN +-# define BSON_BYTE_ORDER 1234 +-# elif BYTE_ORDER == BIG_ENDIAN +-# define BSON_BYTE_ORDER 4321 +-# endif +-#endif +- + #if defined(__sun) + # define BSON_UINT16_SWAP_LE_BE(v) __bson_uint16_swap_slow((uint16_t)v) + # define BSON_UINT32_SWAP_LE_BE(v) __bson_uint32_swap_slow((uint32_t)v) +diff --git a/lib/bson/decimal128.rb b/lib/bson/decimal128.rb +index f13e494..6d9beb2 100644 +--- a/lib/bson/decimal128.rb ++++ b/lib/bson/decimal128.rb +@@ -200,7 +200,7 @@ class << self + # + # @since 4.2.0 + def from_bson(buffer) +- from_bits(*buffer.get_decimal128_bytes.unpack('Q*')) ++ from_bits(*buffer.get_decimal128_bytes.unpack('Q<*')) + end + + # Instantiate a Decimal128 from a string. +diff --git a/spec/bson/decimal128_spec.rb b/spec/bson/decimal128_spec.rb +index 1feead5..c1c409a 100644 +--- a/spec/bson/decimal128_spec.rb ++++ b/spec/bson/decimal128_spec.rb +@@ -49,6 +49,10 @@ + described_class.from_bson(buffer) + end + ++ let(:expected_bson) do ++ [expected_low_bits].pack(BSON::Int64::PACK) + [expected_high_bits].pack(BSON::Int64::PACK) ++ end ++ + it 'sets the correct high order bits' do + expect(high_bits).to eq(expected_high_bits) + end +@@ -58,7 +62,7 @@ + end + + it 'serializes to bson' do +- expect(buffer.length).to eq(16) ++ expect(buffer.to_s).to eq(expected_bson) + end + + it 'deserializes to the correct bits' do + +From abdd9ca566811a148af04363eab425f11f3ac41f Mon Sep 17 00:00:00 2001 +From: Emily +Date: Tue, 13 Dec 2016 13:49:46 +0100 +Subject: [PATCH 2/2] Incorrect GCC version check + +--- + ext/bson/native-endian.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ext/bson/native-endian.h b/ext/bson/native-endian.h +index ffc0aed..6e1f2f2 100644 +--- a/ext/bson/native-endian.h ++++ b/ext/bson/native-endian.h +@@ -61,7 +61,7 @@ + # define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64(v) + # endif + #elif defined(__GNUC__) && (__GNUC__ >= 4) +-# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3 ++# if __GNUC__ > 4 || (defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3) + # define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 ((uint32_t)v) + # define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 ((uint64_t)v) + # endif diff --git a/rubygem-bson.spec b/rubygem-bson.spec index f8fc145..81919d4 100644 --- a/rubygem-bson.spec +++ b/rubygem-bson.spec @@ -2,8 +2,8 @@ %global gem_name bson Name: rubygem-%{gem_name} -Version: 4.1.1 -Release: 2%{?dist} +Version: 4.2.0 +Release: 1%{?dist} Summary: Ruby Implementation of the BSON specification Group: Development/Languages License: ASL 2.0 @@ -11,7 +11,7 @@ URL: http://bsonspec.org Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem # Big Endian is not properly detected on PPC. # https://jira.mongodb.org/browse/RUBY-1173 -Patch0: bson-4.1.1-Fix-Big-Endian-detection.patch +Patch0: bson-4.2.0-Force-unpacking-Q-and-update-big-endian-byte-order-check.patch BuildRequires: ruby(release) BuildRequires: rubygems-devel >= 1.3.6 BuildRequires: ruby-devel >= 1.9.3 @@ -46,7 +46,7 @@ gem unpack %{SOURCE0} gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec -%patch0 +%patch0 -p1 %build # Create the gem as gem install only works on a gem file @@ -90,6 +90,9 @@ popd %{gem_instdir}/spec %changelog +* Thu Dec 15 2016 Vít Ondruch - 4.2.0-1 +- Update to bson 4.2.0. + * Mon Dec 05 2016 Vít Ondruch - 4.1.1-2 - Fix build on PPC. diff --git a/sources b/sources index b08275d..25dc616 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4ba19b8f18f9a69d8703639d79f8b73d bson-4.1.1.gem +SHA512 (bson-4.2.0.gem) = f56ae48a8a48fec52867ded1b4d87670bf70564bf5051e18aa72a30b0ba7679b4867ac79ac53e088e1d39808cc55ccaf4566f9a4c09b722caa0b6b92c73c615e