mini_portile2 2.6.1 → 2.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cce9a4c5c119fbab9f241aae304d9aec171a69873a168688132d55e4010ee49
4
- data.tar.gz: eb61f44c46b6822aae38027d6c4aecb3c16d6b8d6e7caf008d90110da98c1d69
3
+ metadata.gz: 2602d6374f46f2b14904b287999ca7da911a08b28fa75517e220796847cd9496
4
+ data.tar.gz: 450fc92cc01ae557e8ab7f43ddd241d479496160c2f759969531cfa6003321fd
5
5
  SHA512:
6
- metadata.gz: c943d0ce63b54f9199426af7658f200054a87d151ff30b66183a5afa10096955733bab9a7ccaa167a9052e3826243d779e0579ded63ed1ea2522d35ab5940512
7
- data.tar.gz: 476d783710ca21b2893256f39a34f4f958a289ece0230eb7e364f4b1c0714e39f85c74f5f84783279685953ac179fc899959c0fb7302f41856720ceefdb33436
6
+ metadata.gz: 7ccfdbbb591033e43b155be58a3dd72145886a7c5b38e7f7ba4009adee5b76b6b33d3ee80d7b1d66be7160eeb6ffdf4d87dbd11898b3f624c56d91c316969d13
7
+ data.tar.gz: 7bd90d3d534b25097e38d748f59286385010ee05f9f4ee06a38b844379bf8fe10b604fe013cc716aa9deab72a02d7e704ef045825acd370db198ec8f1ccb9bea
data/.github/FUNDING.yml CHANGED
@@ -1 +1,2 @@
1
- tidelift: "rubygems/mini_portile2"
1
+ github: flavorjones
2
+ tidelift: rubygems/mini_portile2
@@ -1,5 +1,7 @@
1
1
  name: Continuous Integration
2
-
2
+ concurrency:
3
+ group: "${{github.workflow}}-${{github.ref}}"
4
+ cancel-in-progress: true
3
5
  on:
4
6
  workflow_dispatch:
5
7
  push:
@@ -20,9 +22,10 @@ jobs:
20
22
  env:
21
23
  MAKEFLAGS: -j2
22
24
  strategy:
25
+ fail-fast: false
23
26
  matrix:
24
- platform: [ubuntu-latest, windows-latest]
25
- ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "head"]
27
+ platform: [ubuntu-latest, windows-latest, macos-latest]
28
+ ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "head"]
26
29
  runs-on: ${{ matrix.platform }}
27
30
  steps:
28
31
  - name: configure git crlf on windows
@@ -43,9 +46,10 @@ jobs:
43
46
  env:
44
47
  MAKEFLAGS: -j2
45
48
  strategy:
49
+ fail-fast: false
46
50
  matrix:
47
- platform: [ubuntu-latest, windows-latest]
48
- ruby: ["3.0"]
51
+ platform: [ubuntu-latest, windows-latest, macos-latest]
52
+ ruby: ["3.1"]
49
53
  runs-on: ${{ matrix.platform }}
50
54
  steps:
51
55
  - name: configure git crlf on windows
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  ## mini_portile changelog
2
2
 
