autobuild 1.9.6 → 1.10.0.b1

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,7 +54,7 @@ module Autobuild
54
54
  if internal_doxygen_mode?
55
55
  run_doxygen
56
56
  else
57
- Subprocess.run(self, utility.name, Autobuild.tool(:make), "-j#{parallel_build_level}", target, :working_directory => builddir)
57
+ run(utility.name, Autobuild.tool(:make), "-j#{parallel_build_level}", target, :working_directory => builddir)
58
58
  end
59
59
  yield if block_given?
60
60
  end
@@ -254,10 +254,10 @@ module Autobuild
254
254
 
255
255
  progress_start "generating autotools for %s", :done_message => 'generated autotools for %s' do
256
256
  if using[:libtool]
257
- Subprocess.run(self, 'configure', Autobuild.tool('libtoolize'), '--copy')
257
+ run('configure', Autobuild.tool('libtoolize'), '--copy')
258
258
  end
259
259
  if using[:autogen]
260
- Subprocess.run(self, 'configure', File.expand_path(using[:autogen], srcdir))
260
+ run('configure', File.expand_path(using[:autogen], srcdir))
261
261
  else
262
262
  [ :aclocal, :autoconf, :autoheader, :automake ].each do |tool|
263
263
  if tool_flag = using[tool]
@@ -266,7 +266,7 @@ module Autobuild
266
266
  else; Autobuild.tool(tool)
267
267
  end
268
268
 
269
- Subprocess.run(self, 'configure', tool_program, *send("#{tool}_flags"))
269
+ run('configure', tool_program, *send("#{tool}_flags"))
270
270
  end
271
271
  end
272
272
  end
@@ -290,7 +290,7 @@ module Autobuild
290
290
  command += Array[*configureflags]
291
291
 
292
292
  progress_start "configuring autotools for %s", :done_message => 'configured autotools for %s' do
293
- Subprocess.run(self, 'configure', *command)
293
+ run('configure', *command)
294
294
  end
295
295
  end
296
296
  end
@@ -301,9 +301,9 @@ module Autobuild
301
301
  in_dir(builddir) do
302
302
  progress_start "building %s [progress not available]", :done_message => 'built %s' do
303
303
  if force_config_status
304
- Subprocess.run(self, 'build', './config.status')
304
+ run('build', './config.status')
305
305
  end
306
- Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}")
306
+ run('build', Autobuild.tool(:make), "-j#{parallel_build_level}")
307
307
  end
308
308
  end
309
309
  Autobuild.touch_stamp(buildstamp)
@@ -313,7 +313,7 @@ module Autobuild
313
313
  def install
314
314
  in_dir(builddir) do
315
315
  progress_start "installing %s", :done_message => 'installed %s' do
316
- Subprocess.run(self, 'install', Autobuild.tool(:make), 'install')
316
+ run('install', Autobuild.tool(:make), 'install')
317
317
  end
318
318
  end
319
319
 
@@ -226,7 +226,7 @@ module Autobuild
226
226
  File.open(doxyfile, 'w') do |io|
227
227
  io.write(doxyfile_data)
228
228
  end
229
- Subprocess.run(self, 'doc', Autobuild.tool(:doxygen), doxyfile)
229
+ run('doc', Autobuild.tool(:doxygen), doxyfile)
230
230
  end
231
231
 
232
232
  def common_utility_handling(utility, target, start_msg, done_msg)
@@ -235,11 +235,11 @@ module Autobuild
235
235
  if internal_doxygen_mode?
236
236
  run_doxygen
237
237
  else
238
- Subprocess.run(self, utility.name,
239
- Autobuild.tool(:make),
240
- "-j#{parallel_build_level}",
241
- target,
242
- :working_directory => builddir)
238
+ run(utility.name,
239
+ Autobuild.tool(:make),
240
+ "-j#{parallel_build_level}",
241
+ target,
242
+ working_directory: builddir)
243
243
  end
244
244
  yield if block_given?
245
245
  end
@@ -329,7 +329,7 @@ module Autobuild
329
329
  end
330
330
 
331
331
  value = value.to_s
