autobuild 1.5.51 → 1.5.52.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/lib/autobuild/environment.rb +105 -31
- data/lib/autobuild/import/git.rb +19 -8
- data/lib/autobuild/packages/orogen.rb +37 -0
- data/lib/autobuild/subcommand.rb +12 -3
- data/lib/autobuild/version.rb +1 -1
- metadata +19 -15
data/.gemtest
ADDED
File without changes
|
@@ -2,14 +2,44 @@ require 'set'
|
|
2
2
|
module Autobuild
|
3
3
|
@inherited_environment = Hash.new
|
4
4
|
@environment = Hash.new
|
5
|
+
@env_source_files = Set.new
|
6
|
+
|
5
7
|
class << self
|
6
|
-
|
8
|
+
# List of the environment that should be set before calling a subcommand
|
9
|
+
#
|
10
|
+
# It is a map from environment variable name to the corresponding value.
|
11
|
+
# If the value is an array, it is joined using the path separator ':'
|
7
12
|
attr_reader :environment
|
13
|
+
|
14
|
+
# In generated environment update shell files, indicates whether an
|
15
|
+
# environment variable should be overriden by the shell script, or
|
16
|
+
# simply updated
|
17
|
+
#
|
18
|
+
# If inherited_environment[varname] is true, the generated shell script
|
19
|
+
# will contain
|
20
|
+
#
|
21
|
+
# export VARNAME=new_value:new_value:$VARNAME
|
22
|
+
#
|
23
|
+
# otherwise
|
24
|
+
#
|
25
|
+
# export VARNAME=new_value:new_value
|
26
|
+
attr_reader :inherited_environment
|
27
|
+
|
28
|
+
# List of files that should be sourced in the generated environment
|
29
|
+
# variable setting shell scripts
|
30
|
+
attr_reader :env_source_files
|
8
31
|
end
|
9
32
|
|
10
|
-
|
11
|
-
|
12
|
-
|
33
|
+
# Removes any settings related to the environment varialbe +name+, or for
|
34
|
+
# all environment variables if no name is given
|
35
|
+
def self.env_clear(name = nil)
|
36
|
+
if name
|
37
|
+
environment[name] = nil
|
38
|
+
inherited_environment[name] = nil
|
39
|
+
else
|
40
|
+
environment.clear
|
41
|
+
inherited_environment.clear
|
42
|
+
end
|
13
43
|
end
|
14
44
|
|
15
45
|
# Set a new environment variable
|
@@ -17,6 +47,7 @@ module Autobuild
|
|
17
47
|
env_clear(name)
|
18
48
|
env_add(name, *values)
|
19
49
|
end
|
50
|
+
|
20
51
|
# Adds a new value to an environment variable
|
21
52
|
def self.env_add(name, *values)
|
22
53
|
set = if environment.has_key?(name)
|
@@ -58,6 +89,39 @@ module Autobuild
|
|
58
89
|
end
|
59
90
|
end
|
60
91
|
|
92
|
+
# Require that generated environment variable scripts source the given shell
|
93
|
+
# script
|
94
|
+
def self.env_source_file(file)
|
95
|
+
@env_source_files << file
|
96
|
+
end
|
97
|
+
|
98
|
+
# Generates a shell script that sets the environment variable listed in
|
99
|
+
# Autobuild.environment, following the inheritance setting listed in
|
100
|
+
# Autobuild.inherited_environment.
|
101
|
+
#
|
102
|
+
# It also sources the files added by Autobuild.env_source_file
|
103
|
+
def self.export_env_sh(io)
|
104
|
+
variables = []
|
105
|
+
Autobuild.environment.each do |name, value|
|
106
|
+
variables << name
|
107
|
+
shell_line = "#{name}=#{value.join(":")}"
|
108
|
+
if Autoproj.env_inherit?(name)
|
109
|
+
if value.empty?
|
110
|
+
next
|
111
|
+
else
|
112
|
+
shell_line << ":$#{name}"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
io.puts shell_line
|
116
|
+
end
|
117
|
+
variables.each do |var|
|
118
|
+
io.puts "export #{var}"
|
119
|
+
end
|
120
|
+
env_source_files.each do |path|
|
121
|
+
io.puts ". \"#{path}\""
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
61
125
|
# DEPRECATED: use env_add_path instead
|
62
126
|
def self.pathvar(path, varname)
|
63
127
|
if File.directory?(path)
|
@@ -123,41 +187,51 @@ module Autobuild
|
|
123
187
|
end
|
124
188
|
|
125
189
|
# Updates the environment when a new prefix has been added
|
126
|
-
def self.update_environment(newprefix)
|
127
|
-
if
|
128
|
-
|
190
|
+
def self.update_environment(newprefix, includes = nil)
|
191
|
+
if !includes || includes.include?('PATH')
|
192
|
+
if File.directory?("#{newprefix}/bin")
|
193
|
+
env_add_path('PATH', "#{newprefix}/bin")
|
194
|
+
end
|
129
195
|
end
|
130
196
|
|
131
|
-
|
132
|
-
|
133
|
-
|
197
|
+
if !includes || includes.include?('PKG_CONFIG_PATH')
|
198
|
+
pkg_config_search = ['lib/pkgconfig', 'lib/ARCH/pkgconfig', 'libARCHSIZE/pkgconfig']
|
199
|
+
each_env_search_path(newprefix, pkg_config_search) do |path|
|
200
|
+
env_add_path('PKG_CONFIG_PATH', path)
|
201
|
+
end
|
134
202
|
end
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
203
|
+
|
204
|
+
if !includes || includes.include?('LD_LIBRARY_PATH')
|
205
|
+
ld_library_search = ['lib', 'lib/ARCH', 'libARCHSIZE']
|
206
|
+
each_env_search_path(newprefix, ld_library_search) do |path|
|
207
|
+
if !Dir.glob(File.join(path, "lib*.so")).empty?
|
208
|
+
env_add_path('LD_LIBRARY_PATH', path)
|
209
|
+
end
|
139
210
|
end
|
140
211
|
end
|
141
212
|
|
142
213
|
# Validate the new rubylib path
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
require 'rbconfig'
|
149
|
-
ruby_arch = File.basename(Config::CONFIG['archdir'])
|
150
|
-
candidates = %w{rubylibdir archdir sitelibdir sitearchdir vendorlibdir vendorarchdir}.
|
151
|
-
map { |key| Config::CONFIG[key] }.
|
152
|
-
map { |path| path.gsub(/.*lib(?:32|64)?\/(\w*ruby\/)/, '\\1') }.
|
153
|
-
each do |subdir|
|
154
|
-
if File.directory?("#{newprefix}/lib/#{subdir}")
|
155
|
-
env_add_path("RUBYLIB", "#{newprefix}/lib/#{subdir}")
|
156
|
-
end
|
214
|
+
if !includes || includes.include?('RUBYLIB')
|
215
|
+
new_rubylib = "#{newprefix}/lib"
|
216
|
+
if File.directory?(new_rubylib) && !File.directory?(File.join(new_rubylib, "ruby")) && !Dir["#{new_rubylib}/**/*.rb"].empty?
|
217
|
+
env_add_path('RUBYLIB', new_rubylib)
|
157
218
|
end
|
219
|
+
|
220
|
+
require 'rbconfig'
|
221
|
+
ruby_arch = File.basename(Config::CONFIG['archdir'])
|
222
|
+
candidates = %w{rubylibdir archdir sitelibdir sitearchdir vendorlibdir vendorarchdir}.
|
223
|
+
map { |key| Config::CONFIG[key] }.
|
224
|
+
map { |path| path.gsub(/.*lib(?:32|64)?\/(\w*ruby\/)/, '\\1') }.
|
225
|
+
each do |subdir|
|
226
|
+
if File.directory?("#{newprefix}/lib/#{subdir}")
|
227
|
+
env_add_path("RUBYLIB", "#{newprefix}/lib/#{subdir}")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
158
231
|
end
|
159
232
|
end
|
160
233
|
|
161
|
-
Autobuild.update_environment '/'
|
162
|
-
Autobuild.update_environment '/usr'
|
163
|
-
Autobuild.update_environment '/usr/local'
|
234
|
+
Autobuild.update_environment '/', ['PKG_CONFIG_PATH']
|
235
|
+
Autobuild.update_environment '/usr', ['PKG_CONFIG_PATH']
|
236
|
+
Autobuild.update_environment '/usr/local', ['PKG_CONFIG_PATH']
|
237
|
+
|
data/lib/autobuild/import/git.rb
CHANGED
@@ -71,9 +71,10 @@ module Autobuild
|
|
71
71
|
# #repository is always used for read-only operations
|
72
72
|
attr_accessor :push_to
|
73
73
|
|
74
|
-
#
|
75
|
-
#
|
76
|
-
|
74
|
+
# The remote branch to which we should push
|
75
|
+
#
|
76
|
+
# Defaults to #branch
|
77
|
+
attr_writer :remote_branch
|
77
78
|
|
78
79
|
# The branch this importer is tracking
|
79
80
|
#
|
@@ -85,10 +86,20 @@ module Autobuild
|
|
85
86
|
# If not set, it defaults to #branch
|
86
87
|
attr_writer :local_branch
|
87
88
|
|
89
|
+
# The branch that should be used on the local clone
|
90
|
+
#
|
91
|
+
# Defaults to #branch
|
88
92
|
def local_branch
|
89
93
|
@local_branch || branch
|
90
94
|
end
|
91
95
|
|
96
|
+
# The remote branch to which we should push
|
97
|
+
#
|
98
|
+
# Defaults to #branch
|
99
|
+
def remote_branch
|
100
|
+
@remote_branch || branch
|
101
|
+
end
|
102
|
+
|
92
103
|
# The tag we are pointing to. It is a tag name.
|
93
104
|
#
|
94
105
|
# If set, both branch and commit have to be nil.
|
@@ -144,9 +155,9 @@ module Autobuild
|
|
144
155
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
145
156
|
"--replace-all", "remote.autobuild.fetch", "+refs/heads/*:refs/remotes/autobuild/*")
|
146
157
|
|
147
|
-
if
|
158
|
+
if remote_branch && local_branch
|
148
159
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
149
|
-
"--replace-all", "remote.autobuild.push", "refs/heads/#{local_branch
|
160
|
+
"--replace-all", "remote.autobuild.push", "refs/heads/#{local_branch}:refs/heads/#{remote_branch}")
|
150
161
|
else
|
151
162
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
152
163
|
"--replace-all", "remote.autobuild.push", "refs/heads/*:refs/heads/*")
|
@@ -156,7 +167,7 @@ module Autobuild
|
|
156
167
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
157
168
|
"--replace-all", "branch.#{local_branch}.remote", "autobuild")
|
158
169
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
159
|
-
"--replace-all", "branch.#{local_branch}.merge", "refs/heads/#{
|
170
|
+
"--replace-all", "branch.#{local_branch}.merge", "refs/heads/#{local_branch}")
|
160
171
|
end
|
161
172
|
|
162
173
|
if commit
|
@@ -340,9 +351,9 @@ module Autobuild
|
|
340
351
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
341
352
|
"--replace-all", "remote.autobuild.pushurl", push_to)
|
342
353
|
end
|
343
|
-
if
|
354
|
+
if local_branch && remote_branch
|
344
355
|
Subprocess.run(package, :import, Autobuild.tool('git'), 'config',
|
345
|
-
"--replace-all", "remote.autobuild.push", "refs/heads/#{local_branch
|
356
|
+
"--replace-all", "remote.autobuild.push", "refs/heads/#{local_branch}:refs/heads/#{remote_branch}")
|
346
357
|
end
|
347
358
|
|
348
359
|
# If we are tracking a commit/tag, just check it out
|
@@ -65,9 +65,15 @@ module Autobuild
|
|
65
65
|
attr_accessor :default_type_export_policy
|
66
66
|
# The list of enabled transports as an array of strings (default: typelib, corba)
|
67
67
|
attr_reader :transports
|
68
|
+
|
69
|
+
attr_reader :orogen_options
|
68
70
|
end
|
71
|
+
@orogen_options = []
|
69
72
|
@default_type_export_policy = :used
|
70
73
|
@transports = %w{corba typelib}
|
74
|
+
@rtt_scripting = true
|
75
|
+
|
76
|
+
attr_reader :orogen_options
|
71
77
|
|
72
78
|
# Path to the orogen tool
|
73
79
|
def self.orogen_bin(full_path = false)
|
@@ -146,6 +152,7 @@ module Autobuild
|
|
146
152
|
|
147
153
|
@orocos_target = nil
|
148
154
|
@orogen_file ||= "#{File.basename(name)}.orogen"
|
155
|
+
@orogen_options = []
|
149
156
|
end
|
150
157
|
|
151
158
|
def prepare_for_forced_build
|
@@ -217,12 +224,30 @@ module Autobuild
|
|
217
224
|
end
|
218
225
|
end
|
219
226
|
|
227
|
+
def add_cmd_to_cmdline(cmd, cmdline)
|
228
|
+
base = nil
|
229
|
+
|
230
|
+
if cmd =~ /^([\w-]+)/
|
231
|
+
cmd_filter = $1
|
232
|
+
else
|
233
|
+
raise ArgumentError, "cannot parse the provided command #{cmd}"
|
234
|
+
end
|
235
|
+
|
236
|
+
cmdline.delete_if { |str| str =~ /^#{cmd_filter}/ }
|
237
|
+
if cmd_filter =~ /^--no-(.*)/
|
238
|
+
cmd_filter = $1
|
239
|
+
cmdline.delete_if { |str| str =~ /^--#{cmd_filter}/ }
|
240
|
+
end
|
241
|
+
cmdline << cmd
|
242
|
+
end
|
243
|
+
|
220
244
|
def regen
|
221
245
|
cmdline = []
|
222
246
|
cmdline << '--corba' if corba
|
223
247
|
|
224
248
|
ext_states = extended_states
|
225
249
|
if !ext_states.nil?
|
250
|
+
cmdline.delete_if { |str| str =~ /extended-states/ }
|
226
251
|
if ext_states
|
227
252
|
cmdline << '--extended-states'
|
228
253
|
else
|
@@ -239,8 +264,20 @@ module Autobuild
|
|
239
264
|
cmdline << "--transports=#{Orogen.transports.sort.uniq.join(",")}"
|
240
265
|
end
|
241
266
|
end
|
267
|
+
|
268
|
+
# Now, add raw options
|
269
|
+
#
|
270
|
+
# The raw options take precedence
|
271
|
+
Orogen.orogen_options.each do |cmd|
|
272
|
+
add_cmd_to_cmdline(cmd, cmdline)
|
273
|
+
end
|
274
|
+
orogen_options.each do |cmd|
|
275
|
+
add_cmd_to_cmdline(cmd, cmdline)
|
276
|
+
end
|
277
|
+
|
242
278
|
cmdline = cmdline.sort
|
243
279
|
cmdline << orogen_file
|
280
|
+
puts cmdline.inspect
|
244
281
|
|
245
282
|
needs_regen = Autobuild::Orogen.always_regenerate?
|
246
283
|
|
data/lib/autobuild/subcommand.rb
CHANGED
@@ -97,6 +97,13 @@ module Autobuild
|
|
97
97
|
else
|
98
98
|
@processor_count = processor_ids.size
|
99
99
|
end
|
100
|
+
else
|
101
|
+
result = Open3.popen3("sysctl", "-n", "hw.cpu") do |_, io, _|
|
102
|
+
io.read
|
103
|
+
end
|
104
|
+
if !result.empty?
|
105
|
+
@processor_count = Integer(result.chomp.strip)
|
106
|
+
end
|
100
107
|
end
|
101
108
|
|
102
109
|
# The format of the cpuinfo file is ... let's say not very standardized.
|
@@ -168,12 +175,13 @@ module Autobuild::Subprocess
|
|
168
175
|
if Autobuild.keep_oldlogs
|
169
176
|
logfile.puts
|
170
177
|
end
|
171
|
-
logfile.puts "#{Time.now}: running"
|
172
|
-
logfile.puts " #{command.join(" ")}"
|
173
178
|
logfile.puts "with environment:"
|
174
179
|
ENV.keys.sort.each do |key|
|
175
180
|
logfile.puts " '#{key}'='#{ENV[key]}'"
|
176
181
|
end
|
182
|
+
logfile.puts
|
183
|
+
logfile.puts "#{Time.now}: running"
|
184
|
+
logfile.puts " #{command.join(" ")}"
|
177
185
|
logfile.flush
|
178
186
|
logfile.sync = true
|
179
187
|
|
@@ -276,7 +284,8 @@ module Autobuild::Subprocess
|
|
276
284
|
Autobuild.add_stat(target, phase, duration)
|
277
285
|
FileUtils.mkdir_p(Autobuild.logdir)
|
278
286
|
File.open(File.join(Autobuild.logdir, "stats.log"), 'a') do |io|
|
279
|
-
|
287
|
+
formatted_time = "#{start_time.strftime('%F %H:%M:%S')}.#{'%.03i' % [start_time.tv_usec / 1000]}"
|
288
|
+
io.puts "#{formatted_time} #{target_name} #{phase} #{duration}"
|
280
289
|
end
|
281
290
|
if target.respond_to?(:add_stat)
|
282
291
|
target.add_stat(phase, duration)
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424455
|
5
|
+
prerelease: 7
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
|
9
|
+
- 52
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 1.5.52.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Sylvain Joyeux
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-
|
20
|
+
date: 2011-10-11 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: rake
|
@@ -85,14 +87,13 @@ dependencies:
|
|
85
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
86
88
|
none: false
|
87
89
|
requirements:
|
88
|
-
- -
|
90
|
+
- - ~>
|
89
91
|
- !ruby/object:Gem::Version
|
90
|
-
hash:
|
92
|
+
hash: 27
|
91
93
|
segments:
|
92
94
|
- 2
|
93
|
-
-
|
94
|
-
|
95
|
-
version: 2.8.0
|
95
|
+
- 12
|
96
|
+
version: "2.12"
|
96
97
|
type: :development
|
97
98
|
version_requirements: *id005
|
98
99
|
description: |-
|
@@ -164,6 +165,7 @@ files:
|
|
164
165
|
- test/test_import_tar.rb
|
165
166
|
- test/test_subcommand.rb
|
166
167
|
- test/tools.rb
|
168
|
+
- .gemtest
|
167
169
|
homepage:
|
168
170
|
licenses: []
|
169
171
|
|
@@ -185,16 +187,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
188
|
none: false
|
187
189
|
requirements:
|
188
|
-
- - "
|
190
|
+
- - ">"
|
189
191
|
- !ruby/object:Gem::Version
|
190
|
-
hash:
|
192
|
+
hash: 25
|
191
193
|
segments:
|
192
|
-
-
|
193
|
-
|
194
|
+
- 1
|
195
|
+
- 3
|
196
|
+
- 1
|
197
|
+
version: 1.3.1
|
194
198
|
requirements: []
|
195
199
|
|
196
200
|
rubyforge_project: autobuild
|
197
|
-
rubygems_version: 1.
|
201
|
+
rubygems_version: 1.8.10
|
198
202
|
signing_key:
|
199
203
|
specification_version: 3
|
200
204
|
summary: Rake-based utility to build and install multiple packages with dependencies
|