mini_portile2 2.8.4 → 2.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/test_execute.rb CHANGED
@@ -4,7 +4,8 @@ class TestExecute < TestCase
4
4
  def setup
5
5
  super
6
6
  @env = {"TEST_ENV_VAR1" => "VAR1_VALUE", "TEST_ENV_VAR2" => "VAR2_VALUE"}
7
- @recipe = MiniPortile.new("test_execute", "1.0.0")
7
+ @logger = StringIO.new
8
+ @recipe = MiniPortile.new("test_execute", "1.0.0", logger: @logger)
8
9
  @log_path = @recipe.send(:tmp_path)
9
10
  FileUtils.mkdir_p File.join(@log_path, "subdir") # normally created by `download`
10
11
  end
@@ -14,7 +15,7 @@ class TestExecute < TestCase
14
15
  def execute_with_env(env)
15
16
  execute("testenv1",
16
17
  %Q(ruby -e "puts ENV['TEST_ENV_VAR1'].inspect ; exit 0"),
17
- {:env => env, :initial_message => false, :debug => true})
18
+ {:env => env, :initial_message => false})
18
19
  end
19
20
  end
20
21
 
@@ -28,7 +29,7 @@ class TestExecute < TestCase
28
29
  def execute_with_env(env)
29
30
  execute("testenv2",
30
31
  ["ruby", "-e", "puts ENV['TEST_ENV_VAR2'].inspect"],
31
- {:env => env, :initial_message => false, :debug => true})
32
+ {:env => env, :initial_message => false})
32
33
  end
33
34
  end
34
35
 
