mini_portile2 2.5.3 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/Gemfile +0 -2
- data/README.md +12 -0
- data/lib/mini_portile2/mini_portile.rb +30 -11
- data/lib/mini_portile2/version.rb +1 -1
- data/mini_portile2.gemspec +2 -0
- data/test/test_cook.rb +29 -0
- data/test/test_download.rb +4 -6
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cead22320fb80bbc4e46f568f422211dd8a6af92006edc220e1320019cc52676
|
4
|
+
data.tar.gz: d4b5deaa502e5ae66526eb2b23978a4ef52996a100a64f224664927dca0658b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dbd446271e3b0c26cf39504b6b1af53faee8a212ba7451af76f17e1f8858b3f329c5e281f753d1731fe27a3d9121c9f7328188ead52aaf63c1d4728c44fcd99
|
7
|
+
data.tar.gz: a6b17cd4c01588c86d70a4e18c713cc5c13c16922ac64cc38e7c77fac416b1a9e1fa4eeee502dd23f13ece5a16d8b364033169de0e8e4612012544599a692c03
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
## mini_portile changelog
|
2
2
|
|
3
|
-
### 2.
|
3
|
+
### 2.6.0 / 2021-05-31
|
4
4
|
|
5
|
-
|
5
|
+
### Added
|
6
|
+
|
7
|
+
Recipes may build against a local directory by specifying `source_directory` instead of `files`. In
|
8
|
+
particular, this may be useful for debugging problems with the upstream dependency (e.g., use `git
|
9
|
+
bisect` in a local clone) or for continuous integration with upstream HEAD.
|
6
10
|
|
7
11
|
|
8
12
|
### 2.5.2 / 2021-05-28
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -89,6 +89,18 @@ system-wide installation.
|
|
89
89
|
Same as above, but instead of `MiniPortile.new`, call `MiniPortileCMake.new`.
|
90
90
|
|
91
91
|
|
92
|
+
### Local source directories
|
93
|
+
|
94
|
+
Instead of downloading a remote file, you can also point mini_portile2 at a local source
|
95
|
+
directory. In particular, this may be useful for testing or debugging:
|
96
|
+
|
97
|
+
``` ruby
|
98
|
+
gem "mini_portile2", "~> 2.0.0" # NECESSARY if used in extconf.rb. see below.
|
99
|
+
require "mini_portile2"
|
100
|
+
recipe = MiniPortile.new("libiconv", "1.13.1")
|
101
|
+
recipe.source_directory = "/path/to/local/source/for/library-1.2.3"
|
102
|
+
```
|
103
|
+
|
92
104
|
### Directory Structure Conventions
|
93
105
|
|
94
106
|
`mini_portile2` follows the principle of **convention over configuration** and
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'net/http'
|
3
3
|
require 'net/https'
|
4
|
+
require 'net/ftp'
|
4
5
|
require 'fileutils'
|
5
6
|
require 'tempfile'
|
6
7
|
require 'digest'
|
@@ -30,7 +31,7 @@ end
|
|
30
31
|
class MiniPortile
|
31
32
|
attr_reader :name, :version, :original_host
|
32
33
|
attr_writer :configure_options
|
33
|
-
attr_accessor :host, :files, :patch_files, :target, :logger
|
34
|
+
attr_accessor :host, :files, :patch_files, :target, :logger, :source_directory
|
34
35
|
|
35
36
|
def self.windows?
|
36
37
|
RbConfig::CONFIG['target_os'] =~ /mswin|mingw/
|
@@ -54,10 +55,22 @@ class MiniPortile
|
|
54
55
|
@patch_files = []
|
55
56
|
@log_files = {}
|
56
57
|
@logger = STDOUT
|
58
|
+
@source_directory = nil
|
57
59
|
|
58
60
|
@original_host = @host = detect_host
|
59
61
|
end
|
60
62
|
|
63
|
+
def source_directory=(path)
|
64
|
+
@source_directory = File.expand_path(path)
|
65
|
+
end
|
66
|
+
|
67
|
+
def prepare_build_directory
|
68
|
+
raise "source_directory is not set" if source_directory.nil?
|
69
|
+
output "Building #{@name} #{@version} from source at '#{source_directory}'"
|
70
|
+
FileUtils.mkdir_p(File.join(tmp_path, [name, version].join("-")))
|
71
|
+
FileUtils.rm_rf(port_path) # make sure we always re-install
|
72
|
+
end
|
73
|
+
|
61
74
|
def download
|
62
75
|
files_hashs.each do |file|
|
63
76
|
download_file(file[:url], file[:local_path])
|
@@ -109,15 +122,16 @@ class MiniPortile
|
|
109
122
|
def configure
|
110
123
|
return if configured?
|
111
124
|
|
125
|
+
FileUtils.mkdir_p(tmp_path)
|
112
126
|
cache_file = File.join(tmp_path, 'configure.options_cache')
|
113
127
|
File.open(cache_file, "w") { |f| f.write computed_options.to_s }
|
114
128
|
|
129
|
+
command = Array(File.join((source_directory || "."), "configure"))
|
115
130
|
if RUBY_PLATFORM=~/mingw|mswin/
|
116
131
|
# Windows doesn't recognize the shebang.
|
117
|
-
|
118
|
-
else
|
119
|
-
execute('configure', %w(./configure) + computed_options)
|
132
|
+
command.unshift("sh")
|
120
133
|
end
|
134
|
+
execute('configure', command + computed_options)
|
121
135
|
end
|
122
136
|
|
123
137
|
def compile
|
@@ -138,7 +152,7 @@ class MiniPortile
|
|
138
152
|
end
|
139
153
|
|
140
154
|
def configured?
|
141
|
-
configure = File.join(work_path, 'configure')
|
155
|
+
configure = File.join((source_directory || work_path), 'configure')
|
142
156
|
makefile = File.join(work_path, 'Makefile')
|
143
157
|
cache_file = File.join(tmp_path, 'configure.options_cache')
|
144
158
|
|
@@ -156,9 +170,13 @@ class MiniPortile
|
|
156
170
|
end
|
157
171
|
|
158
172
|
def cook
|
159
|
-
|
160
|
-
|
161
|
-
|
173
|
+
if source_directory
|
174
|
+
prepare_build_directory
|
175
|
+
else
|
176
|
+
download unless downloaded?
|
177
|
+
extract
|
178
|
+
patch
|
179
|
+
end
|
162
180
|
configure unless configured?
|
163
181
|
compile
|
164
182
|
install unless installed?
|
@@ -472,6 +490,7 @@ private
|
|
472
490
|
def download_file_http(url, full_path, count = 3)
|
473
491
|
filename = File.basename(full_path)
|
474
492
|
with_tempfile(filename, full_path) do |temp_file|
|
493
|
+
progress = 0
|
475
494
|
total = 0
|
476
495
|
params = {
|
477
496
|
"Accept-Encoding" => 'identity',
|
@@ -480,6 +499,7 @@ private
|
|
480
499
|
if total
|
481
500
|
new_progress = (bytes * 100) / total
|
482
501
|
message "\rDownloading %s (%3d%%) " % [filename, new_progress]
|
502
|
+
progress = new_progress
|
483
503
|
else
|
484
504
|
# Content-Length is unavailable because Transfer-Encoding is chunked
|
485
505
|
message "\rDownloading %s " % [filename]
|
@@ -527,15 +547,16 @@ private
|
|
527
547
|
end
|
528
548
|
|
529
549
|
def download_file_ftp(uri, full_path)
|
530
|
-
require "net/ftp"
|
531
550
|
filename = File.basename(uri.path)
|
532
551
|
with_tempfile(filename, full_path) do |temp_file|
|
552
|
+
progress = 0
|
533
553
|
total = 0
|
534
554
|
params = {
|
535
555
|
:content_length_proc => lambda{|length| total = length },
|
536
556
|
:progress_proc => lambda{|bytes|
|
537
557
|
new_progress = (bytes * 100) / total
|
538
558
|
message "\rDownloading %s (%3d%%) " % [filename, new_progress]
|
559
|
+
progress = new_progress
|
539
560
|
}
|
540
561
|
}
|
541
562
|
if ENV["ftp_proxy"]
|
@@ -551,8 +572,6 @@ private
|
|
551
572
|
end
|
552
573
|
output
|
553
574
|
end
|
554
|
-
rescue LoadError
|
555
|
-
raise LoadError, "Ruby #{RUBY_VERSION} does not provide the net-ftp gem, please add it as a dependency if you need to use FTP"
|
556
575
|
rescue Net::FTPError
|
557
576
|
return false
|
558
577
|
end
|
data/mini_portile2.gemspec
CHANGED
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.required_ruby_version = ">= 2.3.0"
|
35
35
|
|
36
|
+
spec.add_dependency "net-ftp", "~> 0.1"
|
37
|
+
|
36
38
|
spec.add_development_dependency "bundler", "~> 2.1"
|
37
39
|
spec.add_development_dependency "minitar", "~> 0.7"
|
38
40
|
spec.add_development_dependency "minitest", "~> 5.11"
|
data/test/test_cook.rb
CHANGED
@@ -113,3 +113,32 @@ class TestCookWithBrokenGitDir < TestCase
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
116
|
+
|
117
|
+
class TestCookAgainstSourceDirectory < TestCase
|
118
|
+
attr_accessor :recipe
|
119
|
+
|
120
|
+
def setup
|
121
|
+
super
|
122
|
+
|
123
|
+
@recipe ||= MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
|
124
|
+
recipe.source_directory = File.expand_path("../assets/test mini portile-1.0.0", __FILE__)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_source_directory
|
129
|
+
recipe.cook
|
130
|
+
|
131
|
+
path = File.join(work_dir, "configure.txt")
|
132
|
+
assert(File.exist?(path))
|
133
|
+
assert_equal((recipe.configure_options + ["--prefix=#{recipe.path}"]).inspect,
|
134
|
+
File.read(path).chomp);
|
135
|
+
|
136
|
+
path = File.join(work_dir, "compile.txt")
|
137
|
+
assert(File.exist?(path))
|
138
|
+
assert_equal("[\"all\"]", File.read(path).chomp);
|
139
|
+
|
140
|
+
path = File.join(work_dir, "install.txt")
|
141
|
+
assert(File.exist?(path))
|
142
|
+
assert_equal("[\"install\"]", File.read(path).chomp);
|
143
|
+
end
|
144
|
+
end
|
data/test/test_download.rb
CHANGED
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.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Lavena
|
@@ -12,6 +12,20 @@ bindir: bin
|
|
12
12
|
cert_chain: []
|
13
13
|
date: 2021-05-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: net-ftp
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0.1'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: bundler
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|