3
+ ### 2.8.0 / 2022-02-20
4
+
5
+ #### Added
6
+
7
+ - Support xz-compressed archives (recognized by an `.xz` file extension).
8
+ - When downloading a source archive, default open_timeout and read_timeout to 10 seconds, but allow configuration via open_timeout and read_timeout config parameters.
9
+
10
+
11
+ ### 2.7.1 / 2021-10-20
12
+
13
+ #### Packaging
14
+
15
+ A test artifact that has been included in the gem was being flagged by some users' security scanners because it wasn't a real tarball. That artifact has been updated to be a real tarball. [#108]
16
+
17
+
18
+ ### 2.7.0 / 2021-08-31
19
+
20
+ #### Added
21
+
22
+ The commands used for "make", "compile", and "cmake" are configurable via keyword arguments. [#107] (Thanks, @cosmo0920!)
23
+
24
+
3
25
  ### 2.6.1 / 2021-05-31
4
26
 
5
27
  #### Dependencies
data/README.md CHANGED
@@ -83,11 +83,70 @@ library into a namespaced structure.
83
83
  `#activate` ensures GCC will find this library and prefer it over a
84
84
  system-wide installation.
85
85
 
86
+ Some keyword arguments can be passed to the constructor to configure the commands used:
87
+
88
+ #### `gcc_command`
89
+
90
+ The compiler command that is used is configurable, and in order of preference will use:
91
+
92
+ - the `CC` environment variable (if present)
93
+ - the `gcc_command` value passed in to the constructor
94
+ - `RbConfig::CONFIG["CC"]`
95
+ - `"gcc"`
96
+
97
+ You can pass it in like so:
98
+
99
+ ``` ruby
100
+ MiniPortile.new("libiconv", "1.13.1", gcc_command: "cc")
101
+ ```
102
+
103
+ #### `make_command`
104
+
105
+ The configuration/make command that is used is configurable, and in order of preference will use:
106
+
107
+ - the `MAKE` environment variable (if present)
108
+ - the `make_command` value passed in to the constructor
109
+ - the `make` environment variable (if present)
110
+ - `"make"`
111
+
112
+ You can pass it in like so:
113
+
114
+ ``` ruby
115
+ MiniPortile.new("libiconv", "1.13.1", make_command: "nmake")
116
+ ```
117
+
118
+ #### `open_timeout`, `read_timeout`
119
+
120
+ By default, when downloading source archives, MiniPortile will use a timeout value of 10
121
+ seconds. This can be overridden by passing a different value (in seconds):
122
+
123
+ ``` ruby
124
+ MiniPortile.new("libiconv", "1.13.1", open_timeout: 99, read_timeout: 2)
125
+ ```
126
+
86
127
 
87
128
  ### How to use (for cmake projects)
88
129
 
89
130
  Same as above, but instead of `MiniPortile.new`, call `MiniPortileCMake.new`.
90
131
 
132
+ #### `make_command`
133
+
134
+ This is configurable as above, except for Windows systems where it's hardcoded to `"nmake"`.
135
+
136
+ #### `cmake_command`
137
+
138
+ The cmake command used is configurable, and in order of preference will use:
139
+
140
+ - the `CMAKE` environment variable (if present)
141
+ - the `cmake_command` value passed in to the constructor
142
+ - `"cmake"`
143
+
144
+ You can pass it in like so:
145
+
146
+ ``` ruby
147
+ MiniPortileCMake.new("libfoobar", "1.3.5", cmake_command: "cmake3")
148
+ ```
149
+
91
150
 
92
151
  ### Local source directories
93
152
 
@@ -28,6 +28,8 @@ class Net::HTTP
28
28
  end
29
29
 
30
30
  class MiniPortile
31
+ DEFAULT_TIMEOUT = 10
32
+
31
33
  attr_reader :name, :version, :original_host
32
34
  attr_writer :configure_options
33
35
  attr_accessor :host, :files, :patch_files, :target, :logger, :source_directory
@@ -46,7 +48,7 @@ class MiniPortile
46
48
  RbConfig::CONFIG['target_os'] =~ /mswin/
47
49
  end
48
50
 
49
- def initialize(name, version)
51
+ def initialize(name, version, **kwargs)
50
52
  @name = name
51
53
  @version = version
52
54
  @target = 'ports'
@@ -57,6 +59,11 @@ class MiniPortile
57
59
  @source_directory = nil
58
60
 
59
61
  @original_host = @host = detect_host
62
+
63
+ @gcc_command = kwargs[:gcc_command]
64
+ @make_command = kwargs[:make_command]
65
+ @open_timeout = kwargs[:open_timeout] || DEFAULT_TIMEOUT
66
+ @read_timeout = kwargs[:read_timeout] || DEFAULT_TIMEOUT
60
67
  end
61
68
 
62
69
  def source_directory=(path)
@@ -222,6 +229,14 @@ class MiniPortile
222
229
  File.expand_path(port_path)
223
230
  end
224
231
 
232
+ def gcc_cmd
233
+ (ENV["CC"] || @gcc_command || RbConfig::CONFIG["CC"] || "gcc").dup
234
+ end
235
+
236
+ def make_cmd
237
+ (ENV["MAKE"] || @make_command || ENV["make"] || "make").dup
238
+ end
239
+
225
240
  private
226
241
 
227
242
  def tmp_path
@@ -347,6 +362,8 @@ private
347
362
  'z'
348
363
  when '.bz2', '.tbz2'
349
364
  'j'
365
+ when '.xz'
366
+ 'J'
350
367
  when '.Z'
351
368
  'Z'
352
369
  else
@@ -501,7 +518,9 @@ private
501
518
  # Content-Length is unavailable because Transfer-Encoding is chunked
502
519
  message "\rDownloading %s " % [filename]
503
520
  end
504
- }
521
+ },
522
+ :open_timeout => @open_timeout,
523
+ :read_timeout => @read_timeout,
505
524
  }
