geoip2_c 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +3 -4
  3. data/README.md +21 -3
  4. data/docker-compose.yml +15 -1
  5. data/dockerfiles/{Dockerfile-ruby2.1 → Dockerfile-ruby2.5} +1 -1
  6. data/dockerfiles/{Dockerfile-ruby2.2 → Dockerfile-ruby2.6} +1 -1
  7. data/ext/geoip2/geoip2.c +5 -3
  8. data/ext/geoip2/libmaxminddb/.gitignore +3 -0
  9. data/ext/geoip2/libmaxminddb/.travis.yml +24 -2
  10. data/ext/geoip2/libmaxminddb/Changes.md +39 -0
  11. data/ext/geoip2/libmaxminddb/README.dev.md +41 -30
  12. data/ext/geoip2/libmaxminddb/README.md +3 -3
  13. data/ext/geoip2/libmaxminddb/bin/Makefile.am +5 -0
  14. data/ext/geoip2/libmaxminddb/bin/mmdblookup.c +333 -15
  15. data/ext/geoip2/libmaxminddb/configure.ac +5 -5
  16. data/ext/geoip2/libmaxminddb/dev-bin/ppa-release.sh +8 -5
  17. data/ext/geoip2/libmaxminddb/dev-bin/release.sh +7 -0
  18. data/ext/geoip2/libmaxminddb/dev-bin/valgrind-all.pl +10 -3
  19. data/ext/geoip2/libmaxminddb/include/maxminddb.h +11 -2
  20. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj +3 -1
  21. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj.filters +7 -1
  22. data/ext/geoip2/libmaxminddb/src/Makefile.am +18 -2
  23. data/ext/geoip2/libmaxminddb/src/data-pool.c +180 -0
  24. data/ext/geoip2/libmaxminddb/src/data-pool.h +52 -0
  25. data/ext/geoip2/libmaxminddb/src/maxminddb.c +58 -48
  26. data/ext/geoip2/libmaxminddb/t/Makefile.am +6 -2
  27. data/ext/geoip2/libmaxminddb/t/bad_databases_t.c +1 -0
  28. data/ext/geoip2/libmaxminddb/t/basic_lookup_t.c +35 -0
  29. data/ext/geoip2/libmaxminddb/t/data-pool-t.c +374 -0
  30. data/ext/geoip2/libmaxminddb/t/external_symbols_t.pl +106 -0
  31. data/lib/geoip2/version.rb +1 -1
  32. metadata +9 -7
  33. data/dockerfiles/Dockerfile-ruby2.3 +0 -8
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env perl
2
+
3
+ use strict;
4
+ use warnings;
5
+
6
+ use FindBin qw( $Bin );
7
+
8
+ _skip_tests_if_required_modules_are_not_present();
9
+ _skip_tests_if_nm_is_not_present();
10
+ _test_libs_external_symbols();
11
+
12
+ done_testing();
13
+
14
+ sub _skip_tests_if_required_modules_are_not_present {
15
+ eval <<'EOF';
16
+ use Test::More 0.88;
17
+ use IPC::Run3 qw( run3 );
18
+ EOF
19
+
20
+ if ($@) {
21
+ print
22
+ "1..0 # skip all tests skipped - these tests need the Test::More 0.88, IPC::Run3 modules:\n";
23
+ print "$@";
24
+ exit 0;
25
+ }
26
+ }
27
+
28
+ sub _skip_tests_if_nm_is_not_present {
29
+ run3(
30
+ [ 'nm', '-V' ],
31
+ \undef,
32
+ \undef,
33
+ \undef,
34
+ );
35
+
36
+ my $exit_status = $? >> 8;
37
+ if ($exit_status) {
38
+ print
39
+ "1..0 # skipp all tests skipped - this test requires the command line utility `nm`.\n";
40
+ exit 0;
41
+ }
42
+ }
43
+
44
+ sub _test_libs_external_symbols {
45
+ my @libs = _libs_to_test();
46
+
47
+ if (@libs) {
48
+ for my $lib (@libs) {
49
+ _test_lib_external_symbols($lib);
50
+ }
51
+ }
52
+ else {
53
+ fail('No libs were found to test');
54
+ }
55
+ }
56
+
57
+ sub _libs_to_test {
58
+ my $lib_dir = "$Bin/../src/.libs";
59
+ opendir my $dh, $lib_dir
60
+ or die "Failed to open the lib dir at $lib_dir for reading: $!\n";
61
+ my @libs = map { $lib_dir . q{/} . $_ }
62
+ grep { $_ =~ m/\.so$/ } readdir $dh;
63
+ closedir $dh;
64
+
65
+ return @libs;
66
+ }
67
+
68
+ sub _test_lib_external_symbols {
69
+ my $lib = shift;
70
+
71
+ my $stdout;
72
+ my $stderr;
73
+ run3(
74
+ [ 'nm', '-g', '--defined-only', $lib ],
75
+ \undef,
76
+ \$stdout,
77
+ \$stderr,
78
+ );
79
+
80
+ my $exit_status = $? >> 8;
81
+ ok( !$exit_status, 'nm returned a non-error status' )
82
+ or diag($stderr);
83
+
84
+ my @external_symbols = _extract_external_symbols($stdout);
85
+ is_deeply(
86
+ [ grep { $_ !~ m/^MMDB_/ } @external_symbols ],
87
+ [],
88
+ "$lib exports only MMDB_ symbols"
89
+ );
90
+ }
91
+
92
+ sub _extract_external_symbols {
93
+ my $nm_output = shift;
94
+
95
+ my @lines = split /\r\n|\r|\n/, $nm_output;
96
+
97
+ my @external_symbols;
98
+ for my $line (@lines) {
99
+ my @fields = split /\s+/, $line;
100
+ die "Unexpected nm output for line $line\n"
101
+ if @fields != 3;
102
+ push @external_symbols, $fields[2];
103
+ }
104
+
105
+ return @external_symbols;
106
+ }
@@ -1,3 +1,3 @@
1
1
  module GeoIP2
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoip2_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - okkez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-22 00:00:00.000000000 Z
11
+ date: 2019-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -98,10 +98,9 @@ files:
98
98
  - README.md