332
- old_value = cache_line.partition("=").last.chomp if cache_line
332
+ old_value = cache_line.split("=")[1].chomp if cache_line
333
333
  if !old_value || !equivalent_option_value?(old_value, value)
334
334
  if Autobuild.debug
335
335
  message "%s: option '#{name}' changed value: '#{old_value}' => '#{value}'"
@@ -381,7 +381,7 @@ module Autobuild
381
381
  if full_reconfigures?
382
382
  FileUtils.rm_f cmake_cache
383
383
  end
384
- Subprocess.run(self, 'configure', *command)
384
+ run('configure', *command)
385
385
  end
386
386
  end
387
387
  end
@@ -412,7 +412,7 @@ module Autobuild
412
412
  in_dir(builddir) do
413
413
  progress_start "building %s" do
414
414
  if always_reconfigure || !File.file?('Makefile')
415
- Subprocess.run(self, 'build', Autobuild.tool(:cmake), '.')
415
+ run('build', Autobuild.tool(:cmake), '.')
416
416
  end
417
417
 
418
418
  warning_count = 0
@@ -458,7 +458,7 @@ module Autobuild
458
458
  def install
459
459
  in_dir(builddir) do
460
460
  progress_start "installing %s", :done_message => 'installed %s' do
461
- Subprocess.run(self, 'install', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
461
+ run('install', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
462
462
  end
463
463
  end
464
464
  super
@@ -134,7 +134,7 @@ module Autobuild
134
134
  isolate_errors do
135
135
  in_dir(srcdir) do
136
136
  progress_start "generating GenoM for %s", :done_message => 'generated GenoM for %s' do
137
- Subprocess.run(self, 'genom', *cmdline)
137
+ run('genom', *cmdline)
138
138
  end
139
139
  end
140
140
  end
@@ -147,7 +147,7 @@ module Autobuild
147
147
  # since the generation takes care of rebuilding configure
148
148
  # if .gen has changed
149
149
  progress_start "generating autotools for %s", :done_message => 'generated autotools for %s' do
150
- in_dir(srcdir) { Subprocess.run(self, 'genom', File.expand_path('autogen', srcdir)) }
150
+ in_dir(srcdir) { run('genom', File.expand_path('autogen', srcdir)) }
151
151
  end
152
152
  end
153
153
  end
@@ -41,7 +41,7 @@ module Autobuild
41
41
 
42
42
  def self.make_subcommand(pkg, phase, *options, &block)
43
43
  invoke_make_parallel(pkg, Autobuild.tool(:make)) do |*make_parallel_options|
44
- Subprocess.run(pkg, phase, Autobuild.tool(:make), *make_parallel_options, *options, &block)
44
+ pkg.run(phase, Autobuild.tool(:make), *make_parallel_options, *options, &block)
45
45
  end
46
46
  end
47
47
  end
@@ -178,15 +178,10 @@ module Autobuild
178
178
  end
179
179
 
180
180
  def update_environment
181
- super
182
181
  typelib_plugin = File.join(prefix, 'share', 'typelib', 'ruby')
183
- if File.directory?(typelib_plugin)
184
- Autobuild.env_add_path 'TYPELIB_RUBY_PLUGIN_PATH', typelib_plugin
185
- end
182
+ env_add_path 'TYPELIB_RUBY_PLUGIN_PATH', typelib_plugin
186
183
  roby_plugin = File.join(prefix, 'share', 'orocos', 'roby')
187
- if File.directory?(roby_plugin)
188
- Autobuild.env_add_path 'OROCOS_ROBY_PLUGIN_PATH', roby_plugin
189
- end
184
+ env_add_path 'OROCOS_ROBY_PLUGIN_PATH', roby_plugin
190
185
  end
191
186
 
192
187
  def prepare
@@ -331,7 +326,7 @@ module Autobuild
331
326
  if needs_regen
332
327
  progress_start "generating oroGen %s", :done_message => 'generated oroGen %s' do
333
328
  in_dir(srcdir) do
334
- Subprocess.run self, 'orogen', guess_ruby_name, self.class.orogen_bin, *cmdline
329
+ run 'orogen', guess_ruby_name, '-S', self.class.orogen_bin, *cmdline
335
330
  File.open(genstamp, 'w') do |io|
336
331
  io.print cmdline.join("\n")
337
332
  end
@@ -30,7 +30,7 @@ module Autobuild
30
30
  def with_doc
31
31
  doc_task do
32
32
  progress_start "generating documentation for %s", :done_message => 'generated documentation for %s' do
33
- Autobuild::Subprocess.run self, 'doc',
33
+ run 'doc',
34
34
  Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), rake_doc_task,
35
35
  :working_directory => srcdir
36
36
  end
@@ -40,7 +40,7 @@ module Autobuild
40
40
  def with_tests
41
41
  test_utility.task do
42
42
  progress_start "running tests for %s", :done_message => 'tests passed for %s' do
43
- Autobuild::Subprocess.run self, 'test',
43
+ run 'test',
44
44
  Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), rake_test_task,
