pg 0.18.2-x64-mingw32 → 0.18.3-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,16 @@
1
+ == v0.18.3 [2015-09-03] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+ - Use rake-compiler-dock to build windows gems easily.
5
+ - Add CI-tests on appveyor and fix test cases accordingly.
6
+
7
+ Bugfixes:
8
+ - Fix data type resulting in wrong base64 encoding.
9
+ - Change instance_of checks to kind_of for subclassing. #220
10
+ - TextDecoder::Date returns an actual Ruby Date instead of a Time
11
+ (thanks to Thomas Ramfjord)
12
+
13
+
1
14
  == v0.18.2 [2015-05-14] Michael Granger <ged@FaerieMUD.org>
2
15
 
3
16
  Enhancements:
@@ -2,9 +2,9 @@
2
2
 
3
3
  In order to build this extension on MS Windows you will need a couple things.
4
4
 
5
- First, a compiler. For the one click installer this means you should either
6
- use VC++ 6.0 or the compiler that comes with cygwin or mingw if you're
7
- building on that platform.
5
+ First, a compiler. For the one click installer this means you should use
6
+ the DevKit or the compiler that comes with cygwin if you're building on that
7
+ platform.
8
8
 
9
9
  If you've built Ruby yourself, you should use the same compiler to build
10
10
  this library that you used to build Ruby.
@@ -29,34 +29,23 @@ Adjust your path accordingly. BE SURE TO USE THE SHORT PATH NAMES! If you
29
29
  try to use a path with spaces in it, the nmake.exe program will choke.
30
30
 
31
31
 
32
- == Cross compiling for mswin32
32
+ == Building binary 'pg' gems for MS Windows
33
33
 
34
- Using rake-compiler a cross compiled pg gem can be build on a Linux or MacOS X
35
- host for the win32 platform. The generated gem is statically linked against
36
- libpq and libssl. OpenSSL and PostgreSQL are downloaded and compiled from the
37
- sources. There are no runtime dependencies to any but the standard Windows
38
- DLLs.
34
+ Binary gems for windows can be built on Linux, OS-X and even on Windows
35
+ with the help of docker. This is how regular windows gems are built for
36
+ rubygems.org .
39
37
 
