autobuild 1.22.1 → 1.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autobuild/environment.rb +100 -15
- data/lib/autobuild/exceptions.rb +2 -1
- data/lib/autobuild/import/archive.rb +2 -1
- data/lib/autobuild/import/git.rb +8 -4
- data/lib/autobuild/import/svn.rb +2 -1
- data/lib/autobuild/importer.rb +4 -2
- data/lib/autobuild/package.rb +14 -3
- data/lib/autobuild/packages/autotools.rb +2 -1
- data/lib/autobuild/packages/cmake.rb +2 -1
- data/lib/autobuild/packages/python.rb +18 -6
- data/lib/autobuild/parallel.rb +2 -1
- data/lib/autobuild/progress_display.rb +2 -1
- data/lib/autobuild/reporting.rb +4 -2
- data/lib/autobuild/subcommand.rb +6 -3
- data/lib/autobuild/test_utility.rb +4 -2
- data/lib/autobuild/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6431400922a5accc7c11c921745648a3a7fa65e92023bc700b26e6d975bd2d6a
|
4
|
+
data.tar.gz: bd29297ec7e7902e067a08ecb9ea4837a051be82b7db7c6ca40c207657d587bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 726b002c5f1e6a51efe77397546762ce1aa50e546bddecaec4a379a69943646e414e6c0d7ae8a470d29be982a2a50541be800ae40d30a6206723185d1937e30a
|
7
|
+
data.tar.gz: 95088358f807bb6edfd52746e8c30ed85b52b05f2318c09be17fe05b45484f554205d48d280094dc378e322b26ae468a2b5ad72468c34b9b369e4d0aa085a5fa
|
@@ -29,37 +29,44 @@ module Autobuild
|
|
29
29
|
|
30
30
|
SHELL_VAR_EXPANSION =
|
31
31
|
if windows? then "%%%s%%".freeze
|
32
|
-
else
|
32
|
+
else
|
33
|
+
"$%s".freeze
|
33
34
|
end
|
34
35
|
SHELL_SET_COMMAND =
|
35
36
|
if windows? then "set %s=%s".freeze
|
36
|
-
else
|
37
|
+
else
|
38
|
+
"%s=\"%s\"".freeze
|
37
39
|
end
|
38
40
|
SHELL_CONDITIONAL_SET_COMMAND =
|
39
41
|
if windows? then "set %s=%s".freeze
|
40
|
-
else
|
42
|
+
else
|
43
|
+
"if test -z \"$%1$s\"; then\n %1$s=\"%3$s\"\n"\
|
41
44
|
"else\n %1$s=\"%2$s\"\nfi".freeze
|
42
45
|
end
|
43
46
|
SHELL_UNSET_COMMAND = "unset %s".freeze
|
44
47
|
SHELL_EXPORT_COMMAND =
|
45
48
|
if windows? then "set %s".freeze
|
46
|
-
else
|
49
|
+
else
|
50
|
+
"export %s".freeze
|
47
51
|
end
|
48
52
|
SHELL_SOURCE_SCRIPT =
|
49
53
|
if windows? then "%s".freeze
|
50
|
-
else
|
54
|
+
else
|
55
|
+
'. "%s"'.freeze
|
51
56
|
end
|
52
57
|
|
53
58
|
LIBRARY_PATH =
|
54
59
|
if macos? then 'DYLD_LIBRARY_PATH'.freeze
|
55
60
|
elsif windows? then 'PATH'.freeze
|
56
|
-
else
|
61
|
+
else
|
62
|
+
'LD_LIBRARY_PATH'.freeze
|
57
63
|
end
|
58
64
|
|
59
65
|
LIBRARY_SUFFIX =
|
60
66
|
if macos? then 'dylib'
|
61
67
|
elsif windows? then 'dll'
|
62
|
-
else
|
68
|
+
else
|
69
|
+
'so'
|
63
70
|
end
|
64
71
|
|
65
72
|
ORIGINAL_ENV = Hash.new
|
@@ -211,7 +218,8 @@ module Autobuild
|
|
211
218
|
if @inherit
|
212
219
|
if name
|
213
220
|
@inherited_variables.include?(name)
|
214
|
-
else
|
221
|
+
else
|
222
|
+
true
|
215
223
|
end
|
216
224
|
end
|
217
225
|
end
|
@@ -245,7 +253,8 @@ module Autobuild
|
|
245
253
|
flag =
|
246
254
|
if !names.last.respond_to?(:to_str)
|
247
255
|
names.pop
|
248
|
-
else
|
256
|
+
else
|
257
|
+
true
|
249
258
|
end
|
250
259
|
|
251
260
|
if flag
|
@@ -342,7 +351,8 @@ module Autobuild
|
|
342
351
|
inherited_environment[name] || []
|
343
352
|
elsif inheritance_mode == :keep && inherit?(name)
|
344
353
|
["$#{name}"]
|
345
|
-
else
|
354
|
+
else
|
355
|
+
[]
|
346
356
|
end
|
347
357
|
|
348
358
|
value = []
|
@@ -439,7 +449,8 @@ module Autobuild
|
|
439
449
|
if file
|
440
450
|
@source_before << { file: file, shell: shell }
|
441
451
|
source_before(shell: shell) # for backwards compatibility
|
442
|
-
else
|
452
|
+
else
|
453
|
+
@source_before.select { |pair| pair[:shell] == shell }
|
443
454
|
.map { |item| item[:file] }
|
444
455
|
end
|
445
456
|
end
|
@@ -457,7 +468,8 @@ module Autobuild
|
|
457
468
|
if file
|
458
469
|
@source_after << { file: file, shell: shell }
|
459
470
|
source_after(shell: shell) # for backwards compatibility
|
460
|
-
else
|
471
|
+
else
|
472
|
+
@source_after.select { |pair| pair[:shell] == shell }
|
461
473
|
.map { |item| item[:file] }
|
462
474
|
end
|
463
475
|
end
|
@@ -542,7 +554,8 @@ module Autobuild
|
|
542
554
|
with_inheritance = with_inheritance.map do |value|
|
543
555
|
if value == variable_expansion
|
544
556
|
base_env[name]
|
545
|
-
else
|
557
|
+
else
|
558
|
+
value
|
546
559
|
end
|
547
560
|
end
|
548
561
|
result[name] = with_inheritance.join(File::PATH_SEPARATOR)
|
@@ -604,7 +617,8 @@ module Autobuild
|
|
604
617
|
@arch_size ||=
|
605
618
|
if RbConfig::CONFIG['host_cpu'] =~ /64/
|
606
619
|
64
|
607
|
-
else
|
620
|
+
else
|
621
|
+
32
|
608
622
|
end
|
609
623
|
@arch_size
|
610
624
|
end
|
@@ -633,12 +647,73 @@ module Autobuild
|
|
633
647
|
add_prefix(newprefix, includes)
|
634
648
|
end
|
635
649
|
|
650
|
+
def default_cmake_search_globs(prefix, *file_globs)
|
651
|
+
lib_globs = %w[lib]
|
652
|
+
|
653
|
+
case arch_size
|
654
|
+
when 32
|
655
|
+
lib_globs << "lib32"
|
656
|
+
lib_globs << "libx32"
|
657
|
+
when 64
|
658
|
+
lib_globs << "lib64"
|
659
|
+
end
|
660
|
+
|
661
|
+
unless arch_names.empty?
|
662
|
+
arch_names.each do |arch_name|
|
663
|
+
lib_globs << File.join("lib", arch_name)
|
664
|
+
end
|
665
|
+
end
|
666
|
+
|
667
|
+
lib_share_glob = "{#{lib_globs.join(',')},share}"
|
668
|
+
file_glob = "{#{file_globs.join(',')}}"
|
669
|
+
|
670
|
+
# Reference: https://cmake.org/cmake/help/latest/command/find_package.html
|
671
|
+
#
|
672
|
+
# <prefix>/ (W)
|
673
|
+
# <prefix>/(cmake|CMake)/ (W)
|
674
|
+
# <prefix>/<name>*/ (W)
|
675
|
+
# <prefix>/<name>*/(cmake|CMake)/ (W)
|
676
|
+
# <prefix>/(lib/<arch>|lib*|share)/cmake/<name>*/ (U)
|
677
|
+
# <prefix>/(lib/<arch>|lib*|share)/<name>*/ (U)
|
678
|
+
# <prefix>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (U)
|
679
|
+
# <prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/ (W/U)
|
680
|
+
# <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/ (W/U)
|
681
|
+
# <prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (W/U)
|
682
|
+
[
|
683
|
+
File.join(prefix, file_glob),
|
684
|
+
File.join(prefix, "{cmake,CMake}", file_glob),
|
685
|
+
File.join(prefix, "*", file_glob),
|
686
|
+
File.join(prefix, "*", "{cmake/CMake}", file_glob),
|
687
|
+
File.join(prefix, lib_share_glob, "cmake", "*", file_glob),
|
688
|
+
File.join(prefix, lib_share_glob, "*", file_glob),
|
689
|
+
File.join(prefix, lib_share_glob, "*", "{cmake,CMake}", file_glob),
|
690
|
+
File.join(prefix, "*", lib_share_glob, "cmake", "*", file_glob),
|
691
|
+
File.join(prefix, "*", lib_share_glob, "*", file_glob),
|
692
|
+
File.join(prefix, "*", lib_share_glob, "*", "{cmake,CMake}", file_glob)
|
693
|
+
]
|
694
|
+
end
|
695
|
+
|
696
|
+
def has_cmake_files?(prefix, *file_globs)
|
697
|
+
default_cmake_search_globs(prefix, *file_globs).each do |glob_path|
|
698
|
+
return true unless Dir[glob_path].empty?
|
699
|
+
end
|
700
|
+
false
|
701
|
+
end
|
702
|
+
|
636
703
|
PKGCONFIG_PATH_RX = %r{.*/((?:lib|lib64|share)/.*)}.freeze
|
637
704
|
|
705
|
+
def pkgconfig_tool_path
|
706
|
+
@pkgconfig_tool_path ||= Autobuild.tool_in_path("pkg-config", env: self)
|
707
|
+
rescue ArgumentError
|
708
|
+
nil
|
709
|
+
end
|
710
|
+
|
638
711
|
# Returns the system-wide search path that is embedded in pkg-config
|
639
712
|
def default_pkgconfig_search_suffixes
|
713
|
+
return [] unless pkgconfig_tool_path
|
714
|
+
|
640
715
|
@default_pkgconfig_search_suffixes ||=
|
641
|
-
`LANG=C #{
|
716
|
+
`LANG=C #{pkgconfig_tool_path} --variable pc_path pkg-config`
|
642
717
|
.strip
|
643
718
|
.split(":")
|
644
719
|
.grep(PKGCONFIG_PATH_RX)
|
@@ -670,6 +745,16 @@ module Autobuild
|
|
670
745
|
end
|
671
746
|
end
|
672
747
|
|
748
|
+
cmake_pairs = []
|
749
|
+
cmake_pairs << ["CMAKE_PREFIX_PATH", ["*-config.cmake", "*Config.cmake"]]
|
750
|
+
cmake_pairs << ["CMAKE_MODULE_PATH", ["Find*.cmake"]]
|
751
|
+
cmake_pairs.each do |cmake_var, cmake_file_globs|
|
752
|
+
if !includes || includes.include?(cmake_var)
|
753
|
+
has_cmake = has_cmake_files?(newprefix, *cmake_file_globs)
|
754
|
+
add_path(cmake_var, newprefix) if has_cmake
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
673
758
|
# Validate the new rubylib path
|
674
759
|
if !includes || includes.include?('RUBYLIB')
|
675
760
|
new_rubylib = "#{newprefix}/lib"
|
data/lib/autobuild/exceptions.rb
CHANGED
data/lib/autobuild/import/git.rb
CHANGED
@@ -40,7 +40,8 @@ module Autobuild
|
|
40
40
|
@default_alternates = cache_dirs.map do |path|
|
41
41
|
File.join(File.expand_path(path), '%s')
|
42
42
|
end
|
43
|
-
else
|
43
|
+
else
|
44
|
+
Array.new
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
@@ -764,7 +765,8 @@ module Autobuild
|
|
764
765
|
rescue SubcommandFailed => e
|
765
766
|
if e.status == 1
|
766
767
|
false
|
767
|
-
else
|
768
|
+
else
|
769
|
+
raise
|
768
770
|
end
|
769
771
|
end
|
770
772
|
|
@@ -775,7 +777,8 @@ module Autobuild
|
|
775
777
|
rescue SubcommandFailed => e
|
776
778
|
if e.status == 1
|
777
779
|
false
|
778
|
-
else
|
780
|
+
else
|
781
|
+
raise
|
779
782
|
end
|
780
783
|
end
|
781
784
|
|
@@ -1020,7 +1023,8 @@ module Autobuild
|
|
1020
1023
|
File.readlines(alternates_path)
|
1021
1024
|
.map(&:strip)
|
1022
1025
|
.find_all { |l| !l.empty? }
|
1023
|
-
else
|
1026
|
+
else
|
1027
|
+
Array.new
|
1024
1028
|
end
|
1025
1029
|
|
1026
1030
|
alternates = each_alternate_path(package).map do |path|
|
data/lib/autobuild/import/svn.rb
CHANGED
data/lib/autobuild/importer.rb
CHANGED
@@ -357,7 +357,8 @@ module Autobuild
|
|
357
357
|
message = Autobuild.color('interrupted', :red)
|
358
358
|
if last_error
|
359
359
|
raise last_error
|
360
|
-
else
|
360
|
+
else
|
361
|
+
raise
|
361
362
|
end
|
362
363
|
rescue ::Exception => e
|
363
364
|
message = Autobuild.color('update failed', :red)
|
@@ -410,7 +411,8 @@ module Autobuild
|
|
410
411
|
execute_post_hooks(package)
|
411
412
|
rescue Interrupt
|
412
413
|
if last_error then raise last_error
|
413
|
-
else
|
414
|
+
else
|
415
|
+
raise
|
414
416
|
end
|
415
417
|
rescue ::Exception => e
|
416
418
|
last_error = e
|
data/lib/autobuild/package.rb
CHANGED
@@ -119,7 +119,8 @@ module Autobuild
|
|
119
119
|
def update?
|
120
120
|
if @update.nil?
|
121
121
|
Autobuild.do_update
|
122
|
-
else
|
122
|
+
else
|
123
|
+
@update
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|
@@ -287,6 +288,11 @@ module Autobuild
|
|
287
288
|
add_env_op EnvOp.new(:add_prefix, prefix, [includes])
|
288
289
|
end
|
289
290
|
|
291
|
+
# Add a file to be sourced at the end of the generated env file
|
292
|
+
def env_source_after(file, shell: "sh")
|
293
|
+
add_env_op EnvOp.new(:source_after, file, shell: shell)
|
294
|
+
end
|
295
|
+
|
290
296
|
# Hook called by autoproj to set up the default environment for this
|
291
297
|
# package
|
292
298
|
#
|
@@ -327,7 +333,11 @@ module Autobuild
|
|
327
333
|
set[env_op.name] = [self, env_op.values]
|
328
334
|
end
|
329
335
|
end
|
330
|
-
|
336
|
+
if env_op.type == :source_after
|
337
|
+
env.send(env_op.type, env_op.name, **env_op.values)
|
338
|
+
else
|
339
|
+
env.send(env_op.type, env_op.name, *env_op.values)
|
340
|
+
end
|
331
341
|
ops << env_op
|
332
342
|
end
|
333
343
|
ops
|
@@ -492,7 +502,8 @@ module Autobuild
|
|
492
502
|
suffix << token.gsub(/%s/, name)
|
493
503
|
elsif suffix.empty?
|
494
504
|
prefix << token
|
495
|
-
else
|
505
|
+
else
|
506
|
+
suffix << token
|
496
507
|
end
|
497
508
|
end
|
498
509
|
if suffix.empty?
|
@@ -27,12 +27,14 @@ module Autobuild
|
|
27
27
|
|
28
28
|
def prepare_for_forced_build
|
29
29
|
super
|
30
|
-
FileUtils.rm_f configurestamp
|
31
30
|
@forced = true
|
32
31
|
end
|
33
32
|
|
34
33
|
def generate_build_command
|
35
|
-
command = [
|
34
|
+
command = %w[python setup.py]
|
35
|
+
command << "egg_info"
|
36
|
+
command << "--egg-base=#{builddir}"
|
37
|
+
command << "build"
|
36
38
|
command << "--build-base=#{builddir}"
|
37
39
|
command += buildflags.flatten
|
38
40
|
command
|
@@ -42,25 +44,35 @@ module Autobuild
|
|
42
44
|
command = generate_build_command
|
43
45
|
command << 'install'
|
44
46
|
command << "--prefix=#{prefix}"
|
47
|
+
command << "--record=#{builddir}/install.log"
|
48
|
+
command << "--single-version-externally-managed"
|
45
49
|
command += installflags.flatten
|
46
50
|
command
|
47
51
|
end
|
48
52
|
|
49
|
-
def
|
53
|
+
def self.user_site(prefix)
|
54
|
+
return File.join(prefix, @user_site) if @user_site
|
55
|
+
|
50
56
|
begin
|
51
|
-
|
52
|
-
|
57
|
+
env = Autobuild.env.resolved_env.merge({ 'PYTHONUSERBASE' => "/" })
|
58
|
+
_, output, _, ret = Open3.popen3(env, 'python -m site --user-site')
|
53
59
|
rescue Exception => e
|
54
60
|
raise "Unable to set PYTHONPATH: #{e.message}"
|
55
61
|
end
|
56
62
|
|
57
63
|
if ret.value.success?
|
58
|
-
output.read.chomp
|
64
|
+
@user_site = Pathname.new(output.read.chomp)
|
65
|
+
.relative_path_from(Pathname.new("/"))
|
66
|
+
File.join(prefix, @user_site)
|
59
67
|
else
|
60
68
|
raise 'Unable to set PYTHONPATH: user site directory disabled?'
|
61
69
|
end
|
62
70
|
end
|
63
71
|
|
72
|
+
def python_path
|
73
|
+
self.class.user_site(prefix)
|
74
|
+
end
|
75
|
+
|
64
76
|
# Do the build in builddir
|
65
77
|
def build
|
66
78
|
return unless install_mode?
|
data/lib/autobuild/parallel.rb
CHANGED
data/lib/autobuild/reporting.rb
CHANGED
@@ -130,7 +130,8 @@ module Autobuild
|
|
130
130
|
# :exit if debug is false, or :raise if it is true
|
131
131
|
def self.default_report_on_package_failures
|
132
132
|
if Autobuild.debug then :raise
|
133
|
-
else
|
133
|
+
else
|
134
|
+
:exit
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
@@ -163,7 +164,8 @@ module Autobuild
|
|
163
164
|
raise interrupted_by if interrupted_by
|
164
165
|
|
165
166
|
e = if errors.size == 1 then errors.first
|
166
|
-
else
|
167
|
+
else
|
168
|
+
CompositeException.new(errors)
|
167
169
|
end
|
168
170
|
raise e
|
169
171
|
elsif %i[report_silent report].include?(on_package_failures)
|
data/lib/autobuild/subcommand.rb
CHANGED
@@ -251,7 +251,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
|
|
251
251
|
end
|
252
252
|
logdir = if target.respond_to?(:logdir)
|
253
253
|
target.logdir
|
254
|
-
else
|
254
|
+
else
|
255
|
+
Autobuild.logdir
|
255
256
|
end
|
256
257
|
|
257
258
|
if target.respond_to?(:working_directory)
|
@@ -271,7 +272,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
|
|
271
272
|
|
272
273
|
open_flag = if Autobuild.keep_oldlogs then 'a'
|
273
274
|
elsif Autobuild.registered_logfile?(logname) then 'a'
|
274
|
-
else
|
275
|
+
else
|
276
|
+
'w'
|
275
277
|
end
|
276
278
|
open_flag << ":BINARY"
|
277
279
|
|
@@ -461,7 +463,8 @@ module Autobuild::Subprocess # rubocop:disable Style/ClassAndModuleChildren
|
|
461
463
|
error = Autobuild::SubcommandFailed.new(target, command.join(" "),
|
462
464
|
logname, e.status, subcommand_output)
|
463
465
|
error.retry = if e.retry?.nil? then options[:retry]
|
464
|
-
else
|
466
|
+
else
|
467
|
+
e.retry?
|
465
468
|
end
|
466
469
|
error.phase = phase
|
467
470
|
raise error, e.message
|
@@ -24,7 +24,8 @@ module Autobuild
|
|
24
24
|
def coverage_enabled?
|
25
25
|
if @coverage_enabled.nil?
|
26
26
|
TestUtility.coverage_enabled?
|
27
|
-
else
|
27
|
+
else
|
28
|
+
@coverage_enabled
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -53,7 +54,8 @@ module Autobuild
|
|
53
54
|
if @coverage_source_dir
|
54
55
|
relative = if package.respond_to?(:builddir)
|
55
56
|
package.builddir
|
56
|
-
else
|
57
|
+
else
|
58
|
+
package.srcdir
|
57
59
|
end
|
58
60
|
File.expand_path(@coverage_source_dir, relative)
|
59
61
|
end
|
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.
|
4
|
+
version: 1.23.0
|
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: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: '0'
|
279
279
|
requirements: []
|
280
|
-
rubygems_version: 3.1.
|
280
|
+
rubygems_version: 3.1.6
|
281
281
|
signing_key:
|
282
282
|
specification_version: 4
|
283
283
|
summary: Library to handle build systems and import mechanisms
|