-
Notifications
You must be signed in to change notification settings - Fork 25
/
init.rb
205 lines (174 loc) · 8.14 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Orocos Specific ignore rules
#
# Ignore log files generated from the orocos/orogen components
ignore(/\.log$/, /\.ior$/, /\.idx$/)
# Ignore all text files except CMakeLists.txt
ignore(/(^|\/)(?!CMakeLists)[^\/]+\.txt$/)
# We don't care about the manifest being changed, as autoproj *will* take
# dependency changes into account
ignore(/manifest\.xml$/)
# Ignore vim swap files
ignore(/\.sw?$/)
# Ignore the numerous backup files
ignore(/~$/)
## Workaround a change in minitest 1.15 that triggered a weird bug, causing ruby
## tests to fail with cannot create Thread: reosource temporarily unavailable
##
## This seem to be only triggered when tests are run under autoproj (the weird part)
Autoproj.env_set "MT_CPU", "1"
# Setup our "rubocop version manager"
#
# This is a script that auto-installs and auto-starts different version of
# rubocop based on a .rubocop-version file in the packages. This is meant as a
# way to smoothly migrate away from rubocop 0.83.0 ... which we are stuck on for
# a long while now
Autoproj.env_add_path "PATH", File.join(File.expand_path(__dir__), "rubocop-bin")
Autoproj.env_set "RUBOCOP_VERSION_MANAGER_ROOT",
File.join(Autoproj.workspace.prefix_dir, "rubocop-versions")
Autoproj.env_set "RUBOCOP_VERSION_MANAGER_DEFAULT", "0.83.0"
rubocop_gemfile = Autoproj.config.get(
"rubocop-manager-gemfile",
File.expand_path("Gemfile.rubocop", __dir__)
)
if rubocop_gemfile
Autoproj.env_set "RUBOCOP_VERSION_MANAGER_GEMFILE", rubocop_gemfile
end
Autoproj.env.set "RUBOCOP_CMD", "rubocop-manager"
# Ruby 1.8 is completly outdated, if you modify this, take respect to the addition checks below against 1.9
if defined?(RUBY_VERSION) && (RUBY_VERSION =~ /^1\.8\./)
Autoproj.error "Ruby 1.8 is not supported by Rock anymore"
Autoproj.error ""
Autoproj.error "Use Rock's bootstrap.sh script to install Rock"
Autoproj.error "See http://rock-robotics.org/stable/documentation/installation.html for more information"
exit 1
end
require 'autoproj/gitorious'
if !Autoproj.has_source_handler? 'github'
Autoproj.gitorious_server_configuration('GITHUB', 'github.com', :http_url => 'https://github.com')
end
require File.join(__dir__, 'rock/flavor_definition')
require File.join(__dir__, 'rock/flavor_manager')
require File.join(__dir__, 'rock/in_flavor_context')
require File.join(__dir__, 'rock/current_release')
require File.join(__dir__, 'rock/python')
Rock.flavors.define 'stable'
Rock.flavors.alias 'stable', 'next'
Rock.flavors.define 'master', :implicit => true
configuration_option('ROCK_SELECTED_FLAVOR', 'string',
:default => 'master',
:possible_values => ['stable', 'master'],
:doc => [
"Which flavor of Rock do you want to use ?",
"Stay with the default ('master') if you want to use Rock on the most recent",
"distributions (Ubuntu 16.04 and later). Use 'stable' only for ",
"now officially unsupported distributions (Ubuntu 14.04)"])
if Rock.in_release? && !Autoproj.config.has_value_for?('ROCK_SELECTED_FLAVOR')
Autoproj.config.set 'ROCK_SELECTED_FLAVOR', 'stable', true
end
Rock.flavors.select_current_flavor_by_name(
ENV['ROCK_FORCE_FLAVOR'] || Autoproj.config.get('ROCK_SELECTED_FLAVOR'))
current_flavor = Rock.flavors.current_flavor
#This check is needed because the overrides file will override the FLAVOR selection.
#Furthermore a selection != stable can cause a inconsistent layout (cause by in_flavor system in the package_sets)
if Rock.in_release? && current_flavor.branch != "stable"
if ENV['ROCK_RC'] == '1'
Autoproj.warn ""
Autoproj.warn "Found a release file and the flavor is not master"
Autoproj.warn "This would usually be an error, but since ROCK_RC is set to 1,"
Autoproj.warn "it is assumed that you're preparing a release candidate"
Autoproj.warn ""
else
Autoproj.error ""
Autoproj.error "You selected the flavor '#{current_flavor.branch}' but '#{File.join(Autoproj.root_dir,"autoproj", "overrides.d", "25-release.yml")}' exists."
Autoproj.error "This means you are on a release; either unselect the release by calling 'rock-release switch master'"
Autoproj.error "or call 'autoproj reconfigure' and select the FLAVOR 'stable'"
exit 1
end
end
Autoproj.config.set('ROCK_SELECTED_FLAVOR', current_flavor.name, true)
Autoproj.config.set('ROCK_FLAVOR', current_flavor.branch, true)
Autoproj.config.set('ROCK_BRANCH', current_flavor.branch, true)
if current_flavor.name != 'master' && Autoproj::PackageSet.respond_to?(:add_source_file)
Autoproj::PackageSet.add_source_file "source-stable.yml"
end
require File.join(__dir__, 'rock', 'cxx')
if Autoproj.respond_to?(:workspace) # autoproj 2.0
Rock.setup_cxx_support(Autoproj.workspace.os_package_resolver, Autoproj.config)
else
Rock.setup_cxx_support(Autoproj.osdeps, Autoproj.config)
end
def enabled_flavor_system
Rock.flavors.register_flavored_package_set(Autoproj.current_package_set)
end
def in_flavor(*flavors, &block)
Rock.flavors.in_flavor(*flavors, &block)
end
def only_in_flavor(*flavors, &block)
Rock.flavors.only_in_flavor(*flavors, &block)
end
def flavor_defined?(flavor_name)
Rock.flavors.has_flavor?(flavor_name)
end
def package_in_flavor?(pkg, flavor_name)
Rock.flavors.package_in_flavor?(pkg, flavor_name)
end
def add_packages_to_flavors(mappings)
Rock.flavors.add_packages_to_flavors(Autoproj.current_package_set, mappings)
end
def remove_packages_from_flavors(mappings)
Rock.flavors.remove_packages_from_flavors(Autoproj.current_package_set, mappings)
end
# Defines a bundle package in the installation
#
# So far, bundles are mostly Ruby packages
def bundle_package(*args, &block)
ruby_package(*args) do |pkg|
if block_given?
pkg.instance_eval(&block)
end
end
end
# Verify that a valid ruby version i used
if defined?(RUBY_VERSION) && (RUBY_VERSION.to_f < 2.0) && Autoproj.config.get('ROCK_FLAVOR') == 'master'
Autoproj.error "Ruby below 2.0 is not supported by Rock anymore."
Autoproj.error "Please re-bootstrap your installation."
Autoproj.error "We recommend ruby 2.1 expect for Ubuntu 14.04 where ruby 2.0 should be used."
Autoproj.error "You have also the option to switch to the 'stable' flavor by running 'autoproj reconfigure'"
Autoproj.error "or use the rock-15.05 release by first switching to 'stable' and then running 'rock-release switch rock-15.05'."
Autoproj.error "If you need to check the state of this installation (to make sure everyting is pushed) you could run"
Autoproj.error "'ROCK_IGNORE_RUBY_VERSION=1 autoproj status'."
Autoproj.error ""
Autoproj.error "See http://rock-robotics.org/documentation/installation.html for more information regarding bootstrapping."
if !ENV['ROCK_IGNORE_RUBY_VERSION']
exit 1
end
end
# rtt doesn't support mqueue on Mac OS X
if Autobuild.macos?
Autobuild::Orogen.transports.delete("mqueue")
end
Rock.setup_python_configuration_options
Autoproj.config.declare 'syskit_use_bundles', 'boolean',
default: true,
short_doc: 'whether Syskit systems should load Rock\'s bundle plugin',
doc: ['Whether Syskit bundles should be loading the Rock bundle system',
'The Rock bundle system may be loaded in Syskit, to apply the ROCK_BUNDLE_*',
'environment variables to the Syskit apps. This is fragile, we recommend',
'setting it to OFF and explicitely using Syskit\'s Roby.app.register_app',
'mechanism. It is ON by default for backward compatibility reasons']
unless Autoproj.config.has_value_for?('syskit_use_bundles')
Autoproj.config.set 'syskit_use_bundles', true, true
end
# See README
if (sanitizers = Autoproj.config.get("cxx_sanitizers", nil))
list = sanitizers.split(",")
if list.include?("address")
asan_lib_path = Autoproj.config.get("libasan_path", nil)
unless asan_lib_path
raise "you enabled the ASan sanitizer, but did not set the libasan_path configuration variable. Set it to the path to the libasan shared library"
end
Autoproj.env_add_path "LD_PRELOAD", asan_lib_path
Autoproj.env_set "LSAN_OPTIONS", "exitcode=0"
Autoproj.env_set "ASAN_OPTIONS", "detect_leaks=0"
end
end