autoproj 2.4.0 → 2.5.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99c12d40c6ed5bf39360d3f3e39b3a602841f5f8
4
- data.tar.gz: c2f379b779b1f5ba68ec9a3b00add4e90142fdfc
3
+ metadata.gz: cb1e051f18d65cbf0b5d3d2b57efd6f31e84b711
4
+ data.tar.gz: b2471080ab735a3bc2820de40c287d01b2bb11b9
5
5
  SHA512:
6
- metadata.gz: db6011b85a68c112ce7fa950c8c33dbf3a7229d3538d23fdf0093d72b3d74fe593cbe4d68c434a7231d937e21852a7ceb985f3dbacaa451db55c89e87a4c58fe
7
- data.tar.gz: 3197a556775041572721f3a9bb4e6c84bf058deee78b5bc0f8a031e32d8ab5b87dc723a30991779cb85e41cea9bc404460367ea8062ffa39d077563fdc5f7055
6
+ metadata.gz: 658959ed15d63a6b1b9cffb0eebc11e5be6ee4edda4f472dc4f5c4440726adc6e146cbf4f885cc52906385654c87414630d424add128d000c21a409cd8b6c503
7
+ data.tar.gz: 4a311895224ae16098f47e587a0dac2d1b0b9de50653f6a287b0a3c8e7d53036e2451315a441850c0faa1454240a0c1dc14c713cffd50f0e20b4c40e9926d4d2
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ pkg/
8
8
  /coverage/
9
9
  /.yardoc/
10
10
  test/gem_home
11
+ tmp/
@@ -3,8 +3,8 @@ language: ruby
3
3
  rvm:
4
4
  - 2.1.10
5
5
  - 2.2.5
6
- - 2.3.1
7
- - 2.4.1
6
+ - 2.3.6
7
+ - 2.4.3
8
8
  - 2.5.0
9
9
  - jruby-9.1.15.0
10
10
  matrix:
@@ -18,7 +18,7 @@ install:
18
18
  - git config --global user.email "autoproj@travis"
19
19
  - gem install bundler
20
20
  # Some tests expect gems to be present in vendor/bundle
21
- - bundler install --path vendor/bundle
21
+ - bundle install --path vendor/bundle
22
22
  script:
23
- - bundler exec rake
24
- - AUTOPROJ_SKIP_LONG_TESTS=1 bundler exec rake test
23
+ - bundle exec rake
24
+ - AUTOPROJ_SKIP_LONG_TESTS=1 bundle exec rake test
data/README.md CHANGED
@@ -237,15 +237,17 @@ bypassing any check. Great for CI environments.
237
237
  The best way to use autoproj 2.x from git is to checkout autoproj and
238
238
  autobuild manually, and write a Gemfile.autoproj-2.0 containing
239
239
 
240
+ ```
240
241
  source "https://rubygems.org"
241
242
  gem "autoproj", path: '/home/doudou/dev/gems/autoproj'
242
243
  gem "autobuild", path: '/home/doudou/dev/gems/autobuild'
243
244
  gem "utilrb", ">= 3.0.0.a"
244
-
245
+ ```
245
246
  Then, pass this gemfile to the --gemfile argument to autoproj_install
246
247
  or autoproj_bootstrap. Note that one can re-run autoproj_install in an
247
248
  already bootstrapped autoproj workspace, e.g.
248
249
 
250
+ ```
249
251
  wget https://raw.githubusercontent.com/rock-core/autoproj/master/bin/autoproj_install
250
252
  ruby autoproj_install --gemfile=../Gemfile.autoproj-2.0
251
-
253
+ ```
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ require 'rbconfig'
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'autoproj/version'
@@ -23,15 +25,18 @@ Gem::Specification.new do |s|
23
25
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
26
 
25
27
  s.add_runtime_dependency "bundler"
26
- s.add_runtime_dependency "autobuild", ">= 1.12.0"
28
+ s.add_runtime_dependency "autobuild", ">= 1.13.0.a"
29
+ s.add_runtime_dependency "backports", '~> 3.0'
27
30
  s.add_runtime_dependency "utilrb", '~> 3.0.0', ">= 3.0.0"
28
- s.add_runtime_dependency "thor", '~> 0.19.0', '>= 0.19.1'
31
+ s.add_runtime_dependency "thor", '~> 0.20.0'
29
32
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.0.0', '>= 1.0.0'
30
33
  s.add_runtime_dependency 'tty-color', '~> 0.4.0', '>= 0.4.0'