40
- Install mingw32 using the instructions in rake-compiler's README.
41
- For Debian/Ubuntu it is <tt>apt-get install gcc-mingw32</tt> .
42
- Use ruby-1.8.7 for the following commands.
38
+ To do this, install boot2docker [on Windows](https://github.com/boot2docker/windows-installer/releases)
39
+ or [on OS X](https://github.com/boot2docker/osx-installer/releases) and make
40
+ sure it is started. A native Docker installation is best on Linux.
43
41
 
44
- Download and cross compile ruby 1.8 and 1.9 for win32 with:
42
+ Then run:
45
43
 
46
- rake-compiler cross-ruby VERSION=1.8.7-p352
47
- rake-compiler cross-ruby VERSION=1.9.2-p290
44
+ rake gem:windows
48
45
 
49
- Download and cross compile pg for win32:
50
-
51
- rake cross native gem
52
-
53
- or with custom versions:
54
-
55
- rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2 \
56
- OPENSSL_VERSION=1.0.0e POSTGRESQL_VERSION=9.1.1
57
-
58
- If everything works, there should be pg-VERSION-x86-mingw32.gem in the pkg
59
- directory.
46
+ This will download a docker image suited for building windows gems, and it
47
+ will download and build OpenSSL and PostgreSQL. Finally the gem is built
48
+ containing binaries for all supported ruby versions.
60
49
 
61
50
 
62
51
  == Reporting Problems
@@ -29,7 +29,8 @@ A small example usage:
29
29
 
30
30
  == Build Status
31
31
 
32
- {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ged/ruby-pg]
32
+ {<img src="https://travis-ci.org/ged/ruby-pg.png?branch=master" alt="Build Status Travis-CI" />}[https://travis-ci.org/ged/ruby-pg]
33
+ {<img src="https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/api/projects/status/at4g4swb2cd4xji7/branch/master]
33
34
 
34
35
 
35
36
  == Requirements
data/Rakefile CHANGED
@@ -61,6 +61,7 @@ $hoespec = Hoe.spec 'pg' do
61
61
  self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
62
62
 
63
63
  self.dependency 'rake-compiler', '~> 0.9', :developer
64
+ self.dependency 'rake-compiler-dock', '~> 0.3', :developer
64
65
  self.dependency 'hoe', '~> 3.12', :developer
65
66
  self.dependency 'hoe-deveiate', '~> 0.6', :developer
66
67
  self.dependency 'hoe-bundler', '~> 1.0', :developer
@@ -150,6 +151,7 @@ file 'ChangeLog' do |task|
150
151
  if File.exist?('.hg/branch')
151
152
  $stderr.puts "Updating the changelog..."
152
153
  begin
154
+ include Hoe::MercurialHelpers
153
155
  content = make_changelog()
154
156
  rescue NameError
155
157
  abort "Packaging tasks require the hoe-mercurial plugin (gem install hoe-mercurial)"
@@ -21,17 +21,28 @@ end
21
21
  class CrossLibrary < OpenStruct
22
22
  include Rake::DSL
23
23
 
24
- def initialize(for_platform, openssl_config)
24
+ def initialize(for_platform, openssl_config, toolchain)
25
25
  super()
26
26
 
27
27
  self.for_platform = for_platform
28
28
  self.openssl_config = openssl_config
29
+ self.host_platform = toolchain
29
30
 
30
31
  # Cross-compilation constants
31
- self.openssl_version = ENV['OPENSSL_VERSION'] || '1.0.1i'
32
- self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.3.5'
33
-
34
- self.compile_home = Pathname( "./build" ).expand_path
32
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.0.2d'
33
+ self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '9.4.4'
34
+
35
+ # Check if symlinks work in the current working directory.
36
+ # This fails, if rake-compiler-dock is running on a Windows box.
37
+ begin
38
+ FileUtils.rm_f '.test_symlink'
39
+ FileUtils.ln_s '/', '.test_symlink'
40
+ rescue SystemCallError
41
+ # Symlinks don't work -> use home directory instead
42
+ self.compile_home = Pathname( "~/.ruby-pg-build" ).expand_path
43
+ else
44
+ self.compile_home = Pathname( "./build" ).expand_path
45
+ end
35
46
  self.static_sourcesdir = compile_home + 'sources'
36
47
  self.static_builddir = compile_home + 'builds' + for_platform
37
48
 
@@ -67,17 +78,6 @@ class CrossLibrary < OpenStruct
67
78
  self.postgresql_lib = static_postgresql_libdir + 'libpq.dll'
68
79
  self.postgresql_patches = Rake::FileList[ (MISCDIR + "postgresql-#{postgresql_version}.*.patch").to_s ]
69
80
 
70
- # Use rake-compilers config.yml to determine the toolchain that was used
71
- # to build Ruby for this platform.
72
- self.host_platform = begin
73
- config_file = YAML.load_file(File.expand_path("~/.rake-compiler/config.yml"))
74
- _, rbfile = config_file.find{|key, fname| key.start_with?("rbconfig-#{for_platform}-") }
75
- IO.read(rbfile).match(/CONFIG\["CC"\] = "(.*)"/)[1].sub(/\-gcc/, '')
76
- rescue
77
- nil
78
- end
79
-
80
-
81
81
  # clean intermediate files and folders
82
82
  CLEAN.include( static_builddir.to_s )
83
83
 
@@ -251,10 +251,10 @@ end
251
251
 
252
252
  if File.exist?(File.expand_path("~/.rake-compiler/config.yml"))
253
253
  CrossLibraries = [
254
- ['i386-mingw32', 'mingw'],
255
- ['x64-mingw32', 'mingw64'],
256
- ].map do |platform, openssl_config|
257
- CrossLibrary.new platform, openssl_config
254
+ ['i386-mingw32', 'mingw', 'i686-w64-mingw32'],
255
+ ['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
256
+ ].map do |platform, openssl_config, toolchain|
257
+ CrossLibrary.new platform, openssl_config, toolchain
258
258
  end
259
259
  else
260
260
  $stderr.puts "Cross-compilation disabled -- rake-compiler not properly installed"
@@ -283,3 +283,19 @@ ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
283
283
  sh "x86_64-w64-mingw32-strip -S tmp/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/pg_ext.so"
284
284
  end
285
285
  end
286
+
287
+ desc "Build the windows binary gems"
288
+ task 'gem:windows' => ['ChangeLog'] do
289
+ require 'rake_compiler_dock'
290
+
291
+ # Copy gem signing key and certs to be accessable from the docker container
292
+ mkdir_p 'build/gem'
293
+ sh "cp ~/.gem/gem-*.pem build/gem/"
294
+
295
+ RakeCompilerDock.sh <<-EOT
296
+ mkdir ~/.gem &&
297
+ cp build/gem/gem-*.pem ~/.gem/ &&
298
+ bundle install &&
299
+ rake cross native gem RUBYOPT=--disable-rubygems RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2
300
+ EOT
301
+ end
data/ext/pg.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg.c - Toplevel extension
3
- * $Id$
3
+ * $Id: pg.c,v b60c89ee93c8 2015/02/11 20:59:36 lars $
4
4
  *
5
5
  * Author/s:
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_column_map.c - PG::ColumnMap class extension
3
- * $Id$
3
+ * $Id: pg_binary_decoder.c,v 185638b52684 2014/11/08 20:43:53 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_column_map.c - PG::ColumnMap class extension
3
- * $Id$
3
+ * $Id: pg_binary_encoder.c,v ac23631c96d9 2014/10/14 11:50:21 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_connection.c - PG::Connection class extension
3
- * $Id$
3
+ * $Id: pg_connection.c,v eb4d3c003bd6 2015/05/25 20:04:04 ged $
4
4
  *
5
5
  */
6
6
 
@@ -1534,7 +1534,7 @@ pgconn_s_escape(VALUE self, VALUE string)
1534
1534
  Check_Type(string, T_STRING);
1535
1535
 
1536
1536
  escaped = ALLOC_N(char, RSTRING_LEN(string) * 2 + 1);
1537
- if(rb_obj_class(self) == rb_cPGconn) {
1537
+ if( rb_obj_is_kind_of(self, rb_cPGconn) ) {
1538
1538
  size = PQescapeStringConn(pg_get_pgconn(self), escaped,
1539
1539
  RSTRING_PTR(string), RSTRING_LEN(string), &error);
1540
1540
  if(error) {
@@ -1547,7 +1547,7 @@ pgconn_s_escape(VALUE self, VALUE string)
1547
1547
  result = rb_str_new(escaped, size);
1548
1548
  xfree(escaped);
1549
1549
  OBJ_INFECT(result, string);
1550
- PG_ENCODING_SET_NOCHECK(result, ENCODING_GET( rb_obj_class(self) == rb_cPGconn ? self : string ));
1550
+ PG_ENCODING_SET_NOCHECK(result, ENCODING_GET( rb_obj_is_kind_of(self, rb_cPGconn) ? self : string ));
1551
1551
 
1552
1552
  return result;
1553
1553
  }
@@ -1587,7 +1587,7 @@ pgconn_s_escape_bytea(VALUE self, VALUE str)
1587
1587
  from = (unsigned char*)RSTRING_PTR(str);
1588
1588
  from_len = RSTRING_LEN(str);
1589
1589
 
1590
- if(rb_obj_class(self) == rb_cPGconn) {
1590
+ if ( rb_obj_is_kind_of(self, rb_cPGconn) ) {
1591
1591
  to = PQescapeByteaConn(pg_get_pgconn(self), from, from_len, &to_len);
1592
1592
  } else {
1593
1593
  to = PQescapeBytea( from, from_len, &to_len);
@@ -3031,7 +3031,7 @@ pgconn_s_quote_ident(VALUE self, VALUE in_str)
3031
3031
  pg_text_enc_identifier(NULL, in_str, NULL, &ret);
3032
3032
 
3033
3033
  OBJ_INFECT(ret, in_str);
3034
- PG_ENCODING_SET_NOCHECK(ret, ENCODING_GET( rb_obj_class(self) == rb_cPGconn ? self : in_str ));
3034
+ PG_ENCODING_SET_NOCHECK(ret, ENCODING_GET( rb_obj_is_kind_of(self, rb_cPGconn) ? self : in_str ));
3035
3035
 
3036
3036
  return ret;
3037
3037
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_result.c - PG::Result class extension
3
- * $Id$
3
+ * $Id: pg_result.c,v 1269b8ad77b8 2015/02/06 16:38:23 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_text_decoder.c - PG::TextDecoder module
3
- * $Id$
3
+ * $Id: pg_text_decoder.c,v b111c84b8445 2015/02/11 20:54:03 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_text_encoder.c - PG::TextEncoder module
3
- * $Id$
3
+ * $Id: pg_text_encoder.c,v b859963462b2 2015/03/13 17:39:35 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_column_map.c - PG::ColumnMap class extension
3
- * $Id$
3
+ * $Id: pg_type_map.c,v c99d26015e3c 2014/12/12 20:58:25 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_type_map_all_strings.c - PG::TypeMapAllStrings class extension
3
- * $Id$
3
+ * $Id: pg_type_map_all_strings.c,v c53f993a4254 2014/12/12 21:57:29 lars $
4
4
  *
5
5
  * This is the default typemap.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_type_map_by_class.c - PG::TypeMapByClass class extension
3
- * $Id$
3
+ * $Id: pg_type_map_by_class.c,v eeb8a82c5328 2014/11/10 19:34:02 lars $
4
4
  *
5
5
  * This type map can be used to select value encoders based on the class
6
6
  * of the given value to be send.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_column_map.c - PG::ColumnMap class extension
3
- * $Id$
3
+ * $Id: pg_type_map_by_column.c,v d369d31e8fe3 2014/10/22 08:47:29 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_type_map_by_mri_type.c - PG::TypeMapByMriType class extension
3
- * $Id$
3
+ * $Id: pg_type_map_by_mri_type.c,v 1269b8ad77b8 2015/02/06 16:38:23 lars $
4
4
  *
5
5
  * This type map can be used to select value encoders based on the MRI-internal
6
6
  * value type code.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_type_map_by_oid.c - PG::TypeMapByOid class extension
3
- * $Id$
3
+ * $Id: pg_type_map_by_oid.c,v c99d26015e3c 2014/12/12 20:58:25 lars $
4
4
  *
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * pg_type_map_in_ruby.c - PG::TypeMapInRuby class extension
3
- * $Id$
3
+ * $Id: pg_type_map_in_ruby.c,v 3d89d3aae4fd 2015/01/05 16:19:41 kanis $
4
4
  *
5
5
  */
6
6
 
data/ext/util.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * util.c - Utils for ruby-pg
3
- * $Id$
3
+ * $Id: util.c,v 5fb9170f6a7d 2015/06/29 11:15:12 kanis $
4
4
  *
5
5
  */
6
6
 
@@ -17,7 +17,7 @@ static const char base64_encode_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk
17
17
  void
18
18
  base64_encode( char *out, char *in, int len)
19
19
  {
20
- char *in_ptr = in + len;
20
+ unsigned char *in_ptr = (unsigned char *)in + len;
21
21
  char *out_ptr = out + BASE64_ENCODED_SIZE(len);
22
22
  int part_len = len % 3;
23
23
 
Binary file
Binary file
Binary file
data/lib/pg.rb CHANGED
@@ -24,10 +24,10 @@ end
24
24
  module PG
25
25
 
26
26
  # Library version
27
- VERSION = '0.18.2'
27
+ VERSION = '0.18.3'
28
28
 
29
29
  # VCS revision
30
- REVISION = %q$Revision$
30
+ REVISION = %q$Revision: 3b49541c9f12 $
31
31
 
32
32
  class NotAllCopyDataRetrieved < PG::Error
33
33
  end
@@ -25,9 +25,9 @@ module PG::BasicTypeRegistry
25
25
 
26
26
  # populate the enum types
27
27
  _enums, leaves = leaves.partition { |row| row['typinput'] == 'enum_in' }
28
- # enums.each do |row|
29
- # coder_map[row['oid'].to_i] = OID::Enum.new
30
- # end
28
+ # enums.each do |row|
29
+ # coder_map[row['oid'].to_i] = OID::Enum.new
30
+ # end
31
31
 
32
32
  # populate the base types
33
33
  leaves.find_all { |row| coders_by_name.key?(row['typname']) }.each do |row|
@@ -41,9 +41,9 @@ module PG::BasicTypeRegistry
41
41
  _records_by_oid = result.group_by { |row| row['oid'] }
42
42
 
43
43
  # populate composite types
44
- # nodes.each do |row|
45
- # add_oid row, records_by_oid, coder_map
46
- # end
44
+ # nodes.each do |row|
45
+ # add_oid row, records_by_oid, coder_map
46
+ # end
47
47
 
48
48
  if arraycoder
49
49
  # populate array types
@@ -62,11 +62,11 @@ module PG::BasicTypeRegistry
62
62
  end
63
63
 
64
64
  # populate range types
65
- # ranges.find_all { |row| coder_map.key? row['rngsubtype'].to_i }.each do |row|
66
- # subcoder = coder_map[row['rngsubtype'].to_i]
67
- # range = OID::Range.new subcoder
68
- # coder_map[row['oid'].to_i] = range
69
- # end
65
+ # ranges.find_all { |row| coder_map.key? row['rngsubtype'].to_i }.each do |row|
66
+ # subcoder = coder_map[row['rngsubtype'].to_i]
67
+ # range = OID::Range.new subcoder
68
+ # coder_map[row['oid'].to_i] = range
69
+ # end
70
70
 
71
71
  @coders = coder_map.values
72
72
  @coders_by_name = @coders.inject({}){|h, t| h[t.name] = t; h }
@@ -154,46 +154,46 @@ module PG::BasicTypeRegistry
154
154
  alias_type 0, 'int8', 'int2'
155
155
  alias_type 0, 'oid', 'int2'
156
156
 
157
- # register_type 0, 'numeric', OID::Decimal.new
157
+ # register_type 0, 'numeric', OID::Decimal.new
158
158
  register_type 0, 'text', PG::TextEncoder::String, PG::TextDecoder::String
159
159
  alias_type 0, 'varchar', 'text'
160
160
  alias_type 0, 'char', 'text'
161
161
  alias_type 0, 'bpchar', 'text'
162
162
  alias_type 0, 'xml', 'text'
163
163
 
164
- # # FIXME: why are we keeping these types as strings?
165
- # alias_type 'tsvector', 'text'
166
- # alias_type 'interval', 'text'
167
- # alias_type 'macaddr', 'text'
168
- # alias_type 'uuid', 'text'
169
- #
170
- # register_type 'money', OID::Money.new
164
+ # FIXME: why are we keeping these types as strings?
165
+ # alias_type 'tsvector', 'text'
166
+ # alias_type 'interval', 'text'
167
+ # alias_type 'macaddr', 'text'
168
+ # alias_type 'uuid', 'text'
169
+ #
170
+ # register_type 'money', OID::Money.new
171
171
  # There is no PG::TextEncoder::Bytea, because it's simple and more efficient to send bytea-data
172
172
  # in binary format, either with PG::BinaryEncoder::Bytea or in Hash param format.
173
173
  register_type 0, 'bytea', nil, PG::TextDecoder::Bytea
174
174
  register_type 0, 'bool', PG::TextEncoder::Boolean, PG::TextDecoder::Boolean
175
- # register_type 'bit', OID::Bit.new
176
- # register_type 'varbit', OID::Bit.new
177
- #
175
+ # register_type 'bit', OID::Bit.new
176
+ # register_type 'varbit', OID::Bit.new
177
+
178
178
  register_type 0, 'float4', PG::TextEncoder::Float, PG::TextDecoder::Float
179
179
  alias_type 0, 'float8', 'float4'
180
180
 
181
181
  register_type 0, 'timestamp', PG::TextEncoder::TimestampWithoutTimeZone, PG::TextDecoder::TimestampWithoutTimeZone
182
182
  register_type 0, 'timestamptz', PG::TextEncoder::TimestampWithTimeZone, PG::TextDecoder::TimestampWithTimeZone
183
183
  register_type 0, 'date', PG::TextEncoder::Date, PG::TextDecoder::Date
184
- # register_type 'time', OID::Time.new
185
- #
186
- # register_type 'path', OID::Text.new
187
- # register_type 'point', OID::Point.new
188
- # register_type 'polygon', OID::Text.new
189
- # register_type 'circle', OID::Text.new
190
- # register_type 'hstore', OID::Hstore.new
191
- # register_type 'json', OID::Json.new
192
- # register_type 'citext', OID::Text.new
193
- # register_type 'ltree', OID::Text.new
194
- #
195
- # register_type 'cidr', OID::Cidr.new
196
- # alias_type 'inet', 'cidr'
184
+ # register_type 'time', OID::Time.new
185
+ #
186
+ # register_type 'path', OID::Text.new
187
+ # register_type 'point', OID::Point.new
188
+ # register_type 'polygon', OID::Text.new
189
+ # register_type 'circle', OID::Text.new
190
+ # register_type 'hstore', OID::Hstore.new
191
+ # register_type 'json', OID::Json.new
192
+ # register_type 'citext', OID::Text.new
193
+ # register_type 'ltree', OID::Text.new
194
+ #
195
+ # register_type 'cidr', OID::Cidr.new
196
+ # alias_type 'inet', 'cidr'
197
197
 
198
198
 
199
199