45
45
  :working_directory => srcdir
46
46
  end
@@ -49,7 +49,7 @@ module Autobuild
49
49
 
50
50
  def invoke_rake(setup_task = rake_setup_task)
51
51
  if setup_task && File.file?(File.join(srcdir, 'Rakefile'))
52
- Autobuild::Subprocess.run self, 'post-install',
52
+ run 'post-install',
53
53
  Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), setup_task,
54
54
  :working_directory => srcdir
55
55
  end
@@ -57,14 +57,6 @@ module Autobuild
57
57
 
58
58
  def install
59
59
  progress_start "setting up Ruby package %s", :done_message => 'set up Ruby package %s' do
60
- Autobuild.update_environment srcdir
61
- # Add lib/ unconditionally, as we know that it is a ruby package.
62
- # update_environment will add it only if there is a .rb file in the directory
63
- libdir = File.join(srcdir, 'lib')
64
- if File.directory?(libdir)
65
- Autobuild.env_add_path 'RUBYLIB', libdir
66
- end
67
-
68
60
  invoke_rake
69
61
  end
70
62
  super
@@ -86,7 +78,7 @@ module Autobuild
86
78
  super
87
79
  if rake_clean_task && File.file?(File.join(srcdir, 'Rakefile'))
88
80
  begin
89
- Autobuild::Subprocess.run self, 'clean',
81
+ run 'clean',
90
82
  Autobuild.tool_in_path('ruby'), '-S', Autobuild.tool('rake'), rake_clean_task,
91
83
  :working_directory => srcdir
92
84
  rescue Autobuild::SubcommandFailed => e
@@ -98,10 +90,10 @@ module Autobuild
98
90
  end
99
91
 
100
92
  def update_environment
101
- Autobuild.update_environment srcdir
93
+ env_add_prefix srcdir
102
94
  libdir = File.join(srcdir, 'lib')
103
95
  if File.directory?(libdir)
104
- Autobuild.env_add_path 'RUBYLIB', libdir
96
+ env_add_path 'RUBYLIB', libdir
105
97
  end
106
98
  end
107
99
  end
@@ -1,3 +1,4 @@
1
+ require 'autobuild/exceptions'
1
2
  module Autobuild
2
3
  class << self
3
4
  attr_reader :display_lock
@@ -350,101 +351,3 @@ module Autobuild
350
351
  end
351
352
  end
352
353
 
