mini_portile2 2.5.2 → 2.6.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: a50c7c03eb4dcb7395372836a55084a65dbb7b29fde587cb9a0e795464008e50
4
- data.tar.gz: d6ec7eda8e8e8fec8c50824ec50d25062cfc21ad8f745002d35ddbb31c8f4e7d
3
+ metadata.gz: cead22320fb80bbc4e46f568f422211dd8a6af92006edc220e1320019cc52676
4
+ data.tar.gz: d4b5deaa502e5ae66526eb2b23978a4ef52996a100a64f224664927dca0658b2
5
5
  SHA512:
6
- metadata.gz: a5b8423782025822fed3b7ad9b24c3db71791042a510adb90260d40138286090e3bc981671d57da3639dd80a559bdb77bac222551b6a3eef9259cee63aa9d98e
7
- data.tar.gz: 52ec801b7006e8bc74a4ccb87a636e5a9d222d58d18a2c2d609778a45f83a1381e74a16e9065ecff51558781561547ad96ba495c09679c759b893b6a9328bb79
6
+ metadata.gz: 7dbd446271e3b0c26cf39504b6b1af53faee8a212ba7451af76f17e1f8858b3f329c5e281f753d1731fe27a3d9121c9f7328188ead52aaf63c1d4728c44fcd99
7
+ data.tar.gz: a6b17cd4c01588c86d70a4e18c713cc5c13c16922ac64cc38e7c77fac416b1a9e1fa4eeee502dd23f13ece5a16d8b364033169de0e8e4612012544599a692c03
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## mini_portile changelog
2
2
 
3
+ ### 2.6.0 / 2021-05-31
4
+
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.
10
+
11
+
3
12
  ### 2.5.2 / 2021-05-28
4
13
 
5
14
  #### Dependencies
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
@@ -31,7 +31,7 @@ end
31
31
  class MiniPortile
32
32
  attr_reader :name, :version, :original_host
33
33
  attr_writer :configure_options
34
- attr_accessor :host, :files, :patch_files, :target, :logger
34
+ attr_accessor :host, :files, :patch_files, :target, :logger, :source_directory
35
35
 
36
36
  def self.windows?
37
37
  RbConfig::CONFIG['target_os'] =~ /mswin|mingw/
@@ -55,10 +55,22 @@ class MiniPortile
55
55
  @patch_files = []
56
56
  @log_files = {}
57
57
  @logger = STDOUT
58
+ @source_directory = nil
58
59
 
59
60
  @original_host = @host = detect_host
60
61
  end
61
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
+
62
74
  def download
63
75
  files_hashs.each do |file|
64
76
  download_file(file[:url], file[:local_path])
@@ -110,15 +122,16 @@ class MiniPortile
110
122
  def configure
111
123
  return if configured?
112
124
 
125
+ FileUtils.mkdir_p(tmp_path)
113
126
  cache_file = File.join(tmp_path, 'configure.options_cache')
114
127
  File.open(cache_file, "w") { |f| f.write computed_options.to_s }
115
128
 
129
+ command = Array(File.join((source_directory || "."), "configure"))
116
130
  if RUBY_PLATFORM=~/mingw|mswin/
117
131
  # Windows doesn't recognize the shebang.
118
- execute('configure', %w(sh ./configure) + computed_options)
119
- else
120
- execute('configure', %w(./configure) + computed_options)
132
+ command.unshift("sh")
121
133
  end
134
+ execute('configure', command + computed_options)
122
135
  end
123
136
 
124
137
  def compile
@@ -139,7 +152,7 @@ class MiniPortile
139
152
  end
140
153
 
141
154
  def configured?
142
- configure = File.join(work_path, 'configure')
155
+ configure = File.join((source_directory || work_path), 'configure')
143
156
  makefile = File.join(work_path, 'Makefile')
144
157
  cache_file = File.join(tmp_path, 'configure.options_cache')
145
158
 
@@ -157,9 +170,13 @@ class MiniPortile
157
170
  end
158
171
 
159
172
  def cook
160
- download unless downloaded?
161
- extract
162
- patch
173
+ if source_directory
174
+ prepare_build_directory
175
+ else
176
+ download unless downloaded?
177
+ extract
178
+ patch
179
+ end
163
180
  configure unless configured?
164
181
  compile
165
182
  install unless installed?
@@ -1,3 +1,3 @@
1
1
  class MiniPortile
2
- VERSION = "2.5.2"
2
+ VERSION = "2.6.0"
3
3
  end
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
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.5.2
4
+ version: 2.6.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-28 00:00:00.000000000 Z
13
+ date: 2021-05-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: net-ftp