mini_portile2 2.8.2 → 2.8.9

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,104 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_portile2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 2.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Lavena
8
8
  - Mike Dalessio
9
9
  - Lars Kanis
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2023-04-30 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: bundler
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '2.2'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '2.2'
29
- - !ruby/object:Gem::Dependency
30
- name: minitar
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - "~>"
34
- - !ruby/object:Gem::Version
35
- version: '0.9'
36
- type: :development
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: '0.9'
43
- - !ruby/object:Gem::Dependency
44
- name: minitest
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '5.15'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '5.15'
57
- - !ruby/object:Gem::Dependency
58
- name: minitest-hooks
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: '1.5'
64
- type: :development
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - "~>"
69
- - !ruby/object:Gem::Version
70
- version: '1.5'
71
- - !ruby/object:Gem::Dependency
72
- name: rake
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '13.0'
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - "~>"
83
- - !ruby/object:Gem::Version
84
- version: '13.0'
85
- - !ruby/object:Gem::Dependency
86
- name: webrick
87
- requirement: !ruby/object:Gem::Requirement
88
- requirements:
89
- - - "~>"
90
- - !ruby/object:Gem::Version
91
- version: '1.7'
92
- type: :development
93
- prerelease: false
94
- version_requirements: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - "~>"
97
- - !ruby/object:Gem::Version
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.
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: |
15
+ Simple autoconf and cmake builder for developers. It provides a standard way to compile against
16
+ dependency libraries without requiring system-wide installation. It also simplifies
17
+ vendoring and cross-compilation by providing a consistent build interface.
102
18
  email: mike.dalessio@gmail.com
103
19
  executables: []
104
20
  extensions: []
@@ -106,6 +22,8 @@ extra_rdoc_files: []
106
22
  files:
107
23
  - ".github/FUNDING.yml"
108
24
  - ".github/workflows/ci.yml"
25
+ - ".github/workflows/downstream.yml"
26
+ - ".github/workflows/upstream.yml"
109
27
  - ".gitignore"
110
28
  - CHANGELOG.md
111
29
  - Gemfile
@@ -123,22 +41,28 @@ files:
123
41
  - test/assets/gpg-fixtures/data.asc
124
42
  - test/assets/gpg-fixtures/data.invalid.asc
125
43
  - test/assets/patch 1.diff
44
+ - test/assets/pkgconf/libxml2/libxml-2.0.pc
45
+ - test/assets/pkgconf/libxslt/libexslt.pc
46
+ - test/assets/pkgconf/libxslt/libxslt.pc
126
47
  - test/assets/test mini portile-1.0.0/configure
127
48
  - test/assets/test-cmake-1.0/CMakeLists.txt
128
49
  - test/assets/test-cmake-1.0/hello.c
129
50
  - test/assets/test-download-archive.tar.gz
130
51
  - test/helper.rb
52
+ - test/test_activate.rb
131
53
  - test/test_cmake.rb
132
54
  - test/test_cook.rb
133
55
  - test/test_digest.rb
134
56
  - test/test_download.rb
135
57
  - test/test_execute.rb
58
+ - test/test_mkmf_config.rb
136
59
  - test/test_proxy.rb
60
+ - test/test_recipe.rb
137
61
  homepage: https://github.com/flavorjones/mini_portile
138
62
  licenses:
139
63
  - MIT
140
- metadata: {}
141
- post_install_message:
64
+ metadata:
65
+ changelog_uri: https://github.com/flavorjones/mini_portile/blob/main/CHANGELOG.md
142
66
  rdoc_options: []
143
67
  require_paths:
144
68
  - lib
@@ -153,24 +77,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
77
  - !ruby/object:Gem::Version
154
78
  version: '0'
155
79
  requirements: []
156
- rubygems_version: 3.4.10
157
- signing_key:
80
+ rubygems_version: 3.6.8
158
81
  specification_version: 4
159
- summary: Simplistic port-like solution for developers
82
+ summary: Simple autoconf and cmake builder for developers
160
83
  test_files:
161
84
  - test/assets/git/config
162
85
  - test/assets/gpg-fixtures/data
163
86
  - test/assets/gpg-fixtures/data.asc
164
87
  - test/assets/gpg-fixtures/data.invalid.asc
165
88
  - test/assets/patch 1.diff
89
+ - test/assets/pkgconf/libxml2/libxml-2.0.pc
90
+ - test/assets/pkgconf/libxslt/libexslt.pc
91
+ - test/assets/pkgconf/libxslt/libxslt.pc
166
92
  - test/assets/test mini portile-1.0.0/configure
167
93
  - test/assets/test-cmake-1.0/CMakeLists.txt
168
94
  - test/assets/test-cmake-1.0/hello.c
169
95
  - test/assets/test-download-archive.tar.gz
170
96
  - test/helper.rb
97
+ - test/test_activate.rb
171
98
  - test/test_cmake.rb
172
99
  - test/test_cook.rb
173
100
  - test/test_digest.rb
174
101
  - test/test_download.rb
175
102
  - test/test_execute.rb
103
+ - test/test_mkmf_config.rb
176
104
  - test/test_proxy.rb
105
+ - test/test_recipe.rb