506
525
  proxy_uri = URI.parse(url).scheme.downcase == 'https' ?
507
526
  ENV["https_proxy"] :
@@ -526,7 +545,7 @@ private
526
545
  return download_file(redirect.url, full_path, count-1)
527
546
  rescue => e
528
547
  count = count - 1
529
- puts "#{count} retrie(s) left for #{filename}"
548
+ puts "#{count} retrie(s) left for #{filename} (#{e.message})"
530
549
  if count > 0
531
550
  sleep 1
532
551
  return download_file_http(url, full_path, count)
@@ -553,7 +572,9 @@ private
553
572
  :progress_proc => lambda{|bytes|
554
573
  new_progress = (bytes * 100) / total
555
574
  message "\rDownloading %s (%3d%%) " % [filename, new_progress]
556
- }
575
+ },
576
+ :open_timeout => @open_timeout,
577
+ :read_timeout => @read_timeout,
557
578
  }
558
579
  if ENV["ftp_proxy"]
559
580
  _, userinfo, _p_host, _p_port = URI.split(ENV['ftp_proxy'])
@@ -583,14 +604,4 @@ private
583
604
  FileUtils.mkdir_p File.dirname(full_path)
584
605
  FileUtils.mv temp_file.path, full_path, :force => true
585
606
  end
586
-
587
- def gcc_cmd
588
- cc = ENV["CC"] || RbConfig::CONFIG["CC"] || "gcc"
589
- return cc.dup
590
- end
591
-
592
- def make_cmd
593
- m = ENV['MAKE'] || ENV['make'] || 'make'
594
- return m.dup
595
- end
596
607
  end
@@ -5,6 +5,11 @@ class MiniPortileCMake < MiniPortile
5
5
  "-DCMAKE_INSTALL_PREFIX=#{File.expand_path(port_path)}"
6
6
  end
7
7
 
8
+ def initialize(name, version, **kwargs)
9
+ super(name, version, **kwargs)
10
+ @cmake_command = kwargs[:cmake_command]
11
+ end
12
+
8
13
  def configure_defaults
9
14
  if MiniPortile.mswin?
10
15
  ['-G', 'NMake Makefiles']
@@ -21,7 +26,7 @@ class MiniPortileCMake < MiniPortile
21
26
  cache_file = File.join(tmp_path, 'configure.options_cache')
22
27
  File.open(cache_file, "w") { |f| f.write computed_options.to_s }
23
28
 
24
- execute('configure', %w(cmake) + computed_options + ["."])
29
+ execute('configure', [cmake_cmd] + computed_options + ["."])
25
30
  end
26
31
 
27
32
  def configured?
@@ -39,4 +44,8 @@ class MiniPortileCMake < MiniPortile
39
44
  return "nmake" if MiniPortile.mswin?
40
45
  super
41
46
  end
47
+
48
+ def cmake_cmd
49
+ (ENV["CMAKE"] || @cmake_command || "cmake").dup
50
+ end
42
51
  end
@@ -1,3 +1,3 @@
1
1
  class MiniPortile
2
- VERSION = "2.6.1"
2
+ VERSION = "2.8.0"
3
3
  end
@@ -33,10 +33,10 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.required_ruby_version = ">= 2.3.0"
35
35
 
36
- spec.add_development_dependency "bundler", "~> 2.1"
37
- spec.add_development_dependency "minitar", "~> 0.7"
38
- spec.add_development_dependency "minitest", "~> 5.11"
39
- spec.add_development_dependency "minitest-hooks", "~> 1.5.0"
36
+ spec.add_development_dependency "bundler", "~> 2.3"
37
+ spec.add_development_dependency "minitar", "~> 0.9"
38
+ spec.add_development_dependency "minitest", "~> 5.15"
39
+ spec.add_development_dependency "minitest-hooks", "~> 1.5"
40
40
  spec.add_development_dependency "rake", "~> 13.0"
41
- spec.add_development_dependency "webrick", "~> 1.0"
41
+ spec.add_development_dependency "webrick", "~> 1.7"
42
42
  end
data/test/helper.rb CHANGED
@@ -57,4 +57,20 @@ class TestCase < Minitest::Test
57
57
  ensure
58
58
  ENV['GIT_DIR'] = old
59
59
  end
