autoproj 1.13.7 → 2.0.0.b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemtest +0 -0
- data/Manifest.txt +27 -21
- data/Rakefile +4 -6
- data/bin/alocate +5 -1
- data/bin/amake +3 -53
- data/bin/aup +3 -50
- data/bin/autoproj +3 -264
- data/bin/autoproj_bootstrap +294 -349
- data/bin/autoproj_bootstrap.in +27 -3
- data/lib/autoproj.rb +23 -1
- data/lib/autoproj/autobuild.rb +51 -89
- data/lib/autoproj/base.rb +0 -9
- data/lib/autoproj/build_option.rb +1 -3
- data/lib/autoproj/cli.rb +1 -0
- data/lib/autoproj/cli/base.rb +155 -0
- data/lib/autoproj/cli/bootstrap.rb +119 -0
- data/lib/autoproj/cli/build.rb +72 -0
- data/lib/autoproj/cli/cache.rb +31 -0
- data/lib/autoproj/cli/clean.rb +37 -0
- data/lib/autoproj/cli/commit.rb +41 -0
- data/lib/autoproj/cli/doc.rb +22 -0
- data/lib/autoproj/cli/envsh.rb +22 -0
- data/lib/autoproj/cli/inspection_tool.rb +73 -0
- data/lib/autoproj/cli/locate.rb +96 -0
- data/lib/autoproj/cli/log.rb +26 -0
- data/lib/autoproj/cli/main.rb +249 -0
- data/lib/autoproj/cli/main_test.rb +57 -0
- data/lib/autoproj/cli/osdeps.rb +30 -0
- data/lib/autoproj/cli/query.rb +43 -0
- data/lib/autoproj/cli/reconfigure.rb +19 -0
- data/lib/autoproj/cli/reset.rb +7 -32
- data/lib/autoproj/cli/show.rb +219 -0
- data/lib/autoproj/cli/snapshot.rb +1 -1
- data/lib/autoproj/cli/status.rb +149 -0
- data/lib/autoproj/cli/switch_config.rb +28 -0
- data/lib/autoproj/cli/tag.rb +9 -35
- data/lib/autoproj/cli/test.rb +34 -55
- data/lib/autoproj/cli/update.rb +158 -0
- data/lib/autoproj/cli/versions.rb +32 -69
- data/lib/autoproj/configuration.rb +95 -34
- data/lib/autoproj/default.osdeps +25 -35
- data/lib/autoproj/environment.rb +85 -63
- data/lib/autoproj/exceptions.rb +50 -0
- data/lib/autoproj/gitorious.rb +11 -9
- data/lib/autoproj/manifest.rb +199 -231
- data/lib/autoproj/metapackage.rb +0 -8
- data/lib/autoproj/ops/build.rb +1 -17
- data/lib/autoproj/ops/configuration.rb +92 -90
- data/lib/autoproj/ops/import.rb +222 -0
- data/lib/autoproj/ops/loader.rb +18 -8
- data/lib/autoproj/ops/main_config_switcher.rb +45 -73
- data/lib/autoproj/ops/snapshot.rb +5 -10
- data/lib/autoproj/ops/tools.rb +10 -44
- data/lib/autoproj/options.rb +35 -6
- data/lib/autoproj/osdeps.rb +97 -68
- data/lib/autoproj/package_selection.rb +39 -20
- data/lib/autoproj/package_set.rb +26 -24
- data/lib/autoproj/reporter.rb +91 -0
- data/lib/autoproj/system.rb +50 -149
- data/lib/autoproj/variable_expansion.rb +32 -6
- data/lib/autoproj/vcs_definition.rb +57 -17
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +550 -0
- data/test/ops/test_snapshot.rb +26 -0
- data/test/test_package.rb +30 -0
- data/test/test_vcs_definition.rb +46 -0
- metadata +55 -50
- data/bin/autolocate +0 -3
- data/bin/autoproj-bootstrap +0 -68
- data/bin/autoproj-cache +0 -18
- data/bin/autoproj-clean +0 -13
- data/bin/autoproj-commit +0 -10
- data/bin/autoproj-create-set +0 -118
- data/bin/autoproj-doc +0 -28
- data/bin/autoproj-envsh +0 -14
- data/bin/autoproj-list +0 -69
- data/bin/autoproj-locate +0 -85
- data/bin/autoproj-log +0 -5
- data/bin/autoproj-query +0 -82
- data/bin/autoproj-reset +0 -13
- data/bin/autoproj-show +0 -192
- data/bin/autoproj-snapshot +0 -27
- data/bin/autoproj-switch-config +0 -24
- data/bin/autoproj-tag +0 -13
- data/bin/autoproj-test +0 -31
- data/bin/autoproj-versions +0 -20
- data/bin/autoproj_stress_test +0 -40
- data/lib/autoproj/cmdline.rb +0 -1649
data/lib/autoproj/package_set.rb
CHANGED
@@ -171,7 +171,7 @@ module Autoproj
|
|
171
171
|
if vcs.local?
|
172
172
|
File.expand_path(vcs.url)
|
173
173
|
else
|
174
|
-
File.expand_path(File.join(Autoproj.remotes_dir, vcs.create_autobuild_importer.repository_id.gsub(/[^\w]/, '_')))
|
174
|
+
File.expand_path(File.join(Autoproj.workspace.remotes_dir, vcs.create_autobuild_importer.repository_id.gsub(/[^\w]/, '_')))
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -182,7 +182,7 @@ module Autoproj
|
|
182
182
|
# returns the corresponding VCSDefinition object
|
183
183
|
def self.resolve_definition(manifest, raw_spec)
|
184
184
|
if raw_spec.respond_to?(:to_str)
|
185
|
-
local_path = File.join(Autoproj.config_dir, raw_spec)
|
185
|
+
local_path = File.join(Autoproj.workspace.config_dir, raw_spec)
|
186
186
|
if File.directory?(local_path)
|
187
187
|
raw_spec = { :type => 'local', :url => local_path }
|
188
188
|
end
|
@@ -194,7 +194,7 @@ module Autoproj
|
|
194
194
|
# either vcs_type:url or just url. In the latter case, we expect
|
195
195
|
# 'url' to be a path to a local directory
|
196
196
|
vcs_spec = Autoproj.expand(vcs_spec, manifest.constant_definitions)
|
197
|
-
return VCSDefinition.from_raw(vcs_spec, [[nil, raw_spec]]), options
|
197
|
+
return VCSDefinition.from_raw(vcs_spec, raw: [[nil, raw_spec]]), options
|
198
198
|
end
|
199
199
|
|
200
200
|
# Returns a string that uniquely represents the version control
|
@@ -238,7 +238,7 @@ module Autoproj
|
|
238
238
|
if local?
|
239
239
|
return vcs.url
|
240
240
|
else
|
241
|
-
File.join(Autoproj.config_dir, 'remotes', name)
|
241
|
+
File.join(Autoproj.workspace.config_dir, 'remotes', name)
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
@@ -464,7 +464,7 @@ module Autoproj
|
|
464
464
|
name_match = Regexp.new("^" + name_match)
|
465
465
|
end
|
466
466
|
if name_match === package_name
|
467
|
-
raw << [self
|
467
|
+
raw << [self, spec]
|
468
468
|
vcs_spec =
|
469
469
|
begin
|
470
470
|
VCSDefinition.update_raw_vcs_spec(vcs_spec, spec)
|
@@ -478,8 +478,8 @@ module Autoproj
|
|
478
478
|
if !vcs_spec.empty?
|
479
479
|
expansions = Hash["PACKAGE" => package_name,
|
480
480
|
"PACKAGE_BASENAME" => File.basename(package_name),
|
481
|
-
"AUTOPROJ_ROOT" => Autoproj.root_dir,
|
482
|
-
"AUTOPROJ_CONFIG" => Autoproj.config_dir,
|
481
|
+
"AUTOPROJ_ROOT" => Autoproj.workspace.root_dir,
|
482
|
+
"AUTOPROJ_CONFIG" => Autoproj.workspace.config_dir,
|
483
483
|
"AUTOPROJ_SOURCE_DIR" => local_dir]
|
484
484
|
|
485
485
|
vcs_spec = expand(vcs_spec, expansions)
|
@@ -510,7 +510,7 @@ module Autoproj
|
|
510
510
|
Autoproj.in_file source_file do
|
511
511
|
vcs_spec, raw = version_control_field(package_name, 'version_control')
|
512
512
|
if vcs_spec
|
513
|
-
VCSDefinition.from_raw(vcs_spec, raw)
|
513
|
+
VCSDefinition.from_raw(vcs_spec, raw: raw, from: self)
|
514
514
|
end
|
515
515
|
end
|
516
516
|
end
|
@@ -524,13 +524,14 @@ module Autoproj
|
|
524
524
|
overrides.each do |file, override|
|
525
525
|
new_spec, new_raw_entry =
|
526
526
|
Autoproj.in_file file do
|
527
|
-
vcs_field(Hash['overrides' => override],
|
527
|
+
vcs_field(Hash['overrides' => override],
|
528
|
+
package_name, 'overrides', false)
|
528
529
|
end
|
529
530
|
|
530
531
|
if new_spec
|
531
532
|
Autoproj.in_file file do
|
532
533
|
begin
|
533
|
-
vcs = vcs.update(new_spec, new_raw_entry)
|
534
|
+
vcs = vcs.update(new_spec, raw: new_raw_entry, from: self)
|
534
535
|
rescue ConfigError => e
|
535
536
|
raise ConfigError.new, "invalid resulting VCS specification in the overrides section for package #{package_name}: #{e.message}"
|
536
537
|
end
|
@@ -565,21 +566,18 @@ module Autoproj
|
|
565
566
|
|
566
567
|
# Specialization of the PackageSet class for the overrides listed in autoproj/
|
567
568
|
class LocalPackageSet < PackageSet
|
568
|
-
def initialize(manifest
|
569
|
-
|
570
|
-
if Autoproj.has_config_key?('manifest_source')
|
571
|
-
vcs = VCSDefinition.from_raw(Autoproj.user_config('manifest_source'))
|
572
|
-
else
|
573
|
-
vcs = VCSDefinition.from_raw(:type => 'local', :url => Autoproj.config_dir)
|
574
|
-
end
|
575
|
-
end
|
576
|
-
super(manifest, vcs)
|
569
|
+
def initialize(manifest)
|
570
|
+
super(manifest, manifest.vcs)
|
577
571
|
end
|
578
572
|
|
579
573
|
def name
|
580
574
|
'main configuration'
|
581
575
|
end
|
582
576
|
|
577
|
+
def vcs
|
578
|
+
manifest.vcs
|
579
|
+
end
|
580
|
+
|
583
581
|
def main?
|
584
582
|
true
|
585
583
|
end
|
@@ -589,19 +587,23 @@ module Autoproj
|
|
589
587
|
end
|
590
588
|
|
591
589
|
def local_dir
|
592
|
-
|
590
|
+
if manifest.file
|
591
|
+
File.dirname(manifest.file)
|
592
|
+
end
|
593
593
|
end
|
594
594
|
|
595
595
|
def raw_local_dir
|
596
|
-
|
596
|
+
local_dir
|
597
597
|
end
|
598
598
|
|
599
599
|
def manifest_path
|
600
|
-
|
600
|
+
manifest.file
|
601
601
|
end
|
602
602
|
|
603
603
|
def overrides_file_path
|
604
|
-
|
604
|
+
if d = local_dir
|
605
|
+
File.join(d, "overrides.yml")
|
606
|
+
end
|
605
607
|
end
|
606
608
|
|
607
609
|
def source_file
|
@@ -621,7 +623,7 @@ module Autoproj
|
|
621
623
|
end
|
622
624
|
|
623
625
|
def load_overrides
|
624
|
-
files = Dir.glob(File.join( Autoproj.overrides_dir, "*.yml" ) ).sort
|
626
|
+
files = Dir.glob(File.join( Autoproj.workspace.overrides_dir, "*.yml" ) ).sort
|
625
627
|
overrides = files.map do |file|
|
626
628
|
source_data = Autoproj.in_file(file, Autoproj::YAML_LOAD_ERROR) do
|
627
629
|
YAML.load(File.read(file)) || Array.new
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'autobuild/reporting'
|
2
|
+
module Autoproj
|
3
|
+
class << self
|
4
|
+
attr_accessor :verbose
|
5
|
+
attr_reader :console
|
6
|
+
def silent?
|
7
|
+
Autobuild.silent?
|
8
|
+
end
|
9
|
+
def silent=(value)
|
10
|
+
Autobuild.silent = value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
@verbose = false
|
14
|
+
@console = HighLine.new
|
15
|
+
|
16
|
+
|
17
|
+
def self.silent(&block)
|
18
|
+
Autobuild.silent(&block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.message(*args)
|
22
|
+
Autobuild.message(*args)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.color(*args)
|
26
|
+
Autobuild.color(*args)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Displays an error message
|
30
|
+
def self.error(message)
|
31
|
+
Autobuild.error(message)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Displays a warning message
|
35
|
+
def self.warn(message, *style)
|
36
|
+
Autobuild.warn(message, *style)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Subclass of Autobuild::Reporter, used to display a message when the build
|
40
|
+
# finishes/fails.
|
41
|
+
class Reporter < Autobuild::Reporter
|
42
|
+
def error(error)
|
43
|
+
error_lines = error.to_s.split("\n")
|
44
|
+
Autoproj.message("Command failed", :bold, :red, STDERR)
|
45
|
+
Autoproj.message("#{error_lines.shift}", :bold, :red, STDERR)
|
46
|
+
error_lines.each do |line|
|
47
|
+
Autoproj.message line, STDERR
|
48
|
+
end
|
49
|
+
end
|
50
|
+
def success
|
51
|
+
Autoproj.message("Command finished successfully at #{Time.now}", :bold, :green)
|
52
|
+
if Autobuild.post_success_message
|
53
|
+
Autoproj.message Autobuild.post_success_message
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.report(options = Hash.new)
|
59
|
+
options = Kernel.validate_options options,
|
60
|
+
root_dir: nil,
|
61
|
+
silent: false
|
62
|
+
|
63
|
+
Autobuild::Reporting.report do
|
64
|
+
yield
|
65
|
+
end
|
66
|
+
if !options[:silent]
|
67
|
+
Autobuild::Reporting.success
|
68
|
+
end
|
69
|
+
|
70
|
+
rescue Interrupt
|
71
|
+
STDERR.puts
|
72
|
+
STDERR.puts Autobuild.color("Interrupted by user", :red, :bold)
|
73
|
+
if Autobuild.debug then raise
|
74
|
+
else exit 1
|
75
|
+
end
|
76
|
+
rescue Exception => e
|
77
|
+
STDERR.puts
|
78
|
+
STDERR.puts Autobuild.color(e.message, :red, :bold)
|
79
|
+
if root_dir = options[:root_dir]
|
80
|
+
root_dir = /#{Regexp.quote(root_dir)}(?!\/\.gems)/
|
81
|
+
e.backtrace.find_all { |path| path =~ root_dir }.
|
82
|
+
each do |path|
|
83
|
+
STDERR.puts Autobuild.color(" in #{path}", :red, :bold)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
if Autobuild.debug then raise
|
87
|
+
else exit 1
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
data/lib/autoproj/system.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
module Autoproj
|
2
|
-
class UserError < RuntimeError; end
|
3
|
-
|
4
2
|
# OS-independent creation of symbolic links. Note that on windows, it only
|
5
3
|
# works for directories
|
6
4
|
def self.create_symlink(from, to)
|
@@ -24,6 +22,9 @@ module Autoproj
|
|
24
22
|
# This is mostly useful during bootstrapping (i.e. when the search would
|
25
23
|
# fail)
|
26
24
|
def self.root_dir=(dir)
|
25
|
+
if @workspace && dir != @workspace.root_dir
|
26
|
+
raise WorkspaceAlreadyCreated, "cannot switch global root directory after a workspace object got created"
|
27
|
+
end
|
27
28
|
@root_dir = dir
|
28
29
|
end
|
29
30
|
|
@@ -35,90 +36,77 @@ module Autoproj
|
|
35
36
|
if @root_dir
|
36
37
|
return @root_dir
|
37
38
|
end
|
38
|
-
|
39
|
-
path
|
40
|
-
while !path.root?
|
41
|
-
if (path + "autoproj" + 'manifest').file?
|
42
|
-
break
|
43
|
-
end
|
44
|
-
path = path.parent
|
45
|
-
end
|
46
|
-
|
47
|
-
if path.root?
|
39
|
+
path = Workspace.find_root_dir(dir)
|
40
|
+
if !path
|
48
41
|
raise UserError, "not in a Autoproj installation"
|
49
42
|
end
|
50
|
-
|
51
|
-
result = path.to_s
|
52
|
-
# I don't know if this is still useful or not ... but it does not hurt
|
53
|
-
#
|
54
|
-
# Preventing backslashed in path, that might be confusing on some path compares
|
55
|
-
if Autobuild.windows?
|
56
|
-
result = result.gsub(/\\/,'/')
|
57
|
-
end
|
58
|
-
result
|
43
|
+
path
|
59
44
|
end
|
60
45
|
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# If the current directory is not in an autoproj installation,
|
64
|
-
# raises UserError.
|
46
|
+
# @deprecated use workspace.config_dir instead
|
65
47
|
def self.config_dir
|
66
|
-
|
48
|
+
Autoproj.warn "#{__method__} is deprecated, use workspace.config_dir instead"
|
49
|
+
caller.each { |l| Autoproj.warn " #{l}" }
|
50
|
+
workspace.config_dir
|
67
51
|
end
|
68
|
-
|
69
|
-
OVERRIDES_DIR = "overrides.d"
|
70
|
-
|
71
|
-
# Returns the directory containing overrides files
|
72
|
-
#
|
73
|
-
# If the current directory is not in an autoproj installation,
|
74
|
-
# raises UserError.
|
52
|
+
# @deprecated use workspace.overrides_dir instead
|
75
53
|
def self.overrides_dir
|
76
|
-
|
54
|
+
Autoproj.warn "#{__method__} is deprecated, use workspace.overrides_dir instead"
|
55
|
+
caller.each { |l| Autoproj.warn " #{l}" }
|
56
|
+
workspace.overrides_dir
|
77
57
|
end
|
78
|
-
|
79
58
|
# @deprecated use Autobuild.find_in_path instead
|
80
59
|
#
|
81
60
|
# Warning: the autobuild method returns nil (instead of raising) if the
|
82
61
|
# argument cannot be found
|
83
62
|
def self.find_in_path(name)
|
63
|
+
Autoproj.warn "#{__method__} is deprecated, use Autobuild.find_in_path instead"
|
64
|
+
caller.each { |l| Autoproj.warn " #{l}" }
|
84
65
|
if path = Autobuild.find_in_path(name)
|
85
66
|
return path
|
86
67
|
else raise ArgumentError, "cannot find #{name} in PATH (#{ENV['PATH']})"
|
87
68
|
end
|
88
69
|
end
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
# If it is a relative path, it is relative to the root dir of the
|
94
|
-
# installation.
|
95
|
-
#
|
96
|
-
# The default is "install"
|
97
|
-
attr_reader :prefix
|
98
|
-
|
99
|
-
# Change the value of 'prefix'
|
100
|
-
def prefix=(new_path)
|
101
|
-
@prefix = new_path
|
102
|
-
Autoproj.change_option('prefix', new_path, true)
|
103
|
-
end
|
70
|
+
# @deprecated use workspace.prefix_dir instead
|
71
|
+
def self.prefix
|
72
|
+
Autoproj.warn_deprecated(__method__, 'workspace.prefix_dir')
|
73
|
+
workspace.prefix_dir
|
104
74
|
end
|
105
|
-
@
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
#
|
75
|
+
# @deprecated use workspace.prefix_dir= instead
|
76
|
+
def self.prefix=(path)
|
77
|
+
Autoproj.warn_deprecated(__method__, 'workspace.prefix_dir=')
|
78
|
+
workspace.prefix_dir = path
|
79
|
+
end
|
80
|
+
# @deprecated use workspace.prefix_dir instead
|
111
81
|
def self.build_dir
|
112
|
-
|
82
|
+
Autoproj.warn_deprecated(__method__, 'workspace.prefix_dir')
|
83
|
+
workspace.prefix_dir
|
113
84
|
end
|
114
|
-
|
115
|
-
#
|
116
|
-
#
|
117
|
-
# If the current directory is not in an autoproj installation, raises
|
118
|
-
# UserError.
|
85
|
+
# @deprecated compute the full path with File.join(config_dir, file)
|
86
|
+
# directly instead
|
119
87
|
def self.config_file(file)
|
88
|
+
Autoproj.warn_deprecated(__method__, 'compute the full path with File.join(config_dir, ...) instead')
|
120
89
|
File.join(config_dir, file)
|
121
90
|
end
|
91
|
+
# @deprecated use workspace.remotes_dir instead
|
92
|
+
def self.remotes_dir
|
93
|
+
Autoproj.warn_deprecated(__method__, 'use workspace.remotes_dir instead')
|
94
|
+
workspace.remotes_dir
|
95
|
+
end
|
96
|
+
# @deprecated use workspace.load or add a separate Loader object to your class
|
97
|
+
def self.load(package_set, *path)
|
98
|
+
Autoproj.warn_deprecated(
|
99
|
+
__method__,
|
100
|
+
'use workspace.load or add a separate Loader object to your class')
|
101
|
+
workspace.load(package_set, *path)
|
102
|
+
end
|
103
|
+
# @deprecated use workspace.load_if_present or add a separate Loader object to your class
|
104
|
+
def self.load_if_present(package_set, *path)
|
105
|
+
Autoproj.warn_deprecated(
|
106
|
+
__method__,
|
107
|
+
'use workspace.load_if_present or add a separate Loader object to your class')
|
108
|
+
workspace.load_if_present(package_set, *path)
|
109
|
+
end
|
122
110
|
|
123
111
|
# Run the provided command as user
|
124
112
|
def self.run_as_user(*args)
|
@@ -126,7 +114,6 @@ module Autoproj
|
|
126
114
|
raise "failed to run #{args.join(" ")}"
|
127
115
|
end
|
128
116
|
end
|
129
|
-
|
130
117
|
# Run the provided command as root, using sudo to gain root access
|
131
118
|
def self.run_as_root(*args)
|
132
119
|
if !system(Autobuild.tool_in_path('sudo'), *args)
|
@@ -134,92 +121,6 @@ module Autoproj
|
|
134
121
|
end
|
135
122
|
end
|
136
123
|
|
137
|
-
# Return the directory in which remote package set definition should be
|
138
|
-
# checked out
|
139
|
-
def self.remotes_dir
|
140
|
-
File.join(root_dir, ".remotes")
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
def self.env_inherit(*names)
|
145
|
-
Autobuild.env_inherit(*names)
|
146
|
-
end
|
147
|
-
|
148
|
-
# @deprecated use isolate_environment instead
|
149
|
-
def self.set_initial_env
|
150
|
-
isolate_environment
|
151
|
-
end
|
152
|
-
|
153
|
-
# Initializes the environment variables to a "sane default"
|
154
|
-
#
|
155
|
-
# Use this in autoproj/init.rb to make sure that the environment will not
|
156
|
-
# get polluted during the build.
|
157
|
-
def self.isolate_environment
|
158
|
-
Autobuild.env_inherit = false
|
159
|
-
Autobuild.env_push_path 'PATH', "/usr/local/bin", "/usr/bin", "/bin"
|
160
|
-
end
|
161
|
-
|
162
|
-
def self.prepare_environment
|
163
|
-
# Set up some important autobuild parameters
|
164
|
-
env_inherit 'PATH', 'PKG_CONFIG_PATH', 'RUBYLIB', \
|
165
|
-
'LD_LIBRARY_PATH', 'CMAKE_PREFIX_PATH', 'PYTHONPATH'
|
166
|
-
|
167
|
-
env_set 'AUTOPROJ_CURRENT_ROOT', Autoproj.root_dir
|
168
|
-
env_set 'RUBYOPT', "-rubygems"
|
169
|
-
Autoproj::OSDependencies::PACKAGE_HANDLERS.each do |pkg_mng|
|
170
|
-
pkg_mng.initialize_environment
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
class << self
|
175
|
-
attr_writer :shell_helpers
|
176
|
-
def shell_helpers?; !!@shell_helpers end
|
177
|
-
end
|
178
|
-
@shell_helpers = true
|
179
|
-
|
180
|
-
# Create the env.sh script in +subdir+. In general, +subdir+ should be nil.
|
181
|
-
def self.export_env_sh(subdir = nil)
|
182
|
-
# Make sure that we have as much environment as possible
|
183
|
-
Autoproj::CmdLine.update_environment
|
184
|
-
|
185
|
-
filename = if subdir
|
186
|
-
File.join(Autoproj.root_dir, subdir, ENV_FILENAME)
|
187
|
-
else
|
188
|
-
File.join(Autoproj.root_dir, ENV_FILENAME)
|
189
|
-
end
|
190
|
-
|
191
|
-
shell_dir = File.expand_path(File.join("..", "..", "shell"), File.dirname(__FILE__))
|
192
|
-
if Autoproj.shell_helpers?
|
193
|
-
Autoproj.message "sourcing autoproj shell helpers"
|
194
|
-
Autoproj.message "add \"Autoproj.shell_helpers = false\" in autoproj/init.rb to disable"
|
195
|
-
Autobuild.env_source_after(File.join(shell_dir, "autoproj_sh"))
|
196
|
-
end
|
197
|
-
|
198
|
-
File.open(filename, "w") do |io|
|
199
|
-
if Autobuild.env_inherit
|
200
|
-
io.write <<-EOF
|
201
|
-
if test -n "$AUTOPROJ_CURRENT_ROOT" && test "$AUTOPROJ_CURRENT_ROOT" != "#{Autoproj.root_dir}"; then
|
202
|
-
echo "the env.sh from $AUTOPROJ_CURRENT_ROOT is already loaded. Start a new shell before sourcing this one"
|
203
|
-
return
|
204
|
-
fi
|
205
|
-
EOF
|
206
|
-
end
|
207
|
-
Autobuild.export_env_sh(io)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
# @deprecated use Ops.loader.load or add a proper Loader object to your
|
212
|
-
# class
|
213
|
-
def self.load(package_set, *path)
|
214
|
-
Ops.loader.load(package_set, *path)
|
215
|
-
end
|
216
|
-
|
217
|
-
# @deprecated use Ops.loader.load_if_present or add a proper Loader object
|
218
|
-
# to your class
|
219
|
-
def self.load_if_present(package_set, *path)
|
220
|
-
Ops.loader.load_if_present(package_set, *path)
|
221
|
-
end
|
222
|
-
|
223
124
|
# Look into +dir+, searching for shared libraries. For each library, display
|
224
125
|
# a warning message if this library has undefined symbols.
|
225
126
|
def self.validate_solib_dependencies(dir, exclude_paths = [])
|