autobuild 1.17.0 → 1.18.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 +4 -4
- data/.rubocop.yml +107 -0
- data/Gemfile +2 -1
- data/Rakefile +1 -4
- data/autobuild.gemspec +14 -11
- data/bin/autobuild +4 -3
- data/lib/autobuild.rb +4 -5
- data/lib/autobuild/build_logfile.rb +6 -4
- data/lib/autobuild/config.rb +90 -40
- data/lib/autobuild/configurable.rb +30 -18
- data/lib/autobuild/environment.rb +126 -120
- data/lib/autobuild/exceptions.rb +48 -31
- data/lib/autobuild/import/archive.rb +134 -82
- data/lib/autobuild/import/cvs.rb +28 -24
- data/lib/autobuild/import/darcs.rb +13 -16
- data/lib/autobuild/import/git-lfs.rb +37 -30
- data/lib/autobuild/import/git.rb +231 -179
- data/lib/autobuild/import/hg.rb +23 -18
- data/lib/autobuild/import/svn.rb +48 -29
- data/lib/autobuild/importer.rb +530 -499
- data/lib/autobuild/mail_reporter.rb +77 -77
- data/lib/autobuild/package.rb +171 -101
- data/lib/autobuild/packages/autotools.rb +47 -42
- data/lib/autobuild/packages/cmake.rb +71 -65
- data/lib/autobuild/packages/dummy.rb +9 -8
- data/lib/autobuild/packages/genom.rb +1 -1
- data/lib/autobuild/packages/gnumake.rb +19 -13
- data/lib/autobuild/packages/import.rb +2 -6
- data/lib/autobuild/packages/orogen.rb +32 -31
- data/lib/autobuild/packages/pkgconfig.rb +2 -2
- data/lib/autobuild/packages/python.rb +7 -2
- data/lib/autobuild/packages/ruby.rb +22 -17
- data/lib/autobuild/parallel.rb +35 -39
- data/lib/autobuild/pkgconfig.rb +25 -13
- data/lib/autobuild/progress_display.rb +23 -23
- data/lib/autobuild/rake_task_extension.rb +6 -6
- data/lib/autobuild/reporting.rb +38 -26
- data/lib/autobuild/subcommand.rb +72 -65
- data/lib/autobuild/test.rb +8 -7
- data/lib/autobuild/test_utility.rb +10 -9
- data/lib/autobuild/timestamps.rb +28 -23
- data/lib/autobuild/tools.rb +17 -16
- data/lib/autobuild/utility.rb +16 -18
- data/lib/autobuild/version.rb +1 -1
- metadata +39 -38
@@ -36,7 +36,7 @@ def builddir
|
|
36
36
|
@builddir
|
37
37
|
else
|
38
38
|
ancestors.each do |klass|
|
39
|
-
if result = klass.instance_variable_get(:@builddir)
|
39
|
+
if (result = klass.instance_variable_get(:@builddir))
|
40
40
|
return result
|
41
41
|
end
|
42
42
|
end
|
@@ -45,8 +45,13 @@ def builddir
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def builddir=(new)
|
48
|
-
|
49
|
-
|
48
|
+
if new.nil? || new.empty?
|
49
|
+
raise ConfigException, "builddir must be non-nil and non-empty"
|
50
|
+
end
|
51
|
+
if Pathname.new(new).absolute?
|
52
|
+
raise ConfigException, "absolute builddirs are not supported"
|
53
|
+
end
|
54
|
+
|
50
55
|
@builddir = new
|
51
56
|
end
|
52
57
|
end
|
@@ -54,15 +59,21 @@ def builddir=(new)
|
|
54
59
|
|
55
60
|
def builddir=(new)
|
56
61
|
raise ConfigException.new(self), "builddir must be non-empty" if new.empty?
|
62
|
+
|
57
63
|
@builddir = new
|
58
64
|
end
|
65
|
+
|
59
66
|
# Returns the absolute builddir
|
60
|
-
def builddir
|
67
|
+
def builddir
|
68
|
+
File.expand_path(@builddir || self.class.builddir, srcdir)
|
69
|
+
end
|
61
70
|
|
62
71
|
# Build stamp
|
63
72
|
# This returns the name of the file which marks when the package has been
|
64
73
|
# successfully built for the last time. The path is absolute
|
65
|
-
def buildstamp
|
74
|
+
def buildstamp
|
75
|
+
"#{builddir}/#{STAMPFILE}"
|
76
|
+
end
|
66
77
|
|
67
78
|
def prepare_for_forced_build
|
68
79
|
super
|
@@ -74,9 +85,7 @@ def prepare_for_forced_build
|
|
74
85
|
def prepare_for_rebuild
|
75
86
|
super
|
76
87
|
|
77
|
-
if File.exist?(builddir) && builddir != srcdir
|
78
|
-
FileUtils.rm_rf builddir
|
79
|
-
end
|
88
|
+
FileUtils.rm_rf(builddir) if File.exist?(builddir) && builddir != srcdir
|
80
89
|
end
|
81
90
|
|
82
91
|
def ensure_dependencies_installed
|
@@ -87,9 +96,13 @@ def ensure_dependencies_installed
|
|
87
96
|
|
88
97
|
def prepare
|
89
98
|
source_tree srcdir do |pkg|
|
90
|
-
|
91
|
-
|
92
|
-
|
99
|
+
if builddir != srcdir
|
100
|
+
pkg.exclude << Regexp.new("^#{Regexp.quote(builddir)}")
|
101
|
+
end
|
102
|
+
if doc_dir && (doc_dir != srcdir)
|
103
|
+
pkg.exclude << Regexp.new("^#{Regexp.quote(doc_dir)}")
|
104
|
+
end
|
105
|
+
pkg.exclude.concat(source_tree_excludes)
|
93
106
|
end
|
94
107
|
|
95
108
|
super
|
@@ -104,7 +117,7 @@ def prepare
|
|
104
117
|
end
|
105
118
|
task "#{name}-prepare" => configurestamp
|
106
119
|
|
107
|
-
file buildstamp => [
|
120
|
+
file buildstamp => [srcdir, configurestamp] do
|
108
121
|
isolate_errors do
|
109
122
|
ensure_dependencies_installed
|
110
123
|
build
|
@@ -118,9 +131,11 @@ def prepare
|
|
118
131
|
# Configure the builddir directory before starting make
|
119
132
|
def configure
|
120
133
|
if File.exist?(builddir) && !File.directory?(builddir)
|
121
|
-
raise ConfigException.new(self, 'configure'),
|
134
|
+
raise ConfigException.new(self, 'configure'),
|
135
|
+
"#{builddir} already exists but is not a directory"
|
122
136
|
end
|
123
|
-
|
137
|
+
|
138
|
+
FileUtils.mkdir_p builddir unless File.directory?(builddir)
|
124
139
|
|
125
140
|
yield if block_given?
|
126
141
|
|
@@ -128,9 +143,6 @@ def configure
|
|
128
143
|
end
|
129
144
|
|
130
145
|
# Do the build in builddir
|
131
|
-
def build
|
132
|
-
end
|
146
|
+
def build; end
|
133
147
|
end
|
134
148
|
end
|
135
|
-
|
136
|
-
|
@@ -3,12 +3,12 @@
|
|
3
3
|
require 'utilrb/hash/map_value'
|
4
4
|
|
5
5
|
module Autobuild
|
6
|
-
@windows = RbConfig::CONFIG["host_os"]
|
6
|
+
@windows = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw|[Ww]indows)/
|
7
7
|
def self.windows?
|
8
8
|
@windows
|
9
9
|
end
|
10
10
|
|
11
|
-
@macos =
|
11
|
+
@macos = RbConfig::CONFIG["host_os"] =~ /([Dd]arwin)/
|
12
12
|
def self.macos?
|
13
13
|
@macos
|
14
14
|
end
|
@@ -19,43 +19,41 @@ def self.freebsd?
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.bsd?
|
22
|
-
@freebsd || @macos #can be extended to some other OSes liek NetBSD
|
22
|
+
@freebsd || @macos # can be extended to some other OSes liek NetBSD
|
23
23
|
end
|
24
24
|
|
25
|
-
@msys =
|
25
|
+
@msys = RbConfig::CONFIG["host_os"] =~ /(msys)/
|
26
26
|
def self.msys?
|
27
27
|
@msys
|
28
28
|
end
|
29
29
|
|
30
30
|
SHELL_VAR_EXPANSION =
|
31
|
-
if windows? then "%%%s%%"
|
32
|
-
else "$%s"
|
31
|
+
if windows? then "%%%s%%".freeze
|
32
|
+
else "$%s".freeze
|
33
33
|
end
|
34
34
|
SHELL_SET_COMMAND =
|
35
|
-
if windows? then "set %s=%s"
|
36
|
-
else "%s=\"%s\""
|
35
|
+
if windows? then "set %s=%s".freeze
|
36
|
+
else "%s=\"%s\"".freeze
|
37
37
|
end
|
38
38
|
SHELL_CONDITIONAL_SET_COMMAND =
|
39
|
-
if windows? then "set %s=%s"
|
40
|
-
else "if test -z \"$%1$s\"; then\n %1$s=\"%3$s\"\
|
41
|
-
|
42
|
-
SHELL_UNSET_COMMAND =
|
43
|
-
if windows? then "unset %s"
|
44
|
-
else "unset %s"
|
39
|
+
if windows? then "set %s=%s".freeze
|
40
|
+
else "if test -z \"$%1$s\"; then\n %1$s=\"%3$s\"\n"\
|
41
|
+
"else\n %1$s=\"%2$s\"\nfi".freeze
|
45
42
|
end
|
43
|
+
SHELL_UNSET_COMMAND = "unset %s".freeze
|
46
44
|
SHELL_EXPORT_COMMAND =
|
47
|
-
if windows? then "set %s"
|
48
|
-
else "export %s"
|
45
|
+
if windows? then "set %s".freeze
|
46
|
+
else "export %s".freeze
|
49
47
|
end
|
50
48
|
SHELL_SOURCE_SCRIPT =
|
51
|
-
if windows? then "%s"
|
52
|
-
else
|
49
|
+
if windows? then "%s".freeze
|
50
|
+
else '. "%s"'.freeze
|
53
51
|
end
|
54
52
|
|
55
53
|
LIBRARY_PATH =
|
56
|
-
if macos? then 'DYLD_LIBRARY_PATH'
|
57
|
-
elsif windows? then 'PATH'
|
58
|
-
else 'LD_LIBRARY_PATH'
|
54
|
+
if macos? then 'DYLD_LIBRARY_PATH'.freeze
|
55
|
+
elsif windows? then 'PATH'.freeze
|
56
|
+
else 'LD_LIBRARY_PATH'.freeze
|
59
57
|
end
|
60
58
|
|
61
59
|
LIBRARY_SUFFIX =
|
@@ -139,17 +137,17 @@ def path_variable?(name)
|
|
139
137
|
def initialize_copy(old)
|
140
138
|
super
|
141
139
|
@inherited_environment = @inherited_environment.
|
142
|
-
map_value { |
|
140
|
+
map_value { |_k, v| v&.dup }
|
143
141
|
@environment = @environment.
|
144
|
-
map_value { |
|
142
|
+
map_value { |_k, v| v&.dup }
|
145
143
|
@source_before = Marshal.load(Marshal.dump(@source_before)) # deep copy
|
146
144
|
@source_after = Marshal.load(Marshal.dump(@source_after)) # deep copy
|
147
145
|
@inherited_variables = @inherited_variables.dup
|
148
146
|
|
149
147
|
@system_env = @system_env.
|
150
|
-
map_value { |
|
148
|
+
map_value { |_k, v| v&.dup }
|
151
149
|
@original_env = @original_env.
|
152
|
-
map_value { |
|
150
|
+
map_value { |_k, v| v&.dup }
|
153
151
|
end
|
154
152
|
|
155
153
|
def [](name)
|
@@ -266,20 +264,21 @@ def inherit(*names)
|
|
266
264
|
@inherit
|
267
265
|
end
|
268
266
|
|
269
|
-
def filter_original_env(
|
267
|
+
def filter_original_env(_name, parent_env)
|
270
268
|
parent_env.dup
|
271
269
|
end
|
272
270
|
|
273
271
|
def init_from_env(name)
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
272
|
+
inherited_environment[name] =
|
273
|
+
if inherit?(name) && (parent_env = original_env[name])
|
274
|
+
filter_original_env(name, parent_env.split(File::PATH_SEPARATOR))
|
275
|
+
else
|
276
|
+
Array.new
|
277
|
+
end
|
279
278
|
end
|
280
279
|
|
281
280
|
def push(name, *values)
|
282
|
-
if current = environment[name]
|
281
|
+
if (current = environment[name])
|
283
282
|
current = current.dup
|
284
283
|
set(name, *values)
|
285
284
|
add(name, *current)
|
@@ -292,13 +291,8 @@ def push(name, *values)
|
|
292
291
|
def add(name, *values)
|
293
292
|
values = values.map { |v| expand(v) }
|
294
293
|
|
295
|
-
set = if environment.
|
296
|
-
|
297
|
-
end
|
298
|
-
|
299
|
-
if !inherited_environment.has_key?(name)
|
300
|
-
init_from_env(name)
|
301
|
-
end
|
294
|
+
set = environment[name] if environment.key?(name)
|
295
|
+
init_from_env(name) unless inherited_environment.key?(name)
|
302
296
|
|
303
297
|
if !set
|
304
298
|
set = Array.new
|
@@ -325,12 +319,13 @@ def add(name, *values)
|
|
325
319
|
# actual value is OS-specific, and not handled by this method
|
326
320
|
def value(name, options = Hash.new)
|
327
321
|
# For backward compatibility only
|
328
|
-
|
329
|
-
|
330
|
-
options
|
331
|
-
|
332
|
-
|
333
|
-
|
322
|
+
unless options.respond_to?(:to_hash)
|
323
|
+
options =
|
324
|
+
if options
|
325
|
+
Hash[:inheritance_mode => :expand]
|
326
|
+
else
|
327
|
+
Hash[:inheritance_mode => :keep]
|
328
|
+
end
|
334
329
|
end
|
335
330
|
options = Kernel.validate_options options,
|
336
331
|
inheritance_mode: :expand
|
@@ -349,13 +344,10 @@ def value(name, options = Hash.new)
|
|
349
344
|
else []
|
350
345
|
end
|
351
346
|
|
352
|
-
|
353
347
|
value = []
|
354
348
|
[environment[name], inherited, system_env[name]].each do |paths|
|
355
349
|
(paths || []).each do |p|
|
356
|
-
|
357
|
-
value << p
|
358
|
-
end
|
350
|
+
value << p unless value.include?(p)
|
359
351
|
end
|
360
352
|
end
|
361
353
|
value
|
@@ -364,16 +356,14 @@ def value(name, options = Hash.new)
|
|
364
356
|
|
365
357
|
# Whether this object manages the given environment variable
|
366
358
|
def include?(name)
|
367
|
-
environment.
|
359
|
+
environment.key?(name)
|
368
360
|
end
|
369
361
|
|
370
362
|
def resolved_env
|
371
363
|
resolved_env = Hash.new
|
372
364
|
environment.each_key do |name|
|
373
|
-
if value = value(name)
|
374
|
-
if path_variable?(name)
|
375
|
-
value = value.find_all { |p| File.exist?(p) }
|
376
|
-
end
|
365
|
+
if (value = value(name))
|
366
|
+
value = value.find_all { |p| File.exist?(p) } if path_variable?(name)
|
377
367
|
resolved_env[name] = value.join(File::PATH_SEPARATOR)
|
378
368
|
else
|
379
369
|
resolved_env[name] = nil
|
@@ -400,15 +390,13 @@ def add_path(name, *paths)
|
|
400
390
|
paths = paths.map { |p| expand(p) }
|
401
391
|
|
402
392
|
oldpath = (environment[name] ||= Array.new)
|
403
|
-
paths.
|
393
|
+
paths.reverse_each do |path|
|
404
394
|
path = path.to_str
|
405
395
|
next if oldpath.include?(path)
|
406
396
|
|
407
397
|
add(name, path)
|
408
398
|
oldpath << path
|
409
|
-
if name == 'RUBYLIB'
|
410
|
-
$LOAD_PATH.unshift path
|
411
|
-
end
|
399
|
+
$LOAD_PATH.unshift path if name == 'RUBYLIB'
|
412
400
|
end
|
413
401
|
end
|
414
402
|
|
@@ -428,7 +416,7 @@ def remove_path(name, *paths)
|
|
428
416
|
# @see push_path
|
429
417
|
def push_path(name, *values)
|
430
418
|
declare_path_variable(name)
|
431
|
-
if current = environment.delete(name)
|
419
|
+
if (current = environment.delete(name))
|
432
420
|
current = current.dup
|
433
421
|
add_path(name, *values)
|
434
422
|
add_path(name, *current)
|
@@ -495,7 +483,10 @@ def exported_environment
|
|
495
483
|
elsif value_with_inheritance == value_without_inheritance # no inheritance
|
496
484
|
export.set[name] = value_with_inheritance
|
497
485
|
else
|
498
|
-
export.update[name] = [
|
486
|
+
export.update[name] = [
|
487
|
+
value_with_inheritance,
|
488
|
+
value_without_inheritance
|
489
|
+
]
|
499
490
|
end
|
500
491
|
end
|
501
492
|
export
|
@@ -509,21 +500,23 @@ def exported_environment
|
|
509
500
|
def export_env_sh(io, shell: 'sh')
|
510
501
|
export = exported_environment
|
511
502
|
source_before(shell: shell).each do |path|
|
512
|
-
io.puts SHELL_SOURCE_SCRIPT
|
503
|
+
io.puts format(SHELL_SOURCE_SCRIPT, path)
|
513
504
|
end
|
514
505
|
export.unset.each do |name|
|
515
|
-
io.puts SHELL_UNSET_COMMAND
|
506
|
+
io.puts format(SHELL_UNSET_COMMAND, name)
|
516
507
|
end
|
517
508
|
export.set.each do |name, value|
|
518
|
-
io.puts SHELL_SET_COMMAND
|
519
|
-
io.puts SHELL_EXPORT_COMMAND
|
509
|
+
io.puts format(SHELL_SET_COMMAND, name, value.join(File::PATH_SEPARATOR))
|
510
|
+
io.puts format(SHELL_EXPORT_COMMAND, name)
|
520
511
|
end
|
521
512
|
export.update.each do |name, (with_inheritance, without_inheritance)|
|
522
|
-
io.puts SHELL_CONDITIONAL_SET_COMMAND
|
523
|
-
|
513
|
+
io.puts format(SHELL_CONDITIONAL_SET_COMMAND, name,
|
514
|
+
with_inheritance.join(File::PATH_SEPARATOR),
|
515
|
+
without_inheritance.join(File::PATH_SEPARATOR))
|
516
|
+
io.puts format(SHELL_EXPORT_COMMAND, name)
|
524
517
|
end
|
525
518
|
source_after(shell: shell).each do |path|
|
526
|
-
io.puts SHELL_SOURCE_SCRIPT
|
519
|
+
io.puts format(SHELL_SOURCE_SCRIPT, path)
|
527
520
|
end
|
528
521
|
end
|
529
522
|
|
@@ -597,30 +590,22 @@ def each_env_search_path(prefix, patterns)
|
|
597
590
|
end
|
598
591
|
|
599
592
|
def arch_size
|
600
|
-
if @arch_size
|
601
|
-
return @arch_size
|
602
|
-
end
|
593
|
+
return @arch_size if @arch_size
|
603
594
|
|
604
595
|
if File.file?('/usr/bin/dpkg-architecture')
|
605
596
|
cmdline = ['/usr/bin/dpkg-architecture']
|
606
|
-
if target_arch
|
607
|
-
cmdline << "-T" << target_arch
|
608
|
-
end
|
597
|
+
cmdline << "-T" << target_arch if target_arch
|
609
598
|
out = `#{cmdline.join(" ")}`.split
|
610
599
|
arch = out.grep(/DEB_TARGET_ARCH_BITS/).first ||
|
611
600
|
out.grep(/DEB_BUILD_ARCH_BITS/).first
|
612
|
-
if arch
|
613
|
-
@arch_size = Integer(arch.chomp.split('=').last)
|
614
|
-
end
|
601
|
+
@arch_size = Integer(arch.chomp.split('=').last) if arch
|
615
602
|
end
|
616
603
|
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
end
|
623
|
-
end
|
604
|
+
@arch_size ||=
|
605
|
+
if RbConfig::CONFIG['host_cpu'] =~ /64/
|
606
|
+
64
|
607
|
+
else 32
|
608
|
+
end
|
624
609
|
@arch_size
|
625
610
|
end
|
626
611
|
|
@@ -632,22 +617,16 @@ def target_arch=(archname)
|
|
632
617
|
attr_reader :target_arch
|
633
618
|
|
634
619
|
def arch_names
|
635
|
-
if @arch_names
|
636
|
-
return @arch_names
|
637
|
-
end
|
620
|
+
return @arch_names if @arch_names
|
638
621
|
|
639
622
|
result = Set.new
|
640
623
|
if File.file?('/usr/bin/dpkg-architecture')
|
641
624
|
cmdline = ['/usr/bin/dpkg-architecture']
|
642
|
-
if target_arch
|
643
|
-
cmdline << "-T" << target_arch
|
644
|
-
end
|
625
|
+
cmdline << "-T" << target_arch if target_arch
|
645
626
|
out = `#{cmdline.join(" ")}`.split
|
646
627
|
arch = out.grep(/DEB_TARGET_MULTIARCH/).first ||
|
647
628
|
out.grep(/DEB_BUILD_MULTIARCH/).first
|
648
|
-
if arch
|
649
|
-
result << arch.chomp.split('=').last
|
650
|
-
end
|
629
|
+
result << arch.chomp.split('=').last if arch
|
651
630
|
end
|
652
631
|
@arch_names = result
|
653
632
|
end
|
@@ -656,13 +635,21 @@ def update_environment(newprefix, includes = nil)
|
|
656
635
|
add_prefix(newprefix, includes)
|
657
636
|
end
|
658
637
|
|
638
|
+
# rubocop:disable Metrics/LineLength
|
639
|
+
PKGCONFIG_INFO = [
|
640
|
+
%r{Scanning directory (?:#\d+ )?'(.*/)((?:lib|lib64|share)/.*)'$},
|
641
|
+
%r{Cannot open directory (?:#\d+ )?'.*/((?:lib|lib64|share)/.*)' in package search path:.*}
|
642
|
+
].freeze
|
643
|
+
# rubocop:enable Metrics/LineLength
|
644
|
+
|
659
645
|
# Returns the system-wide search path that is embedded in pkg-config
|
660
646
|
def default_pkgconfig_search_suffixes
|
661
|
-
found_path_rx =
|
662
|
-
nonexistent_path_rx =
|
647
|
+
found_path_rx = PKGCONFIG_INFO[0]
|
648
|
+
nonexistent_path_rx = PKGCONFIG_INFO[1]
|
663
649
|
|
664
|
-
|
665
|
-
|
650
|
+
unless @default_pkgconfig_search_suffixes
|
651
|
+
pkg_config = Autobuild.tool("pkg-config")
|
652
|
+
output = `LANG=C PKG_CONFIG_PATH= #{pkg_config} --debug 2>&1`.split("\n")
|
666
653
|
found_paths = output.grep(found_path_rx).
|
667
654
|
map { |l| l.gsub(found_path_rx, '\2') }.
|
668
655
|
to_set
|
@@ -671,7 +658,7 @@ def default_pkgconfig_search_suffixes
|
|
671
658
|
to_set
|
672
659
|
@default_pkgconfig_search_suffixes = found_paths | not_found
|
673
660
|
end
|
674
|
-
|
661
|
+
@default_pkgconfig_search_suffixes
|
675
662
|
end
|
676
663
|
|
677
664
|
# Updates the environment when a new prefix has been added
|
@@ -683,7 +670,8 @@ def add_prefix(newprefix, includes = nil)
|
|
683
670
|
end
|
684
671
|
|
685
672
|
if !includes || includes.include?('PKG_CONFIG_PATH')
|
686
|
-
each_env_search_path(newprefix,
|
673
|
+
each_env_search_path(newprefix,
|
674
|
+
default_pkgconfig_search_suffixes) do |path|
|
687
675
|
add_path('PKG_CONFIG_PATH', path)
|
688
676
|
end
|
689
677
|
end
|
@@ -691,24 +679,26 @@ def add_prefix(newprefix, includes = nil)
|
|
691
679
|
if !includes || includes.include?(LIBRARY_PATH)
|
692
680
|
ld_library_search = ['lib', 'lib/ARCH', 'libARCHSIZE']
|
693
681
|
each_env_search_path(newprefix, ld_library_search) do |path|
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
end
|
682
|
+
glob_path = File.join(path, "lib*.#{LIBRARY_SUFFIX}")
|
683
|
+
has_sofile = Dir.enum_for(:glob, glob_path)
|
684
|
+
.find { true }
|
685
|
+
add_path(LIBRARY_PATH, path) if has_sofile
|
699
686
|
end
|
700
687
|
end
|
701
688
|
|
702
689
|
# Validate the new rubylib path
|
703
690
|
if !includes || includes.include?('RUBYLIB')
|
704
691
|
new_rubylib = "#{newprefix}/lib"
|
705
|
-
if File.directory?(new_rubylib) && !File.directory?(File.join(new_rubylib, "ruby")) && !Dir["#{new_rubylib}/**/*.rb"].empty?
|
706
|
-
add_path('RUBYLIB', new_rubylib)
|
707
|
-
end
|
708
692
|
|
709
|
-
|
693
|
+
standalone_ruby_package =
|
694
|
+
File.directory?(new_rubylib) &&
|
695
|
+
!File.directory?(File.join(new_rubylib, "ruby")) &&
|
696
|
+
!Dir["#{new_rubylib}/**/*.rb"].empty?
|
697
|
+
add_path('RUBYLIB', new_rubylib) if standalone_ruby_package
|
698
|
+
|
699
|
+
%w[rubylibdir archdir sitelibdir sitearchdir vendorlibdir vendorarchdir].
|
710
700
|
map { |key| RbConfig::CONFIG[key] }.
|
711
|
-
map { |path| path.gsub(
|
701
|
+
map { |path| path.gsub(%r{.*lib(?:32|64)?/}, '\\1') }.
|
712
702
|
each do |subdir|
|
713
703
|
if File.directory?("#{newprefix}/lib/#{subdir}")
|
714
704
|
add_path("RUBYLIB", "#{newprefix}/lib/#{subdir}")
|
@@ -726,10 +716,8 @@ def self.find_executable_in_path(file, entries)
|
|
726
716
|
full = File.join(dir, file)
|
727
717
|
begin
|
728
718
|
stat = File.stat(full)
|
729
|
-
if stat.file? && stat.executable?
|
730
|
-
|
731
|
-
end
|
732
|
-
rescue ::Exception
|
719
|
+
return full if stat.file? && stat.executable?
|
720
|
+
rescue ::Exception # rubocop:disable Lint/HandleExceptions
|
733
721
|
end
|
734
722
|
end
|
735
723
|
nil
|
@@ -742,9 +730,7 @@ def find_in_path(file, path_var = 'PATH')
|
|
742
730
|
def self.find_in_path(file, entries)
|
743
731
|
entries.each do |dir|
|
744
732
|
full = File.join(dir, file)
|
745
|
-
if File.file?(full)
|
746
|
-
return full
|
747
|
-
end
|
733
|
+
return full if File.file?(full)
|
748
734
|
end
|
749
735
|
nil
|
750
736
|
end
|
@@ -774,7 +760,7 @@ def self.env=(env)
|
|
774
760
|
@env = nil
|
775
761
|
|
776
762
|
def self.env
|
777
|
-
|
763
|
+
unless @env
|
778
764
|
@env = Environment.new
|
779
765
|
@env.prepare
|
780
766
|
end
|
@@ -785,77 +771,95 @@ def self.env
|
|
785
771
|
def self.env_reset(name = nil)
|
786
772
|
env.reset(name)
|
787
773
|
end
|
774
|
+
|
788
775
|
# @deprecated, use the API on {env} instead
|
789
776
|
def self.env_clear(name = nil)
|
790
777
|
env.clear(name)
|
791
778
|
end
|
779
|
+
|
792
780
|
# @deprecated, use the API on {env} instead
|
793
781
|
def self.env_set(name, *values)
|
794
782
|
env.set(name, *values)
|
795
783
|
end
|
784
|
+
|
796
785
|
# @deprecated, use the API on {env} instead
|
797
786
|
def self.env_inherit?(name = nil)
|
798
787
|
env.inherit?(name)
|
799
788
|
end
|
789
|
+
|
800
790
|
# @deprecated, use the API on {env} instead
|
801
791
|
def self.env_inherit=(value)
|
802
792
|
env.inherit = value
|
803
793
|
end
|
794
|
+
|
804
795
|
# @deprecated, use the API on {env} instead
|
805
796
|
def self.env_inherit(*names)
|
806
797
|
env.inherit(*names)
|
807
798
|
end
|
799
|
+
|
808
800
|
# @deprecated, use the API on {env} instead
|
809
801
|
def self.env_init_from_env(name)
|
810
802
|
env.init_from_env(name)
|
811
803
|
end
|
804
|
+
|
812
805
|
# @deprecated, use the API on {env} instead
|
813
806
|
def self.env_push(name, *values)
|
814
807
|
env.push(name, *values)
|
815
808
|
end
|
809
|
+
|
816
810
|
# @deprecated, use the API on {env} instead
|
817
811
|
def self.env_add(name, *values)
|
818
812
|
env.add(name, *values)
|
819
813
|
end
|
814
|
+
|
820
815
|
# @deprecated, use the API on {env} instead
|
821
816
|
def self.env_value(name, options = Hash.new)
|
822
817
|
env.value(name, options)
|
823
818
|
end
|
819
|
+
|
824
820
|
# @deprecated, there is no corresponding API on the {Environment}
|
825
|
-
def self.env_update_var(name)
|
826
|
-
|
821
|
+
def self.env_update_var(name); end
|
822
|
+
|
827
823
|
# @deprecated, use the API on {env} instead
|
828
824
|
def self.env_add_path(name, *paths)
|
829
825
|
env.add_path(name, *paths)
|
830
826
|
end
|
827
|
+
|
831
828
|
# @deprecated, use the API on {env} instead
|
832
829
|
def self.env_remove_path(name, *paths)
|
833
830
|
env.remove_path(name, *paths)
|
834
831
|
end
|
832
|
+
|
835
833
|
# @deprecated, use the API on {env} instead
|
836
834
|
def self.env_push_path(name, *values)
|
837
835
|
env.push_path(name, *values)
|
838
836
|
end
|
837
|
+
|
839
838
|
# @deprecated, use the API on {env} instead
|
840
839
|
def self.env_source_file(file, shell: 'sh')
|
841
840
|
env.source_after(file, shell: shell)
|
842
841
|
end
|
842
|
+
|
843
843
|
# @deprecated, use the API on {env} instead
|
844
844
|
def self.env_source_before(file = nil, shell: 'sh')
|
845
845
|
env.source_before(file, shell: shell)
|
846
846
|
end
|
847
|
+
|
847
848
|
# @deprecated, use the API on {env} instead
|
848
849
|
def self.env_source_after(file = nil, shell: 'sh')
|
849
850
|
env.source_after(file, shell: shell)
|
850
851
|
end
|
852
|
+
|
851
853
|
# @deprecated, use the API on {env} instead
|
852
854
|
def self.export_env_sh(io)
|
853
855
|
env.export_env_sh(io)
|
854
856
|
end
|
857
|
+
|
855
858
|
# @deprecated, use the API on {env} instead
|
856
859
|
def self.each_env_search_path(prefix, patterns)
|
857
860
|
env.each_env_search_path(prefix, patterns)
|
858
861
|
end
|
862
|
+
|
859
863
|
# @deprecated, use the API on {env} instead
|
860
864
|
def self.update_environment(newprefix, includes = nil)
|
861
865
|
env.update_environment(newprefix, includes)
|
@@ -872,12 +876,14 @@ def self.pathvar(path, varname)
|
|
872
876
|
end
|
873
877
|
|
874
878
|
def self.arch_size
|
875
|
-
Autobuild.warn 'Autobuild.arch_size is deprecated,
|
879
|
+
Autobuild.warn 'Autobuild.arch_size is deprecated, "\
|
880
|
+
"use Autobuild.env.arch_size instead'
|
876
881
|
env.arch_size
|
877
882
|
end
|
878
883
|
|
879
884
|
def self.arch_names
|
880
|
-
Autobuild.warn 'Autobuild.arch_names is deprecated,
|
885
|
+
Autobuild.warn 'Autobuild.arch_names is deprecated, "\
|
886
|
+
"use Autobuild.env.arch_names instead'
|
881
887
|
env.arch_names
|
882
888
|
end
|
883
889
|
end
|