60
+
61
+ def with_env(env)
62
+ before = ENV.to_h.dup
63
+ env.each { |k, v| ENV[k] = v }
64
+ yield
65
+ ensure
66
+ ENV.replace(before)
67
+ end
68
+
69
+ def without_env(*keys, &blk)
70
+ before = ENV.to_h.dup
71
+ keys.flatten.each { |k| ENV.delete(k) }
72
+ yield
73
+ ensure
74
+ ENV.replace(before)
75
+ end
60
76
  end
data/test/test_cmake.rb CHANGED
@@ -58,3 +58,33 @@ class TestCMake < TestCase
58
58
  assert File.exist?(binary), binary
59
59
  end
60
60
  end
61
+
62
+ class TestCMakeConfig < TestCase
63
+ def test_make_command_configuration
64
+ MiniPortile.stub(:mswin?, false) do
65
+ without_env("MAKE") do
66
+ assert_equal("make", MiniPortileCMake.new("test", "1.0.0").make_cmd)
67
+ assert_equal("xyzzy", MiniPortileCMake.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
68
+ end
69
+ with_env("MAKE"=>"asdf") do
70
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0").make_cmd)
71
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
72
+ end
73
+ end
74
+
75
+ MiniPortile.stub(:mswin?, true) do
76
+ assert_equal("nmake", MiniPortileCMake.new("test", "1.0.0").make_cmd)
77
+ end
78
+ end
79
+
80
+ def test_cmake_command_configuration
81
+ without_env("CMAKE") do
82
+ assert_equal("cmake", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
83
+ assert_equal("xyzzy", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
84
+ end
85
+ with_env("CMAKE"=>"asdf") do
86
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0").cmake_cmd)
87
+ assert_equal("asdf", MiniPortileCMake.new("test", "1.0.0", cmake_command: "xyzzy").cmake_cmd)
88
+ end
89
+ end
90
+ end
data/test/test_cook.rb CHANGED
@@ -67,6 +67,32 @@ class TestCook < TestCase
67
67
  end
68
68
  end
69
69
 
70
+ class TestCookConfiguration < TestCase
71
+ def test_make_command_configuration
72
+ without_env("MAKE") do
73
+ assert_equal("make", MiniPortile.new("test", "1.0.0").make_cmd)
74
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
75
+ end
76
+ with_env("MAKE"=>"asdf") do
77
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0").make_cmd)
78
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", make_command: "xyzzy").make_cmd)
79
+ end
80
+ end
81
+
82
+ def test_gcc_command_configuration
83
+ without_env("CC") do
84
+ expected_compiler = RbConfig::CONFIG["CC"] || "gcc"
85
+ assert_equal(expected_compiler, MiniPortile.new("test", "1.0.0").gcc_cmd)
86
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").gcc_cmd)
87
+ end
88
+ with_env("CC"=>"asdf") do
89
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0").gcc_cmd)
90
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").gcc_cmd)
91
+ end
92
+ end
93
+ end
94
+
95
+
70
96
  class TestCookWithBrokenGitDir < TestCase
71
97
  #
72
98
  # this is a test for #69
@@ -62,7 +62,7 @@ describe "recipe download" do
62
62
  @recipe.files << "file://#{path}"
63
63
  @recipe.download
64
64
  assert File.exist?(dest)
65
- Digest::MD5.file(dest).hexdigest.must_equal "5deffb997041bbb5f11bdcafdbb47975"
65
+ Digest::MD5.file(dest).hexdigest.must_equal "ee0e9f44e72213015ef976d5ac23931d"
66
66
  end
67
67
 
68
68
  it "other" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_portile2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Lavena
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-31 00:00:00.000000000 Z
13
+ date: 2022-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -18,56 +18,56 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '2.1'
21
+ version: '2.3'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '2.1'
28
+ version: '2.3'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: minitar
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '0.7'
35
+ version: '0.9'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.7'
42
+ version: '0.9'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: minitest
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '5.11'
49
+ version: '5.15'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '5.11'
56
+ version: '5.15'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: minitest-hooks
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 1.5.0
63
+ version: '1.5'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 1.5.0
70
+ version: '1.5'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rake
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '1.0'
91
+ version: '1.7'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '1.0'
98
+ version: '1.7'
99
99
  description: Simplistic port-like solution for developers. It provides a standard
100
100
  and simplified way to compile against dependency libraries without messing up your
101
101
  system.
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubygems_version: 3.1.4
156
+ rubygems_version: 3.3.5
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Simplistic port-like solution for developers