99
99
  - Rakefile
100
100
  - docker-compose.yml
101
- - dockerfiles/Dockerfile-ruby2.1
102
- - dockerfiles/Dockerfile-ruby2.2
103
- - dockerfiles/Dockerfile-ruby2.3
104
101
  - dockerfiles/Dockerfile-ruby2.4
102
+ - dockerfiles/Dockerfile-ruby2.5
103
+ - dockerfiles/Dockerfile-ruby2.6
105
104
  - ext/geoip2/extconf.rb
106
105
  - ext/geoip2/geoip2.c
107
106
  - ext/geoip2/libmaxminddb/.gitignore
@@ -161,6 +160,8 @@ files:
161
160
  - ext/geoip2/libmaxminddb/projects/VS12/maxminddb_config.h
162
161
  - ext/geoip2/libmaxminddb/projects/test.vcxproj.template
163
162
  - ext/geoip2/libmaxminddb/src/Makefile.am
163
+ - ext/geoip2/libmaxminddb/src/data-pool.c
164
+ - ext/geoip2/libmaxminddb/src/data-pool.h
164
165
  - ext/geoip2/libmaxminddb/src/libmaxminddb.pc.in
165
166
  - ext/geoip2/libmaxminddb/src/maxminddb-compat-util.h
166
167
  - ext/geoip2/libmaxminddb/src/maxminddb.c
@@ -169,9 +170,11 @@ files:
169
170
  - ext/geoip2/libmaxminddb/t/bad_pointers_t.c
170
171
  - ext/geoip2/libmaxminddb/t/basic_lookup_t.c
171
172
  - ext/geoip2/libmaxminddb/t/compile_c++_t.pl
173
+ - ext/geoip2/libmaxminddb/t/data-pool-t.c
172
174
  - ext/geoip2/libmaxminddb/t/data_entry_list_t.c
173
175
  - ext/geoip2/libmaxminddb/t/data_types_t.c
174
176
  - ext/geoip2/libmaxminddb/t/dump_t.c
177
+ - ext/geoip2/libmaxminddb/t/external_symbols_t.pl
175
178
  - ext/geoip2/libmaxminddb/t/get_value_pointer_bug_t.c
176
179
  - ext/geoip2/libmaxminddb/t/get_value_t.c
177
180
  - ext/geoip2/libmaxminddb/t/ipv4_start_cache_t.c
@@ -212,8 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
215
  - !ruby/object:Gem::Version
213
216
  version: '0'
214
217
  requirements: []
215
- rubyforge_project:
216
- rubygems_version: 2.6.14
218
+ rubygems_version: 3.0.3
217
219
  signing_key:
218
220
  specification_version: 4
219
221
  summary: Write a short summary, because Rubygems requires one.
@@ -1,8 +0,0 @@
1
- FROM ruby:2.3-alpine
2
-
3
- ENV BUNDLE_GEMFILE=$BUNDLE_GEMFILE
4
-
5
- RUN apk --no-cache --update add build-base autoconf automake libtool ruby-dev libc6-compat git
6
-
7
- WORKDIR /app
8
- COPY . .