31
- s.add_runtime_dependency 'tty-prompt', '~> 0.12.0', '>= 0.12.0'
32
- s.add_runtime_dependency 'tty-spinner', '~> 0.4.0', '>= 0.4.0'
34
+ s.add_runtime_dependency 'tty-prompt', '~> 0.15.0'
35
+ s.add_runtime_dependency 'tty-spinner', '~> 0.8.0'
36
+ s.add_runtime_dependency 'rb-inotify' if RbConfig::CONFIG['target_os'] =~ /linux/
33
37
  s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
34
38
  s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
35
39
  s.add_development_dependency "simplecov"
40
+ s.add_development_dependency "aruba"
36
41
  end
37
42
 
@@ -23,7 +23,7 @@ module Autoproj
23
23
  class Install
24
24
  class UnexpectedBinstub < RuntimeError; end
25
25
 
26
- # The directory in which to install autoproj
26
+ # The created workspace's root directory
27
27
  attr_reader :root_dir
28
28
  # Content of the Gemfile generated to install autoproj itself
29
29
  attr_accessor :gemfile
@@ -316,12 +316,12 @@ module Autoproj
316
316
  exit 1
317
317
  end
318
318
  ensure
319
- self.class.rewrite_shims(shims_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
319
+ self.class.rewrite_shims(shims_path, ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home)
320
320
  end
321
321
 
322
322
  EXCLUDED_FROM_SHIMS = %w{rake thor}
323
323
 
324
- def self.rewrite_shims(shim_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
324
+ def self.rewrite_shims(shim_path, ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home)
325
325
  FileUtils.mkdir_p shim_path
326
326
  File.open(File.join(shim_path, 'ruby'), 'w') do |io|
327
327
  io.puts "#! /bin/sh"
@@ -347,7 +347,7 @@ module Autoproj
347
347
  io.puts shim_bundler(ruby_executable, autoproj_gemfile_path, gems_gem_home)
348
348
  else
349
349
  load_line = bin_script_lines.grep(/load Gem.bin_path/).first
350
- io.puts shim_script(ruby_executable, autoproj_gemfile_path, gems_gem_home, load_line)
350
+ io.puts shim_script(ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home, load_line)
351
351
  end
352
352
  end
353
353
  FileUtils.chmod 0755, bin_shim
@@ -371,7 +371,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
371
371
  load Gem.bin_path('bundler', 'bundler')"
372
372
  end
373
373
 
374
- def self.shim_script(ruby_executable, autoproj_gemfile_path, gems_gem_home, load_line)
374
+ def self.shim_script(ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home, load_line)
375
375
  "#! #{ruby_executable}
376
376
 
377
377
  if defined?(Bundler)
@@ -383,6 +383,7 @@ elsif ENV['RUBYLIB']
383
383
  end
384
384
 
385
385
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
386
+ ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
386
387
  require 'rubygems'
387
388
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
388
389
  require 'bundler/setup'
@@ -431,7 +432,7 @@ require 'bundler/setup'
431
432
  "config_path = File.join(__dir__, 'config.yml')",
432
433
  "if File.file?(config_path)",
433
434
  " require 'yaml'",
434
- " config = YAML.load(File.read(config_path))",
435
+ " config = YAML.load(File.read(config_path)) || Hash.new",
435
436
  " (config['plugins'] || Hash.new).each do |plugin_name, (version, options)|",
436
437
  " gem plugin_name, version, **options",
437
438
  " end",
@@ -500,6 +501,7 @@ require 'bundler/setup'
500
501
  self.class.rewrite_shims(
501
502
  File.join(dot_autoproj, 'bin'),
502
503
  ruby_executable,
504
+ root_dir,
503
505
  autoproj_gemfile_path,
504
506
  gems_gem_home)
505
507
  env['PATH'].unshift File.join(dot_autoproj, 'bin')
@@ -514,10 +516,10 @@ require 'bundler/setup'
514
516
 
515
517
  config = Hash.new
516
518
  if File.file?(v1_config_path)
517
- config.merge!(YAML.load(File.read(v1_config_path)))
519
+ config.merge!(YAML.load(File.read(v1_config_path)) || Hash.new)
518
520
  end
519
521
  if File.file?(autoproj_config_path)
520
- config.merge!(YAML.load(File.read(autoproj_config_path)))
522
+ config.merge!(YAML.load(File.read(autoproj_config_path)) || Hash.new)
521
523
  end
522
524
 
523
525
  ruby = RbConfig::CONFIG['RUBY_INSTALL_NAME']
@@ -23,7 +23,7 @@ module Autoproj
23
23
  class Install
24
24
  class UnexpectedBinstub < RuntimeError; end
25
25
 
26
- # The directory in which to install autoproj
26
+ # The created workspace's root directory
27
27
  attr_reader :root_dir
28
28
  # Content of the Gemfile generated to install autoproj itself
29
29
  attr_accessor :gemfile
@@ -316,12 +316,12 @@ module Autoproj
316
316
  exit 1
317
317
  end
318
318
  ensure
319
- self.class.rewrite_shims(shims_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
319
+ self.class.rewrite_shims(shims_path, ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home)
320
320
  end
321
321
 
322
322
  EXCLUDED_FROM_SHIMS = %w{rake thor}
323
323
 
324
- def self.rewrite_shims(shim_path, ruby_executable, autoproj_gemfile_path, gems_gem_home)
324
+ def self.rewrite_shims(shim_path, ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home)
325
325
  FileUtils.mkdir_p shim_path
326
326
  File.open(File.join(shim_path, 'ruby'), 'w') do |io|
327
327
  io.puts "#! /bin/sh"
@@ -347,7 +347,7 @@ module Autoproj
347
347
  io.puts shim_bundler(ruby_executable, autoproj_gemfile_path, gems_gem_home)
348
348
  else
349
349
  load_line = bin_script_lines.grep(/load Gem.bin_path/).first
350
- io.puts shim_script(ruby_executable, autoproj_gemfile_path, gems_gem_home, load_line)
350
+ io.puts shim_script(ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home, load_line)
351
351
  end
352
352
  end
353
353
  FileUtils.chmod 0755, bin_shim
@@ -371,7 +371,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
371
371
  load Gem.bin_path('bundler', 'bundler')"
372
372
  end
373
373
 
374
- def self.shim_script(ruby_executable, autoproj_gemfile_path, gems_gem_home, load_line)
374
+ def self.shim_script(ruby_executable, root_dir, autoproj_gemfile_path, gems_gem_home, load_line)
375
375
  "#! #{ruby_executable}
376
376
 
377
377
  if defined?(Bundler)
@@ -383,6 +383,7 @@ elsif ENV['RUBYLIB']
383
383
  end
384
384
 
385
385
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
386
+ ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
386
387
  require 'rubygems'
387
388
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
388
389
  require 'bundler/setup'
@@ -431,7 +432,7 @@ require 'bundler/setup'
431
432
  "config_path = File.join(__dir__, 'config.yml')",
432
433
  "if File.file?(config_path)",
433
434
  " require 'yaml'",
434
- " config = YAML.load(File.read(config_path))",
435
+ " config = YAML.load(File.read(config_path)) || Hash.new",
435
436
  " (config['plugins'] || Hash.new).each do |plugin_name, (version, options)|",
436
437
  " gem plugin_name, version, **options",
437
438
  " end",
@@ -500,6 +501,7 @@ require 'bundler/setup'
500
501
  self.class.rewrite_shims(
501
502
  File.join(dot_autoproj, 'bin'),
502
503
  ruby_executable,
504
+ root_dir,
503
505
  autoproj_gemfile_path,
504
506
  gems_gem_home)
505
507
  env['PATH'].unshift File.join(dot_autoproj, 'bin')
@@ -514,10 +516,10 @@ require 'bundler/setup'
514
516
 
515
517
  config = Hash.new
516
518
  if File.file?(v1_config_path)
517
- config.merge!(YAML.load(File.read(v1_config_path)))
519
+ config.merge!(YAML.load(File.read(v1_config_path)) || Hash.new)
518
520
  end
519
521
  if File.file?(autoproj_config_path)
520
- config.merge!(YAML.load(File.read(autoproj_config_path)))
522
+ config.merge!(YAML.load(File.read(autoproj_config_path)) || Hash.new)
521
523
  end
522
524
 
523
525
  ruby = RbConfig::CONFIG['RUBY_INSTALL_NAME']
@@ -3,6 +3,13 @@
3
3
  require 'utilrb/module/attr_predicate'
4
4
  require 'pathname'
5
5
  require 'concurrent'
6
+
7
+ require 'backports/2.4.0/float/dup'
8
+ require 'backports/2.4.0/fixnum/dup'
9
+ require 'backports/2.4.0/nil_class/dup'
10
+ require 'backports/2.4.0/false_class/dup'
11
+ require 'backports/2.4.0/true_class/dup'
12
+
6
13
  require 'autobuild'
7
14
  require 'autoproj/autobuild'
8
15
  require 'autoproj/base'
@@ -35,9 +42,13 @@
35
42
  require 'autoproj/source_package_query'
36
43
  require 'autoproj/os_package_query'
37
44
 
45
+ require 'autoproj/ops/install'
38
46
  require 'autoproj/ops/tools'
39
47
  require 'autoproj/ops/loader'
40
48
  require 'autoproj/ops/configuration'
49
+ require 'autoproj/ops/cached_env'
50
+ require 'autoproj/ops/which'
51
+ require 'autoproj/ops/atomic_write'
41
52
 
42
53
  require 'autoproj/workspace'
43
54
 
@@ -0,0 +1,66 @@
1
+ require 'aruba/api'
2
+
3
+ module Autoproj
4
+ # Minitest-usable Aruba wrapper
5
+ #
6
+ # Aruba 0.14 is incompatible with Minitest because of their definition
7
+ # of the #run method This change hacks around the problem, by moving
8
+ # the Aruba API to a side stub object.
9
+ #
10
+ # The run methods are renamed as they have been renamed in Aruba 1.0
11
+ # alpha, run -> run_command and run_simple -> run_command_and_stop
12
+ module ArubaMinitest
13
+ class API
14
+ include ::Aruba::Api
15
+ end
16
+
17
+ def setup
18
+ super
19
+ @aruba_api = API.new
20
+ @aruba_api.setup_aruba
21
+ end
22
+
23
+ def teardown
24
+ stop_all_commands
25
+ super
26
+ end
27
+
28
+ def run_command_and_stop(*args, fail_on_error: true)
29
+ cmd = run_command(*args)
30
+ cmd.stop
31
+ if fail_on_error
32
+ assert_command_finished_successfully(cmd)
33
+ end
34
+ cmd
35
+ end
36
+
37
+ def run_command(*args)
38
+ @aruba_api.run(*args)
39
+ end
40
+
41
+ def chmod(*args) # also defined by Rake
42
+ @aruba_api.chmod(*args)
43
+ end
44
+
45
+ def method_missing(m, *args, &block)
46
+ if @aruba_api.respond_to?(m)
47
+ return @aruba_api.send(m, *args, &block)
48
+ else
49
+ super
50
+ end
51
+ end
52
+
53
+ def assert_command_stops(cmd, fail_on_error: true)
54
+ cmd.stop
55
+ if fail_on_error
56
+ assert_command_finished_successfully(cmd)
57
+ end
58
+ end
59
+
60
+ def assert_command_finished_successfully(cmd)
61
+ refute cmd.timed_out?, "#{cmd} timed out on stop"
62
+ assert_equal 0, cmd.exit_status, "#{cmd} finished with a non-zero exit status (#{cmd.exit_status})\n-- STDOUT\n#{cmd.stdout}\n-- STDERR\n#{cmd.stderr}"
63
+ end
64
+ end
65
+ end
66
+
@@ -99,17 +99,18 @@ def snapshot_local(package, options = Hash.new)
99
99
  else
100
100
  info['branch'] = branch
101
101
  end
102
-
102
+
103
103
  if options[:exact_state]
104
104
  has_tag, described = describe_rev(package, 'HEAD')
105
105
  if has_tag
106
- info.merge('tag' => described, 'commit' => nil)
106
+ info['tag'] = described
107
+ info['commit'] = nil
107
108
  else
108
- info.merge('tag' => nil, 'commit' => described)
109
+ info['tag'] = nil
110
+ info['commit'] = described
109
111
  end
110
- else
111
- info
112
112
  end
113
+ info
113
114
  end
114
115
  end
115
116
  end
@@ -5,34 +5,49 @@
5
5
  module Autoproj
6
6
  module CLI
7
7
  class Commit < InspectionTool
8
- def run(*user_selection, options = Hash.new)
9
- pkg = manifest.main_package_set.create_autobuild_package
8
+ def default_message(tag_name)
9
+ if tag_name
10
+ "autoproj created tag #{tag_name}"
11
+ else
12
+ 'autoproj created version commit'
13
+ end
14
+ end
15
+
16
+ def run(user_selection, options = Hash.new)
17
+ tag_name = options[:tag]
18
+ ws.load_config
19
+ pkg = ws.manifest.main_package_set.create_autobuild_package
10
20
  importer = pkg.importer
11
21
  if !importer || !importer.kind_of?(Autobuild::Git)
12
- raise CLIInvalidArguments, "cannot use autoproj tag if the main configuration is not managed by git"
22
+ raise CLIInvalidArguments, "cannot use autoproj commit if the main configuration is not managed by git"
13
23
  end
14
24
 
15
- versions_file = File.join(
16
- ws.config_dir,
17
- Workspace::OVERRIDES_DIR,
18
- Versions::DEFAULT_VERSIONS_FILE_BASENAME)
25
+ if tag_name
26
+ begin
27
+ importer.rev_parse(pkg, "refs/tags/#{tag_name}")
28
+ raise CLIInvalidArguments, "tag #{tag_name} already exists"
29
+ rescue Autobuild::PackageException
30
+ end
31
+ end
19
32
 
20
- initialize_and_load
33
+ versions_file = File.join(ws.config_dir,
34
+ Workspace::OVERRIDES_DIR,
35
+ Versions::DEFAULT_VERSIONS_FILE_BASENAME)
21
36
 
22
37
  versions = CLI::Versions.new(ws)
23
38
  Autoproj.message "creating versions file, this may take a while"
24
39
  versions.run(user_selection,
25
- save: File.join(ws.config_dir, versions_file),
40
+ save: versions_file,
26
41
  package_sets: options[:package_sets],
27
- output_file: io.path,
28
42
  replace: true,
29
- keep_going: options[:keep_going])
43
+ keep_going: options[:keep_going],
44
+ deps: options[:deps])
30
45
 
31
46
  importer.run_git(pkg, 'add', versions_file)
32
- message = options[:message] ||
33
- "autoproj created tag #{tag_name}"
47
+ message = options[:message] || default_message(tag_name)
34
48
 
35
49
  importer.run_git(pkg, 'commit', '-m', message)
50
+ importer.run_git(pkg, 'tag', tag_name) unless tag_name.nil?
36
51
  end
37
52
  end
38
53
  end
@@ -1,21 +1,56 @@
1
- require 'autoproj/cli/inspection_tool'
1
+ require 'autoproj/find_workspace'
2
+ require 'autoproj/ops/cached_env'
3
+ require 'autoproj/ops/which'
4
+ require 'autoproj/ops/watch'
5
+
2
6
  module Autoproj
3
7
  module CLI
4
- class Exec < InspectionTool
5
- def run(cmd, *args)
6
- initialize_and_load
7
- finalize_setup(Array.new)
8
+ class Exec
9
+ def initialize
10
+ @root_dir = Autoproj.find_workspace_dir
11
+ if !@root_dir
12
+ require 'autoproj/workspace'
13
+ # Will do all sorts of error reporting,
14
+ # or may be able to resolve
15
+ @root_dir = Workspace.default.root_dir
16
+ end
17
+ end
18
+
19
+ def load_cached_env
20
+ env = Ops.load_cached_env(@root_dir)
21
+ return if !env
22
+
23
+ Autobuild::Environment.
24
+ environment_from_export(env, ENV)
25
+ end
26
+
27
+ def run(cmd, *args, use_cached_env: Ops.watch_running?(@root_dir))
28
+ if use_cached_env
29
+ env = load_cached_env
30
+ end
31
+
32
+ if !env
33
+ require 'autoproj'
34
+ require 'autoproj/cli/inspection_tool'
35
+ ws = Workspace.from_dir(@root_dir)
36
+ loader = InspectionTool.new(ws)
37
+ loader.initialize_and_load
38
+ loader.finalize_setup(Array.new)
39
+ env = ws.full_env.resolved_env
40
+ end
8
41
 
42
+ path = env['PATH'].split(File::PATH_SEPARATOR)
9
43
  program =
10
- begin ws.which(cmd)
44
+ begin Ops.which(cmd, path_entries: path)
11
45
  rescue ::Exception => e
46
+ require 'autoproj'
12
47
  raise CLIInvalidArguments, e.message, e.backtrace
13
48
  end
14
- env = ws.full_env.resolved_env
15
49
 
16
50
  begin
17
51
  ::Process.exec(env, program, *args)
18
52
  rescue ::Exception => e
53
+ require 'autoproj'
19
54
  raise CLIInvalidArguments, e.message, e.backtrace
20
55
  end
21
56
  end