353
- ## Report by mail
354
- if Autobuild::HAS_RMAIL
355
- module Autobuild
356
- class MailReporter < Reporter
357
- def default_mail
358
- Etc::endpwent
359
- uname = while (pwent = Etc::getpwent)
360
- break (pwent.name) if pwent.uid == Process.uid
361
- end
362
-
363
- raise "FATAL: cannot find a user with uid=#{Process.uid}" unless uname
364
- "#{pwent.name}@#{Socket.gethostname}"
365
- end
366
-
367
- attr_reader :from_email, :to_email, :smtp_hostname, :smtp_port, :subject, :only_errors
368
- def initialize(config)
369
- @from_email = (config[:from] || default_mail)
370
- @to_email = (config[:to] || default_mail)
371
- @subject = (config[:subject] || "Build %result% on #{Socket.gethostname} at %time%")
372
- @only_errors = config[:only_errors]
373
- @smtp_hostname = (config[:smtp] || "localhost" )
374
- @smtp_port = Integer(config[:port] || Socket.getservbyname('smtp'))
375
- end
376
-
377
- def error(error)
378
- if error.mail?
379
- send_mail("failed", error.to_s)
380
- end
381
- end
382
-
383
- def success
384
- unless only_errors
385
- send_mail("success", Autobuild.post_success_message || "")
386
- end
387
- end
388
-
389
- def send_mail(result, body = "")
390
- mail = RMail::Message.new
391
- mail.header.date = Time.now
392
- mail.header.from = from_email
393
- mail.header.subject = subject.
394
- gsub('%result%', result).
395
- gsub('%time%', Time.now.to_s).
396
- gsub('%hostname%', Socket.gethostname)
397
-
398
- part = RMail::Message.new
399
- part.header.set('Content-Type', 'text/plain')
400
- part.body = body
401
- mail.add_part(part)
402
-
403
- # Attach log files
404
- Reporting.each_log do |file|
405
- name = file[Autobuild.logdir.size..-1]
406
- mail.add_file(name, file)
407
- end
408
-
409
- # Send the mails
410
- if smtp_hostname =~ /\// && File.directory?(File.dirname(smtp_hostname))
411
- File.open(smtp_hostname, 'w') do |io|
412
- io.puts "From: #{from_email}"
413
- io.puts "To: #{to_email.join(" ")}"
414
- io.write RMail::Serialize.write('', mail)
415
- end
416
- puts "saved notification email in #{smtp_hostname}"
417
- else
418
- smtp = Net::SMTP.new(smtp_hostname, smtp_port)
419
- smtp.start {
420
- to_email.each do |email|
421
- mail.header.to = email
422
- smtp.send_mail RMail::Serialize.write('', mail), from_email, email
423
- end
424
- }
425
-
426
- # Notify the sending
427
- puts "sent notification mail to #{to_email} with source #{from_email}"
428
- end
429
- end
430
- end
431
- end
432
-
433
- module RMail
434
- class Message
435
- ## Attachs a file to a message
436
- def add_file(name, path, content_type='text/plain')
437
- part = RMail::Message.new
438
- part.header.set('Content-Type', content_type)
439
- part.header.set('Content-Disposition', 'attachment', 'filename' => name)
440
- part.body = ''
441
- File.open(path) do |file|
442
- part.body << file.readlines.join("")
443
- end
444
- self.add_part(part)
445
- end
446
- end
447
- end
448
- end # if Autobuild::HAS_RMAIL
449
-
450
-
@@ -197,12 +197,15 @@ module Autobuild::Subprocess
197
197
  STDOUT.sync = true
198
198
 
199
199
  input_streams = []
200
- options = Hash[retry: false]
200
+ options = Hash[retry: false, env: ENV.to_hash, env_inherit: true]
201
201
  if command.last.kind_of?(Hash)
202
202
  options = command.pop
203
203
  options = Kernel.validate_options options,
204
204
  input: nil, working_directory: nil, retry: false,
205
- input_streams: []
205
+ input_streams: [],
206
+ env: ENV.to_hash,
207
+ env_inherit: true
208
+
206
209
  if options[:input]
207
210
  input_streams << File.open(options[:input])
208
211
  end
@@ -250,6 +253,15 @@ module Autobuild::Subprocess
250
253
  Autobuild.register_logfile(logname)
251
254
  subcommand_output = Array.new
252
255
 
256
+ env = options[:env].dup
257
+ if options[:env_inherit]
258
+ ENV.each do |k, v|
259
+ if !env.has_key?(k)
260
+ env[k] = v
261
+ end
262
+ end
263
+ end
264
+
253
265
  status = File.open(logname, open_flag) do |logfile|
254
266
  if Autobuild.keep_oldlogs
255
267
  logfile.puts
@@ -258,8 +270,8 @@ module Autobuild::Subprocess
258
270
  logfile.puts "#{Time.now}: running"
259
271
  logfile.puts " #{command.join(" ")}"
260
272
  logfile.puts "with environment:"
