autobuild 1.10.0.rc7 → 1.10.0.rc8
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/lib/autobuild/environment.rb +52 -23
- 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: 66eb9435988ecd0bf116690efcca5943b996d2fa
|
|
4
|
+
data.tar.gz: 33c3da76765caf1ab4ac5b5001523fef0d30bbe7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c42f5a0c818d221bde6524617512d161919e22820ca880cf8f9b7bcc8e204723de9790e0ab643797c8a50fd7a50cfae26559eeab7b9d8935d2db743a21ca720a
|
|
7
|
+
data.tar.gz: 54f6c80e82710be6a64bd402ce22a4a551707d5e75ef98ec5867c1fe9785e7deff7ab46eaf9d2992f3cd356ec69f852333d60c0d9cbf9df84e0c2d862f848c47
|
|
@@ -95,10 +95,15 @@ class Environment
|
|
|
95
95
|
|
|
96
96
|
attr_reader :inherited_variables
|
|
97
97
|
|
|
98
|
-
attr_reader :resolved_env
|
|
99
98
|
attr_reader :system_env
|
|
100
99
|
attr_reader :original_env
|
|
101
100
|
|
|
101
|
+
# The set of environment variables that are known to hold paths on the
|
|
102
|
+
# filesystem
|
|
103
|
+
#
|
|
104
|
+
# @see declare_path_variable
|
|
105
|
+
attr_reader :path_variables
|
|
106
|
+
|
|
102
107
|
def initialize
|
|
103
108
|
@inherited_environment = Hash.new
|
|
104
109
|
@environment = Hash.new
|
|
@@ -106,13 +111,26 @@ def initialize
|
|
|
106
111
|
@source_after = Set.new
|
|
107
112
|
@inherit = true
|
|
108
113
|
@inherited_variables = Set.new
|
|
114
|
+
@path_variables = Set.new
|
|
109
115
|
|
|
110
116
|
@system_env = Hash.new
|
|
111
117
|
@original_env = ORIGINAL_ENV.dup
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Declares that the given environment variable holds a path
|
|
121
|
+
#
|
|
122
|
+
# Non-existent paths in these variables are filtered out. It is called
|
|
123
|
+
# automatically if one of the 'path' methods are called ({#set_path},
|
|
124
|
+
# {#push_path}, ...)
|
|
125
|
+
#
|
|
126
|
+
# @param [String] name
|
|
127
|
+
def declare_path_variable(name)
|
|
128
|
+
path_variables << name
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Whether the given environment variable contains path(s)
|
|
132
|
+
def path_variable?(name)
|
|
133
|
+
path_variables.include?(name)
|
|
116
134
|
end
|
|
117
135
|
|
|
118
136
|
def initialize_copy(old)
|
|
@@ -129,8 +147,6 @@ def initialize_copy(old)
|
|
|
129
147
|
map_value { |k, v| v.dup if v }
|
|
130
148
|
@original_env = @original_env.
|
|
131
149
|
map_value { |k, v| v.dup if v }
|
|
132
|
-
@resolved_env = @resolved_env.
|
|
133
|
-
map_value { |k, v| v.dup if v }
|
|
134
150
|
end
|
|
135
151
|
|
|
136
152
|
def [](name)
|
|
@@ -162,7 +178,6 @@ def clear(name = nil)
|
|
|
162
178
|
if name
|
|
163
179
|
environment[name] = nil
|
|
164
180
|
inherited_environment[name] = nil
|
|
165
|
-
update_var(name)
|
|
166
181
|
else
|
|
167
182
|
environment.keys.each do |env_key|
|
|
168
183
|
clear(env_key)
|
|
@@ -258,7 +273,6 @@ def init_from_env(name)
|
|
|
258
273
|
else
|
|
259
274
|
inherited_environment[name] = Array.new
|
|
260
275
|
end
|
|
261
|
-
update_var(name)
|
|
262
276
|
end
|
|
263
277
|
|
|
264
278
|
def push(name, *values)
|
|
@@ -291,7 +305,6 @@ def add(name, *values)
|
|
|
291
305
|
|
|
292
306
|
values.concat(set)
|
|
293
307
|
@environment[name] = values
|
|
294
|
-
update_var(name)
|
|
295
308
|
end
|
|
296
309
|
|
|
297
310
|
# Returns an environment variable value
|
|
@@ -351,24 +364,29 @@ def include?(name)
|
|
|
351
364
|
environment.has_key?(name)
|
|
352
365
|
end
|
|
353
366
|
|
|
354
|
-
def
|
|
355
|
-
|
|
367
|
+
def resolved_env
|
|
368
|
+
resolved_env = Hash.new
|
|
369
|
+
environment.each_key do |name|
|
|
356
370
|
if value = value(name)
|
|
371
|
+
if path_variable?(name)
|
|
372
|
+
value = value.find_all { |p| File.exist?(p) }
|
|
373
|
+
end
|
|
357
374
|
resolved_env[name] = value.join(File::PATH_SEPARATOR)
|
|
358
375
|
else
|
|
359
376
|
resolved_env[name] = nil
|
|
360
377
|
end
|
|
361
|
-
else
|
|
362
|
-
resolved_env.delete(name)
|
|
363
378
|
end
|
|
379
|
+
resolved_env
|
|
364
380
|
end
|
|
365
381
|
|
|
366
382
|
def set_path(name, *paths)
|
|
383
|
+
declare_path_variable(name)
|
|
367
384
|
clear(name)
|
|
368
385
|
add_path(name, *paths)
|
|
369
386
|
end
|
|
370
387
|
|
|
371
388
|
def add_path(name, *paths)
|
|
389
|
+
declare_path_variable(name)
|
|
372
390
|
paths = paths.map { |p| expand(p) }
|
|
373
391
|
|
|
374
392
|
oldpath = (environment[name] ||= Array.new)
|
|
@@ -385,13 +403,14 @@ def add_path(name, *paths)
|
|
|
385
403
|
end
|
|
386
404
|
|
|
387
405
|
def remove_path(name, *paths)
|
|
406
|
+
declare_path_variable(name)
|
|
388
407
|
paths.each do |p|
|
|
389
408
|
environment[name].delete(p)
|
|
390
409
|
end
|
|
391
|
-
update_var(name)
|
|
392
410
|
end
|
|
393
411
|
|
|
394
412
|
def push_path(name, *values)
|
|
413
|
+
declare_path_variable(name)
|
|
395
414
|
if current = environment.delete(name)
|
|
396
415
|
current = current.dup
|
|
397
416
|
add_path(name, *values)
|
|
@@ -443,10 +462,15 @@ def export_env_sh(io)
|
|
|
443
462
|
|
|
444
463
|
unset_variables = Set.new
|
|
445
464
|
variables = []
|
|
446
|
-
environment.
|
|
465
|
+
environment.each_key do |name|
|
|
447
466
|
variables << name
|
|
448
|
-
value_with_inheritance
|
|
467
|
+
value_with_inheritance = value(name, inheritance_mode: :keep)
|
|
449
468
|
value_without_inheritance = value(name, inheritance_mode: :ignore)
|
|
469
|
+
if path_variable?(name)
|
|
470
|
+
[value_with_inheritance, value_without_inheritance].each do |paths|
|
|
471
|
+
paths.delete_if { |p| !File.exist?(p) }
|
|
472
|
+
end
|
|
473
|
+
end
|
|
450
474
|
|
|
451
475
|
if !value_with_inheritance
|
|
452
476
|
unset_variables << name
|
|
@@ -515,7 +539,9 @@ def arch_size
|
|
|
515
539
|
if target_arch
|
|
516
540
|
cmdline << "-T" << target_arch
|
|
517
541
|
end
|
|
518
|
-
|
|
542
|
+
out = `#{cmdline.join(" ")}`.split
|
|
543
|
+
arch = out.grep(/DEB_TARGET_ARCH_BITS/).first ||
|
|
544
|
+
out.grep(/DEB_BUILD_ARCH_BITS/).first
|
|
519
545
|
if arch
|
|
520
546
|
@arch_size = Integer(arch.chomp.split('=').last)
|
|
521
547
|
end
|
|
@@ -551,7 +577,9 @@ def arch_names
|
|
|
551
577
|
if target_arch
|
|
552
578
|
cmdline << "-T" << target_arch
|
|
553
579
|
end
|
|
554
|
-
|
|
580
|
+
out = `#{cmdline.join(" ")}`.split
|
|
581
|
+
arch = out.grep(/DEB_TARGET_MULTIARCH/).first ||
|
|
582
|
+
out.grep(/DEB_BUILD_MULTIARCH/).first
|
|
555
583
|
if arch
|
|
556
584
|
result << arch.chomp.split('=').last
|
|
557
585
|
end
|
|
@@ -598,7 +626,9 @@ def add_prefix(newprefix, includes = nil)
|
|
|
598
626
|
if !includes || includes.include?(LIBRARY_PATH)
|
|
599
627
|
ld_library_search = ['lib', 'lib/ARCH', 'libARCHSIZE']
|
|
600
628
|
each_env_search_path(newprefix, ld_library_search) do |path|
|
|
601
|
-
|
|
629
|
+
has_sofile = Dir.enum_for(:glob, File.join(path, "lib*.#{LIBRARY_SUFFIX}")).
|
|
630
|
+
find { true }
|
|
631
|
+
if has_sofile
|
|
602
632
|
add_path(LIBRARY_PATH, path)
|
|
603
633
|
end
|
|
604
634
|
end
|
|
@@ -639,7 +669,7 @@ def isolate
|
|
|
639
669
|
def prepare
|
|
640
670
|
# Set up some important autobuild parameters
|
|
641
671
|
inherit 'PATH', 'PKG_CONFIG_PATH', 'RUBYLIB', \
|
|
642
|
-
|
|
672
|
+
LIBRARY_PATH, 'CMAKE_PREFIX_PATH', 'PYTHONPATH'
|
|
643
673
|
end
|
|
644
674
|
|
|
645
675
|
# Method called to filter the environment variables before they are set,
|
|
@@ -701,9 +731,8 @@ def self.env_add(name, *values)
|
|
|
701
731
|
def self.env_value(name, options = Hash.new)
|
|
702
732
|
env.value(name, options)
|
|
703
733
|
end
|
|
704
|
-
# @deprecated,
|
|
734
|
+
# @deprecated, there is no corresponding API on the {Environment}
|
|
705
735
|
def self.env_update_var(name)
|
|
706
|
-
env.update_var(name)
|
|
707
736
|
end
|
|
708
737
|
# @deprecated, use the API on {env} instead
|
|
709
738
|
def self.env_add_path(name, *paths)
|
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.10.0.
|
|
4
|
+
version: 1.10.0.rc8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sylvain Joyeux
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-05-
|
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|