autobuild 1.12.1 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +5 -4
- data/Gemfile +9 -0
- data/Rakefile +6 -1
- data/autobuild.gemspec +1 -0
- data/lib/autobuild/environment.rb +23 -7
- data/lib/autobuild/exceptions.rb +8 -12
- data/lib/autobuild/import/git-lfs.rb +1 -1
- data/lib/autobuild/import/git.rb +1 -1
- data/lib/autobuild/importer.rb +32 -13
- data/lib/autobuild/packages/autotools.rb +6 -3
- data/lib/autobuild/packages/gnumake.rb +13 -10
- data/lib/autobuild/reporting.rb +2 -2
- data/lib/autobuild/subcommand.rb +18 -17
- data/lib/autobuild/tools.rb +2 -8
- data/lib/autobuild/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6623e40c3f107c71c1f9637be0c944a3ffe2a2d
|
4
|
+
data.tar.gz: 7e3298cad9cb1215943573c57a0d70c29b36b676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 405285def822d6a26bc51bd7d336e76e20ba74d434dbb68c67b41b90d8cdbe13f2bbbd0512a81d3575a6f9283a2968d516d3f899eba2ef13dd74cd26a26d0211
|
7
|
+
data.tar.gz: 20b5ebff2c2df256013c51e30064509ff7c99da00034de90816307cc163ca7af65d1593501b74e102b4f24252f5dc760a61520cb01622d09e7e4c1805f87b7e2
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -6,6 +6,11 @@ task 'gem' => 'build'
|
|
6
6
|
|
7
7
|
Rake::TestTask.new(:test) do |t|
|
8
8
|
t.libs << "lib" << Dir.pwd
|
9
|
-
|
9
|
+
|
10
|
+
test_files = Rake::FileList['test/**/test_*.rb']
|
11
|
+
if !File.executable?('/usr/bin/cvs')
|
12
|
+
test_files.exclude('test/import/test_cvs.rb')
|
13
|
+
end
|
14
|
+
t.test_files = test_files
|
10
15
|
end
|
11
16
|
|
data/autobuild.gemspec
CHANGED
@@ -6,6 +6,7 @@ require 'autobuild/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "autobuild"
|
8
8
|
s.version = Autobuild::VERSION
|
9
|
+
s.required_ruby_version = '>= 2.1.0'
|
9
10
|
s.authors = ["Sylvain Joyeux"]
|
10
11
|
s.email = "sylvain.joyeux@m4x.org"
|
11
12
|
s.summary = "Library to handle build systems and import mechanisms"
|
@@ -281,10 +281,10 @@ def init_from_env(name)
|
|
281
281
|
def push(name, *values)
|
282
282
|
if current = environment[name]
|
283
283
|
current = current.dup
|
284
|
-
|
285
|
-
|
284
|
+
set(name, *values)
|
285
|
+
add(name, *current)
|
286
286
|
else
|
287
|
-
|
287
|
+
add(name, *values)
|
288
288
|
end
|
289
289
|
end
|
290
290
|
|
@@ -669,12 +669,28 @@ def add_prefix(newprefix, includes = nil)
|
|
669
669
|
end
|
670
670
|
end
|
671
671
|
|
672
|
+
def find_executable_in_path(file, path_var = 'PATH')
|
673
|
+
(value(path_var) || Array.new).each do |dir|
|
674
|
+
full = File.join(dir, file)
|
675
|
+
begin
|
676
|
+
stat = File.stat(full)
|
677
|
+
if stat.file? && stat.executable?
|
678
|
+
return full
|
679
|
+
end
|
680
|
+
rescue ::Exception
|
681
|
+
end
|
682
|
+
end
|
683
|
+
nil
|
684
|
+
end
|
685
|
+
|
672
686
|
def find_in_path(file, path_var = 'PATH')
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
687
|
+
(value(path_var) || Array.new).each do |dir|
|
688
|
+
full = File.join(dir, file)
|
689
|
+
if File.file?(full)
|
690
|
+
return full
|
691
|
+
end
|
677
692
|
end
|
693
|
+
nil
|
678
694
|
end
|
679
695
|
|
680
696
|
def isolate
|
data/lib/autobuild/exceptions.rb
CHANGED
@@ -100,18 +100,14 @@ def to_s
|
|
100
100
|
# launching process. More importantly, it means we already have a
|
101
101
|
# proper explanation for it. Don't display the logfile at all.
|
102
102
|
if status
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
msg << " #{l}"
|
112
|
-
end
|
113
|
-
else
|
114
|
-
msg << "\n the log file does not seem to be present on disk anymore"
|
103
|
+
lines = @output
|
104
|
+
logsize = Autobuild.displayed_error_line_count
|
105
|
+
if logsize != Float::INFINITY && lines.size > logsize
|
106
|
+
lines = lines[-logsize, logsize]
|
107
|
+
end
|
108
|
+
msg << "\n last #{lines.size} lines are:\n\n"
|
109
|
+
lines.each do |l|
|
110
|
+
msg << " #{l}\n"
|
115
111
|
end
|
116
112
|
end
|
117
113
|
msg
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Autobuild::Git.default_config['filter.lfs.required'] = 'false'
|
4
4
|
|
5
5
|
module Autobuild
|
6
|
-
Git.add_post_hook do |importer, package|
|
6
|
+
Git.add_post_hook(always: true) do |importer, package|
|
7
7
|
lfs_dir = File.join(package.srcdir, '.git', 'lfs')
|
8
8
|
if File.directory?(lfs_dir)
|
9
9
|
importer.run_git(package, 'lfs', 'install', '--force', '--local', '--skip-smudge')
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -1130,7 +1130,7 @@ def self.vcs_definition_for(path, remote_name = 'autobuild')
|
|
1130
1130
|
end
|
1131
1131
|
|
1132
1132
|
Dir.chdir(path) do
|
1133
|
-
vars =
|
1133
|
+
vars = `#{Autobuild.tool(:git)} config -l`.
|
1134
1134
|
split("\n").
|
1135
1135
|
inject(Hash.new) do |h, line|
|
1136
1136
|
k, v = line.strip.split('=', 2)
|
data/lib/autobuild/importer.rb
CHANGED
@@ -248,26 +248,35 @@ def update_retry_count(original_error, retry_count)
|
|
248
248
|
# globally for all importers of a given type with {Importer.add_post_hook}
|
249
249
|
attr_reader :post_hooks
|
250
250
|
|
251
|
+
Hook = Struct.new :always, :callback
|
252
|
+
|
251
253
|
# Define a post-import hook for all instances of this class
|
252
254
|
#
|
253
255
|
# @yieldparam [Importer] importer the importer that finished
|
254
256
|
# @yieldparam [Package] package the package we're acting on
|
255
257
|
# @see Importer#add_post_hook
|
256
|
-
def self.add_post_hook(&hook)
|
258
|
+
def self.add_post_hook(always: false, &hook)
|
257
259
|
@post_hooks ||= Array.new
|
258
|
-
@post_hooks << hook
|
260
|
+
@post_hooks << Hook.new(always, hook)
|
261
|
+
nil
|
259
262
|
end
|
260
263
|
|
261
264
|
# Enumerate the post-import hooks defined for all instances of this class
|
262
|
-
def self.each_post_hook(
|
263
|
-
(
|
265
|
+
def self.each_post_hook(error: false)
|
266
|
+
return enum_for(__method__) if !block_given?
|
267
|
+
|
268
|
+
(@post_hooks ||= Array.new).each do |hook|
|
269
|
+
if hook.always || !error
|
270
|
+
yield(hook.callback)
|
271
|
+
end
|
272
|
+
end
|
264
273
|
end
|
265
274
|
|
266
275
|
# @api private
|
267
276
|
#
|
268
277
|
# Call the post-import hooks added with {#add_post_hook}
|
269
|
-
def execute_post_hooks(package)
|
270
|
-
each_post_hook
|
278
|
+
def execute_post_hooks(package, error: false)
|
279
|
+
each_post_hook(error: error) do |block|
|
271
280
|
block.call(self, package)
|
272
281
|
end
|
273
282
|
end
|
@@ -278,16 +287,20 @@ def execute_post_hooks(package)
|
|
278
287
|
# @yieldparam [Importer] importer the importer that finished
|
279
288
|
# @yieldparam [Package] package the package we're acting on
|
280
289
|
# @see Importer.add_post_hook
|
281
|
-
def add_post_hook(&hook)
|
282
|
-
post_hooks << hook
|
290
|
+
def add_post_hook(always: false, &hook)
|
291
|
+
post_hooks << Hook.new(always, hook)
|
283
292
|
end
|
284
293
|
|
285
294
|
# Enumerate the post-import hooks for this importer
|
286
|
-
def each_post_hook(&hook)
|
295
|
+
def each_post_hook(error: false, &hook)
|
287
296
|
return enum_for(__method__) if !block_given?
|
288
297
|
|
289
|
-
self.class.each_post_hook(&hook)
|
290
|
-
post_hooks.each
|
298
|
+
self.class.each_post_hook(error: error, &hook)
|
299
|
+
post_hooks.each do |hook|
|
300
|
+
if hook.always || !error
|
301
|
+
yield(hook.callback)
|
302
|
+
end
|
303
|
+
end
|
291
304
|
end
|
292
305
|
|
293
306
|
def perform_update(package,only_local=false)
|
@@ -301,8 +314,14 @@ def perform_update(package,only_local=false)
|
|
301
314
|
retry_count = 0
|
302
315
|
package.progress_start "updating %s"
|
303
316
|
begin
|
304
|
-
|
305
|
-
|
317
|
+
begin
|
318
|
+
did_update = update(package,only_local)
|
319
|
+
execute_post_hooks(package, error: false)
|
320
|
+
rescue ::Exception
|
321
|
+
execute_post_hooks(package, error: true)
|
322
|
+
raise
|
323
|
+
end
|
324
|
+
|
306
325
|
message = if did_update == false
|
307
326
|
Autobuild.color('already up-to-date', :green)
|
308
327
|
else
|
@@ -168,9 +168,12 @@ def prepare
|
|
168
168
|
# If it is not the case, remove it to force reconfiguration
|
169
169
|
configureflags.flatten!
|
170
170
|
if File.exist?(configurestamp)
|
171
|
-
output =
|
172
|
-
|
173
|
-
|
171
|
+
output = run('prepare', configurestamp, '--version').
|
172
|
+
grep(/with options/).first.chomp
|
173
|
+
if !output
|
174
|
+
raise "invalid output of config.status --version, expected a line starting with `with options`"
|
175
|
+
end
|
176
|
+
options = Shellwords.shellwords(output.scan(/with options "(.*)"$/).join(" "))
|
174
177
|
|
175
178
|
# Add the --prefix option to the configureflags array
|
176
179
|
testflags = ["--prefix=#{prefix}"] + Array[*configureflags]
|
@@ -1,29 +1,32 @@
|
|
1
1
|
module Autobuild
|
2
|
-
def self.make_is_gnumake?(path = Autobuild.tool(:make))
|
2
|
+
def self.make_is_gnumake?(pkg, path = Autobuild.tool(:make))
|
3
3
|
@make_is_gnumake ||= Hash.new
|
4
4
|
if @make_is_gnumake.has_key?(path)
|
5
5
|
@make_is_gnumake[path]
|
6
6
|
else
|
7
|
-
|
8
|
-
|
9
|
-
(result.
|
7
|
+
begin
|
8
|
+
result = pkg.run('prepare', path, '--version')
|
9
|
+
@make_is_gnumake[path] = (result.first =~ /GNU Make/)
|
10
|
+
rescue Autobuild::SubcommandFailed
|
11
|
+
@make_is_gnumake[path] = false
|
12
|
+
end
|
10
13
|
end
|
11
14
|
end
|
12
15
|
|
13
|
-
def self.make_has_j_option?(path = Autobuild.tool(:make))
|
14
|
-
make_is_gnumake?(path)
|
16
|
+
def self.make_has_j_option?(pkg, path = Autobuild.tool(:make))
|
17
|
+
make_is_gnumake?(pkg, path)
|
15
18
|
end
|
16
19
|
|
17
|
-
def self.make_has_gnumake_jobserver?(path = Autobuild.tool(:make))
|
18
|
-
make_is_gnumake?(path)
|
20
|
+
def self.make_has_gnumake_jobserver?(pkg, path = Autobuild.tool(:make))
|
21
|
+
make_is_gnumake?(pkg, path)
|
19
22
|
end
|
20
23
|
|
21
24
|
def self.invoke_make_parallel(pkg, cmd_path = Autobuild.tool(:make))
|
22
25
|
reserved = nil
|
23
|
-
if make_has_j_option?(cmd_path) && pkg.parallel_build_level != 1
|
26
|
+
if make_has_j_option?(pkg, cmd_path) && pkg.parallel_build_level != 1
|
24
27
|
if manager = Autobuild.parallel_task_manager
|
25
28
|
job_server = manager.job_server
|
26
|
-
if !make_has_gnumake_jobserver?(cmd_path) || (pkg.parallel_build_level != Autobuild.parallel_build_level)
|
29
|
+
if !make_has_gnumake_jobserver?(pkg, cmd_path) || (pkg.parallel_build_level != Autobuild.parallel_build_level)
|
27
30
|
reserved = pkg.parallel_build_level
|
28
31
|
job_server.get(reserved - 1) # We already have one token taken by autobuild itself
|
29
32
|
yield("-j#{pkg.parallel_build_level}")
|
data/lib/autobuild/reporting.rb
CHANGED
@@ -172,7 +172,7 @@ def self.find_common_prefix(msg, other_msg)
|
|
172
172
|
return prefix
|
173
173
|
end
|
174
174
|
end
|
175
|
-
return msg
|
175
|
+
return msg.join(" ")
|
176
176
|
end
|
177
177
|
|
178
178
|
def self.format_progress_message(messages)
|
@@ -217,7 +217,7 @@ def self.format_progress_message(messages)
|
|
217
217
|
grouped_messages << messages[index][(prefix.size)..-1]
|
218
218
|
end
|
219
219
|
if !grouped_messages.empty?
|
220
|
-
result << "#{prefix}#{grouped_messages.join(", ")}"
|
220
|
+
result << "#{prefix}#{grouped_messages.uniq.join(", ")}"
|
221
221
|
end
|
222
222
|
end
|
223
223
|
end
|
data/lib/autobuild/subcommand.rb
CHANGED
@@ -231,10 +231,13 @@ def self.run(target, phase, *command)
|
|
231
231
|
command.reject! { |o| o.nil? || (o.respond_to?(:empty?) && o.empty?) }
|
232
232
|
command.collect! { |o| o.to_s }
|
233
233
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
234
|
+
if target.respond_to?(:name)
|
235
|
+
target_name = target.name
|
236
|
+
target_type = target.class
|
237
|
+
else
|
238
|
+
target_name = target.to_str
|
239
|
+
target_type = nil
|
240
|
+
end
|
238
241
|
logdir = if target.respond_to?(:logdir)
|
239
242
|
target.logdir
|
240
243
|
else Autobuild.logdir
|
@@ -324,24 +327,16 @@ def self.run(target, phase, *command)
|
|
324
327
|
Process.setpriority(Process::PRIO_PROCESS, 0, Autobuild.nice)
|
325
328
|
end
|
326
329
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
$stdout.reopen(outwrite.dup)
|
331
|
-
else
|
332
|
-
$stderr.reopen(logfile.dup)
|
333
|
-
$stdout.reopen(logfile.dup)
|
334
|
-
end
|
330
|
+
outread.close
|
331
|
+
$stderr.reopen(outwrite.dup)
|
332
|
+
$stdout.reopen(outwrite.dup)
|
335
333
|
|
336
334
|
if !input_streams.empty?
|
337
335
|
pwrite.close
|
338
336
|
$stdin.reopen(pread)
|
339
337
|
end
|
340
338
|
|
341
|
-
|
342
|
-
command << Hash[:close_others => false]
|
343
|
-
end
|
344
|
-
exec(env, *command)
|
339
|
+
exec(env, *command, close_others: false)
|
345
340
|
rescue Errno::ENOENT
|
346
341
|
cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I'))
|
347
342
|
exit(100)
|
@@ -385,6 +380,11 @@ def self.run(target, phase, *command)
|
|
385
380
|
end
|
386
381
|
end
|
387
382
|
|
383
|
+
transparent_prefix = "#{target_name}:#{phase}: "
|
384
|
+
if target_type
|
385
|
+
transparent_prefix = "#{target_type}:#{transparent_prefix}"
|
386
|
+
end
|
387
|
+
|
388
388
|
# If the caller asked for process output, provide it to him
|
389
389
|
# line-by-line.
|
390
390
|
outwrite.close
|
@@ -396,7 +396,7 @@ def self.run(target, phase, *command)
|
|
396
396
|
logfile.puts line
|
397
397
|
|
398
398
|
if Autobuild.verbose || transparent_mode?
|
399
|
-
STDOUT.puts "#{
|
399
|
+
STDOUT.puts "#{transparent_prefix}#{line}"
|
400
400
|
elsif block_given?
|
401
401
|
# Do not yield
|
402
402
|
# would mix the progress output with the actual command
|
@@ -408,6 +408,7 @@ def self.run(target, phase, *command)
|
|
408
408
|
outread.close
|
409
409
|
|
410
410
|
_, childstatus = Process.wait2(pid)
|
411
|
+
logfile.puts "Exit: #{childstatus}"
|
411
412
|
childstatus
|
412
413
|
end
|
413
414
|
|
data/lib/autobuild/tools.rb
CHANGED
@@ -38,19 +38,13 @@ def tool_in_path(name, env: self.env)
|
|
38
38
|
# This is already a full path
|
39
39
|
path = current
|
40
40
|
else
|
41
|
-
path =
|
41
|
+
path = env.find_executable_in_path(current)
|
42
42
|
end
|
43
43
|
|
44
44
|
if !path
|
45
|
-
raise ArgumentError, "tool #{name}, set to #{current}, can not be found in PATH=#{
|
45
|
+
raise ArgumentError, "tool #{name}, set to #{current}, can not be found in PATH=#{env_PATH}"
|
46
46
|
end
|
47
47
|
|
48
|
-
# Verify that the new value is a file and is executable
|
49
|
-
if !File.file?(path)
|
50
|
-
raise ArgumentError, "tool #{name} is set to #{current}, but this resolves to #{path} which is not a file"
|
51
|
-
elsif !File.executable?(path)
|
52
|
-
raise ArgumentError, "tool #{name} is set to #{current}, but this resolves to #{path} which is not executable"
|
53
|
-
end
|
54
48
|
programs_in_path[name] = [path, current, env_PATH]
|
55
49
|
end
|
56
50
|
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|