261
- ENV.keys.sort.each do |key|
262
- logfile.puts " '#{key}'='#{ENV[key]}'"
273
+ env.keys.sort.each do |key|
274
+ logfile.puts " '#{key}'='#{env[key]}'"
263
275
  end
264
276
  logfile.puts
265
277
  logfile.puts "#{Time.now}: running"
@@ -291,6 +303,13 @@ module Autobuild::Subprocess
291
303
 
292
304
  pid = fork do
293
305
  begin
306
+ env.each do |k, v|
307
+ if v
308
+ ENV[k] = v
309
+ else
310
+ ENV.delete(k)
311
+ end
312
+ end
294
313
  if options[:working_directory] && (options[:working_directory] != Dir.pwd)
295
314
  Dir.chdir(options[:working_directory])
296
315
  end
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.9.6" unless defined? Autobuild::VERSION
2
+ VERSION = "1.10.0.b1" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
@@ -25,25 +25,6 @@ class TC_TarImporter < Minitest::Test
25
25
  assert_equal(TarImporter::Bzip, TarImporter.filename_to_mode('tarfile.tar.bz2'))
26
26
  end
27
27
 
28
- def test_it_sets_the_repository_id_to_the_normalized_URL
29
- importer = TarImporter.new "FILE://test/file"
30
- assert_equal "file://test/file", importer.repository_id.to_str
31
- end
32
-
33
- def test_it_sets_the_source_id_to_the_normalized_URL
34
- importer = TarImporter.new "FILE://test/file"
35
- assert_equal "file://test/file", importer.source_id.to_str
36
- end
37
-
38
- def test_it_does_not_delete_a_locally_specified_archive_on_error
39
- dummy_tar = File.join(@datadir, "dummy.tar")
40
- FileUtils.touch dummy_tar
41
- importer = TarImporter.new "file://#{dummy_tar}"
42
- pkg = Package.new 'tarimport'
43
- assert_raises(Autobuild::SubcommandFailed) { importer.checkout(pkg) }
44
- assert File.file?(dummy_tar)
45
- end
46
-
47
28
  def test_tar_valid_url
48
29
  assert_raises(ConfigException) {
49
30
  TarImporter.new 'ccc://localhost/files/tarimport.tar.gz', :cachedir => @cachedir
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.9.6
4
+ version: 1.10.0.b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-10 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: utilrb
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
33
+ version: 1.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0
40
+ version: 1.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: highline
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.16'
75
+ version: '3.13'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.16'
82
+ version: '3.13'
83
83
  description: Collection of classes to handle build systems (CMake, autotools, ...)
84
84
  and import mechanisms (tarballs, CVS, SVN, git, ...). It also offers a Rake integration
85
85
  to import and build such software packages. It is the backbone of the autoproj (http://rock-robotics.org/autoproj)
@@ -93,6 +93,7 @@ extra_rdoc_files:
93
93
  - Manifest.txt
94
94
  - README.txt
95
95
  files:
96
+ - ".gemtest"
96
97
  - Changes.txt
97
98
  - Manifest.txt
98
99
  - README.txt
@@ -113,6 +114,7 @@ files:
113
114
  - lib/autobuild/import/svn.rb
114
115
  - lib/autobuild/import/tar.rb
115
116
  - lib/autobuild/importer.rb
117
+ - lib/autobuild/mail_reporter.rb
116
118
  - lib/autobuild/package.rb
117
119
  - lib/autobuild/packages/autotools.rb
118
120
  - lib/autobuild/packages/cmake.rb
@@ -165,12 +167,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
167
  version: 1.9.2
166
168
  required_rubygems_version: !ruby/object:Gem::Requirement
167
169
  requirements:
168
- - - ">="
170
+ - - ">"
169
171
  - !ruby/object:Gem::Version
170
- version: '0'
172
+ version: 1.3.1
171
173
  requirements: []
172
174
  rubyforge_project:
173
- rubygems_version: 2.5.1
175
+ rubygems_version: 2.2.2
174
176
  signing_key:
175
177
  specification_version: 4
176
178
  summary: Library to handle build systems and import mechanisms