@@ -0,0 +1,202 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+
3
+ require "mkmf" # initialize $LDFLAGS et al here, instead of in the middle of a test
4
+
5
+ class TestMkmfConfig < TestCase
6
+ attr_reader :recipe
7
+
8
+ LIBXML_PCP = File.join(__dir__, "assets", "pkgconf", "libxml2")
9
+ LIBXSLT_PCP = File.join(__dir__, "assets", "pkgconf", "libxslt")
10
+
11
+ def make_recipe(name, version)
12
+ MiniPortile.new(name, version).tap do |recipe|
13
+ recipe.logger = StringIO.new # hush output
14
+ end
15
+ end
16
+
17
+ def setup
18
+ super
19
+
20
+ @save_env = %w[PATH CPATH LIBRARY_PATH LDFLAGS PKG_CONFIG_PATH].inject({}) do |env, var|
21
+ env.update(var => ENV[var])
22
+ end
23
+ $INCFLAGS = "-I/xxx"
24
+ $LIBPATH = ["xxx"]
25
+ $CFLAGS = "-xxx"
26
+ $CXXFLAGS = "-xxx"
27
+ $libs = "-lxxx"
28
+ $MINI_PORTILE_STATIC_LIBS = {}
29
+
30
+ FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
31
+
32
+ @recipe = make_recipe("libfoo", "1.0.0")
33
+ end
34
+
35
+ def teardown
36
+ FileUtils.rm_rf(["tmp", "ports"]) # remove any previous test files
37
+
38
+ $INCFLAGS = ""
39
+ $LIBPATH = []
40
+ $CFLAGS = ""
41
+ $CXXFLAGS = ""
42
+ $libs = ""
43
+ $MINI_PORTILE_STATIC_LIBS = {}
44
+ @save_env.each do |var, val|
45
+ ENV[var] = val
46
+ end
47
+
48
+ super
49
+ end
50
+
51
+ def test_mkmf_config_recipe_LIBPATH_global_lib_dir_does_not_exist
52
+ recipe.mkmf_config
53
+
54
+ refute_includes($LIBPATH, recipe.lib_path)
55
+ refute_includes($libs.shellsplit, "-lfoo")
56
+ end
57
+
58
+ def test_mkmf_config_recipe_LIBPATH_global_not_static
59
+ FileUtils.mkdir_p(recipe.lib_path)
60
+
61
+ recipe.mkmf_config
62
+
63
+ assert_includes($LIBPATH, recipe.lib_path)
64
+ assert_operator($LIBPATH.index(recipe.lib_path), :<, $LIBPATH.index("xxx")) # prepend
65
+
66
+ assert_includes($libs.shellsplit, "-lfoo") # note the recipe name is "libfoo"
67
+ assert_match(%r{-lfoo.*-lxxx}, $libs) # prepend
68
+ end
69
+
70
+ def test_mkmf_config_recipe_LIBPATH_global_static
71
+ FileUtils.mkdir_p(recipe.lib_path)
72
+ static_lib_path = File.join(recipe.lib_path, "libfoo.#{$LIBEXT}")
73
+
74
+ recipe.mkmf_config(static: "foo")
75
+
76
+ refute_includes($LIBPATH, recipe.lib_path)
77
+
78
+ refute_includes($libs.shellsplit, "-lfoo") # note the recipe name is "libfoo"
79
+ assert_includes($libs.shellsplit, static_lib_path)
80
+ assert_match(%r{#{static_lib_path}.*-lxxx}, $libs) # prepend
81
+ end
82
+
83
+ def test_mkmf_config_recipe_INCFLAGS_global_include_dir_does_not_exist
84
+ recipe.mkmf_config
85
+
86
+ refute_includes($INCFLAGS.shellsplit, "-I#{recipe.include_path}")
87
+ end
88
+
89
+ def test_mkmf_config_recipe_INCFLAGS_global
90
+ FileUtils.mkdir_p(recipe.include_path)
91
+
92
+ recipe.mkmf_config
93
+
94
+ assert_includes($INCFLAGS.shellsplit, "-I#{recipe.include_path}")
95
+ assert_match(%r{-I#{recipe.include_path}.*-I/xxx}, $INCFLAGS) # prepend
96
+ end
97
+
98
+ def test_mkmf_config_pkgconf_does_not_exist
99
+ assert_raises(ArgumentError) do
100
+ recipe.mkmf_config(pkg: "foo")
101
+ end
102
+ end
103
+
104
+ def test_mkmf_config_pkgconf_LIBPATH_global_not_static
105
+ # can't get the pkgconf utility to install on windows with ruby 2.3 in CI
106
+ skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
107
+
108
+ recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
109
+
110
+ assert_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
111
+ assert_operator($LIBPATH.index("/foo/libxml2/2.11.5/lib"), :<, $LIBPATH.index("xxx")) # prepend
112
+ refute_includes($LIBPATH, "/foo/zlib/1.3/lib")
113
+
114
+ assert_includes($libs.shellsplit, "-lxml2")
115
+ assert_match(%r{-lxml2.*-lxxx}, $libs) # prepend
116
+ refute_includes($libs.shellsplit, "-lz")
117
+ end
118
+
119
+ def test_mkmf_config_pkgconf_LIBPATH_global_static
120
+ # can't get the pkgconf utility to install on windows with ruby 2.3 in CI
121
+ skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
122
+
123
+ static_lib_path = "/foo/libxml2/2.11.5/lib/libxml2.#{$LIBEXT}"
124
+
125
+ recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP, static: "xml2")
126
+
127
+ refute_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
128
+ refute_includes($libs.shellsplit, "-lxml2")
129
+ assert_includes($libs.shellsplit, static_lib_path)
130
+ assert_match(%r{#{static_lib_path}.*-lxxx}, $libs) # prepend
131
+
132
+ assert_includes($LIBPATH, "/foo/zlib/1.3/lib") # from --static
133
+ assert_includes($libs.shellsplit, "-lz") # from --static
134
+ end
135
+
136
+ def test_mkmf_config_pkgconf_CFLAGS_global
137
+ # can't get the pkgconf utility to install on windows with ruby 2.3 in CI
138
+ skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
139
+
140
+ recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP)
141
+
142
+ assert_includes($INCFLAGS.shellsplit, "-I/foo/libxml2/2.11.5/include/libxml2")
143
+ assert_match(%r{-I/foo/libxml2/2.11.5/include/libxml2.*-I/xxx}, $INCFLAGS) # prepend
144
+
145
+ assert_includes($CFLAGS.shellsplit, "-ggdb3")
146
+ assert_match(%r{-xxx.*-ggdb3}, $CFLAGS) # append
147
+
148
+ assert_includes($CXXFLAGS.shellsplit, "-ggdb3")
149
+ assert_match(%r{-xxx.*-ggdb3}, $CXXFLAGS) # append
150
+ end
151
+
152
+ def test_mkmf_config_pkgconf_path_accumulation
153
+ # can't get the pkgconf utility to install on windows with ruby 2.3 in CI
154
+ skip if MiniPortile.windows? && RUBY_VERSION < "2.4"
155
+
156
+ (ENV["PKG_CONFIG_PATH"] || "").split(File::PATH_SEPARATOR).tap do |pcpaths|
157
+ refute_includes(pcpaths, LIBXML_PCP)
158
+ refute_includes(pcpaths, LIBXSLT_PCP)
159
+ end
160
+
161
+ make_recipe("libxml2", "2.11.5").tap do |recipe|
162
+ recipe.mkmf_config(pkg: "libxml-2.0", dir: LIBXML_PCP, static: "xml2")
163
+
164
+ ENV["PKG_CONFIG_PATH"].split(File::PATH_SEPARATOR).tap do |pcpaths|
165
+ assert_includes(pcpaths, LIBXML_PCP)
166
+ refute_includes(pcpaths, LIBXSLT_PCP)
167
+ end
168
+ end
169
+
170
+ make_recipe("libxslt", "1.13.8").tap do |recipe|
171
+ recipe.mkmf_config(pkg: "libxslt", dir: LIBXSLT_PCP, static: "xslt")
172
+
173
+ ENV["PKG_CONFIG_PATH"].split(File::PATH_SEPARATOR).tap do |pcpaths|
174
+ assert_includes(pcpaths, LIBXML_PCP)
175
+ assert_includes(pcpaths, LIBXSLT_PCP)
176
+ end
177
+
178
+ recipe.mkmf_config(pkg: "libexslt", dir: LIBXSLT_PCP, static: "exslt")
179
+ end
180
+
181
+ $INCFLAGS.shellsplit.tap do |incflags|
182
+ assert_includes(incflags, "-I/foo/libxml2/2.11.5/include/libxml2")
183
+ assert_includes(incflags, "-I/foo/libxslt/1.1.38/include")
184
+ end
185
+ $CFLAGS.shellsplit.tap do |cflags|
186
+ assert_includes(cflags, "-ggdb3")
187
+ assert_includes(cflags, "-Wno-deprecated-enum-enum-conversion")
188
+ end
189
+ refute_includes($LIBPATH, "/foo/libxml2/2.11.5/lib")
190
+ refute_includes($LIBPATH, "/foo/libxslt/1.1.38/lib")
191
+ assert_includes($LIBPATH, "/foo/zlib/1.3/lib") # from `--static`
192
+ $libs.shellsplit.tap do |libflags|
193
+ refute_includes(libflags, "-lxml2")
194
+ assert_includes(libflags, "/foo/libxml2/2.11.5/lib/libxml2.#{$LIBEXT}")
195
+ refute_includes(libflags, "-lxslt")
196
+ assert_includes(libflags, "/foo/libxslt/1.1.38/lib/libxslt.#{$LIBEXT}")
197
+ refute_includes(libflags, "-lexslt")
198
+ assert_includes(libflags, "/foo/libxslt/1.1.38/lib/libexslt.#{$LIBEXT}")
199
+ assert_includes(libflags, "-lz") # from `--static`
200
+ end
201
+ end
202
+ end
data/test/test_proxy.rb CHANGED
@@ -37,6 +37,7 @@ class TestProxy < TestCase
37
37
  def setup
38
38
  # remove any download files
39
39
  FileUtils.rm_rf("port/archives")
40
+ @logger = StringIO.new
40
41
  end
41
42
 
42
43
  def assert_proxy_auth(expected, request)
@@ -48,7 +49,7 @@ class TestProxy < TestCase
48
49
  end
49
50
 
50
51
  def test_http_proxy
51
- recipe = MiniPortile.new("test http_proxy", "1.0.0")
52
+ recipe = MiniPortile.new("test http_proxy", "1.0.0", logger: @logger)
52
53
  recipe.files << "http://myserver/path/to/tar.gz"
53
54
  request = with_dummy_proxy do |url, thread|
54
55
  ENV['http_proxy'] = url
@@ -59,7 +60,7 @@ class TestProxy < TestCase
59
60
  end
60
61
 
61
62
  def test_http_proxy_with_basic_auth
62
- recipe = MiniPortile.new("test http_proxy", "1.0.0")
63
+ recipe = MiniPortile.new("test http_proxy", "1.0.0", logger: @logger)
63
64
  recipe.files << "http://myserver/path/to/tar.gz"
64
65
  request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread|
65
66
  ENV['http_proxy'] = url
@@ -72,7 +73,7 @@ class TestProxy < TestCase
72
73
  end
73
74
 
74
75
  def test_https_proxy
75
- recipe = MiniPortile.new("test https_proxy", "1.0.0")
76
+ recipe = MiniPortile.new("test https_proxy", "1.0.0", logger: @logger)
76
77
  recipe.files << "https://myserver/path/to/tar.gz"
77
78
  request = with_dummy_proxy do |url, thread|
78
79
  ENV['https_proxy'] = url
@@ -83,7 +84,7 @@ class TestProxy < TestCase
83
84
  end
84
85
 
85
86
  def test_https_proxy_with_basic_auth
86
- recipe = MiniPortile.new("test https_proxy", "1.0.0")
87
+ recipe = MiniPortile.new("test https_proxy", "1.0.0", logger: @logger)
87
88
  recipe.files << "https://myserver/path/to/tar.gz"
88
89
  request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread|
89
90
  ENV['https_proxy'] = url
@@ -96,7 +97,7 @@ class TestProxy < TestCase
96
97
  end
97
98
 
98
99
  def test_ftp_proxy
99
- recipe = MiniPortile.new("test ftp_proxy", "1.0.0")
100
+ recipe = MiniPortile.new("test ftp_proxy", "1.0.0", logger: @logger)
100
101
  recipe.files << "ftp://myserver/path/to/tar.gz"
101
102
  request = with_dummy_proxy do |url, thread|
102
103
  ENV['ftp_proxy'] = url
@@ -107,7 +108,7 @@ class TestProxy < TestCase
107
108
  end
108
109
 
109
110
  def test_ftp_proxy_with_basic_auth
110
- recipe = MiniPortile.new("test ftp_proxy", "1.0.0")
111
+ recipe = MiniPortile.new("test ftp_proxy", "1.0.0", logger: @logger)
111
112
  recipe.files << "ftp://myserver/path/to/tar.gz"
112
113
  request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread|
113
114
  ENV['ftp_proxy'] = url
@@ -0,0 +1,18 @@
1
+ require File.expand_path('../helper', __FILE__)
2
+
3
+ class TestRecipe < TestCase
4
+ def test_path
5
+ recipe = MiniPortile.new("libfoo", "1.0.0")
6
+ assert_equal(File.expand_path(File.join(recipe.target, recipe.host, recipe.name, recipe.version)), recipe.path)
7
+ end
8
+
9
+ def test_lib_path
10
+ recipe = MiniPortile.new("libfoo", "1.0.0")
11
+ assert_equal(File.join(recipe.path, "lib"), recipe.lib_path)
12
+ end
13
+
14
+ def test_include_path
15
+ recipe = MiniPortile.new("libfoo", "1.0.0")
16
+ assert_equal(File.join(recipe.path, "include"), recipe.include_path)
17
+ end
18
+ end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_portile2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.4
4
+ version: 2.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Lavena
8
8
  - Mike Dalessio
9
9
  - Lars Kanis
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-07-18 00:00:00.000000000 Z
13
+ date: 2024-05-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -96,9 +96,10 @@ dependencies:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '1.7'
99
- description: Simplistic port-like solution for developers. It provides a standard
100
- and simplified way to compile against dependency libraries without messing up your
101
- system.
99
+ description: |
100
+ Simple autoconf and cmake builder for developers. It provides a standard way to compile against
101
+ dependency libraries without requiring system-wide installation. It also simplifies
102
+ vendoring and cross-compilation by providing a consistent build interface.
102
103
  email: mike.dalessio@gmail.com
103
104
  executables: []
104
105
  extensions: []
@@ -106,6 +107,7 @@ extra_rdoc_files: []
106
107
  files:
107
108
  - ".github/FUNDING.yml"
108
109
  - ".github/workflows/ci.yml"
110
+ - ".github/workflows/downstream.yml"
109
111
  - ".gitignore"
110
112
  - CHANGELOG.md
111
113
  - Gemfile
@@ -123,22 +125,28 @@ files:
123
125
  - test/assets/gpg-fixtures/data.asc
124
126
  - test/assets/gpg-fixtures/data.invalid.asc
125
127
  - test/assets/patch 1.diff
128
+ - test/assets/pkgconf/libxml2/libxml-2.0.pc
129
+ - test/assets/pkgconf/libxslt/libexslt.pc
130
+ - test/assets/pkgconf/libxslt/libxslt.pc
126
131
  - test/assets/test mini portile-1.0.0/configure
127
132
  - test/assets/test-cmake-1.0/CMakeLists.txt
128
133
  - test/assets/test-cmake-1.0/hello.c
129
134
  - test/assets/test-download-archive.tar.gz
130
135
  - test/helper.rb
136
+ - test/test_activate.rb
131
137
  - test/test_cmake.rb
132
138
  - test/test_cook.rb
133
139
  - test/test_digest.rb
134
140
  - test/test_download.rb
135
141
  - test/test_execute.rb
142
+ - test/test_mkmf_config.rb
136
143
  - test/test_proxy.rb
144
+ - test/test_recipe.rb
137
145
  homepage: https://github.com/flavorjones/mini_portile
138
146
  licenses:
139
147
  - MIT
140
148
  metadata: {}
141
- post_install_message:
149
+ post_install_message:
142
150
  rdoc_options: []
143
151
  require_paths:
144
152
  - lib
@@ -153,24 +161,30 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
161
  - !ruby/object:Gem::Version
154
162
  version: '0'
155
163
  requirements: []
156
- rubygems_version: 3.4.10
157
- signing_key:
164
+ rubygems_version: 3.5.10
165
+ signing_key:
158
166
  specification_version: 4
159
- summary: Simplistic port-like solution for developers
167
+ summary: Simple autoconf and cmake builder for developers
160
168
  test_files:
161
169
  - test/assets/git/config
162
170
  - test/assets/gpg-fixtures/data
163
171
  - test/assets/gpg-fixtures/data.asc
164
172
  - test/assets/gpg-fixtures/data.invalid.asc
165
173
  - test/assets/patch 1.diff
174
+ - test/assets/pkgconf/libxml2/libxml-2.0.pc
175
+ - test/assets/pkgconf/libxslt/libexslt.pc
176
+ - test/assets/pkgconf/libxslt/libxslt.pc
166
177
  - test/assets/test mini portile-1.0.0/configure
167
178
  - test/assets/test-cmake-1.0/CMakeLists.txt
168
179
  - test/assets/test-cmake-1.0/hello.c
169
180
  - test/assets/test-download-archive.tar.gz
170
181
  - test/helper.rb
182
+ - test/test_activate.rb
171
183
  - test/test_cmake.rb
172
184
  - test/test_cook.rb
173
185
  - test/test_digest.rb
174
186
  - test/test_download.rb
175
187
  - test/test_execute.rb
188
+ - test/test_mkmf_config.rb
176
189
  - test/test_proxy.rb
190
+ - test/test_recipe.rb