autoproj 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 340c2f6446333417f7b1a32b7a6726778c9a5b62
4
- data.tar.gz: 9dad43165084ce864f68a82e7824ece5e5f6c665
3
+ metadata.gz: 8aea1688941d1dfc707196346c1c9cae42972827
4
+ data.tar.gz: 3745f079883b2571aee27bc39aed446734859363
5
5
  SHA512:
6
- metadata.gz: eddbd53a7a1b4bb49f17af6b863559f987a5cbee3fd94e96890c0146f817124d5d5d7d88e047a8db45e0ea4fe7a7922cbabfbc8f1ce93120691fb0f67adca0c0
7
- data.tar.gz: f6a605e57e30a4195ebdd62254780473261370a8c700e5160c4bfd654725832b36530c41e27957ae5bc958b38fc7d24d2efef6be02fd2cf21f7db1ca9f08ee26
6
+ metadata.gz: 46174f3a203203a2bc9194542933df1802465aaed4e8403a6362b370235f812ff50e017617f7314e8c3a9c9e1fcbd6a108e58f8f821a8ff9d27bfa0c0fc87b1f
7
+ data.tar.gz: 72b807eab619af7e488fe1b171404812f49a6804bfae3fb3675053c5f8419938541d5db86565a3e7f09b2ec202e4f390c10303182f066c85b8cea75f93b34338
data/autoproj.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
24
 
25
25
  s.add_runtime_dependency "bundler"
26
- s.add_runtime_dependency "autobuild", ">= 1.11.0"
26
+ s.add_runtime_dependency "autobuild", ">= 1.12.0"
27
27
  s.add_runtime_dependency "utilrb", '~> 3.0.0', ">= 3.0.0"
28
28
  s.add_runtime_dependency "thor", '~> 0.19.0', '>= 0.19.1'
29
29
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.0.0', '>= 1.0.0'
data/bin/autoproj CHANGED
@@ -8,5 +8,9 @@ argv = ARGV.find_all { |arg| arg != "--no-plugins" }
8
8
  if argv.size == ARGV.size
9
9
  Autoproj::CLI.load_plugins
10
10
  end
11
- Autoproj::CLI::Main.start(argv)
11
+ begin
12
+ Autoproj::CLI::Main.start(argv)
13
+ rescue Interrupt
14
+ # Already notified in the reporting infrastructure
15
+ end
12
16
 
@@ -23,7 +23,8 @@ def run(selected_packages, options)
23
23
  build_options, options = filter_options options,
24
24
  force: false,
25
25
  rebuild: false,
26
- parallel: nil
26
+ parallel: nil,
27
+ confirm: true
27
28
 
28
29
  command_line_selection, source_packages, _osdep_packages =
29
30
  super(selected_packages, options.merge(checkout_only: true))
@@ -54,10 +55,13 @@ def run(selected_packages, options)
54
55
  mode_name = if build_options[:rebuild] then 'rebuild'
55
56
  else 'force-build'
56
57
  end
57
- opt = BuildOption.new("", "boolean", {:doc => "this is going to trigger a #{mode_name} of all packages. Is that really what you want ?"}, nil)
58
- if !opt.ask(false)
59
- raise Interrupt
58
+ if build_options[:confirm] != false
59
+ opt = BuildOption.new("", "boolean", {:doc => "this is going to trigger a #{mode_name} of all packages. Is that really what you want ?"}, nil)
60
+ if !opt.ask(false)
61
+ raise Interrupt
62
+ end
60
63
  end
64
+
61
65
  if build_options[:rebuild]
62
66
  ops.rebuild_all
63
67
  else
@@ -0,0 +1,20 @@
1
+ require 'autoproj/cli/inspection_tool'
2
+ module Autoproj
3
+ module CLI
4
+ class Exec < InspectionTool
5
+ def run(cmd, *args)
6
+ initialize_and_load
7
+ finalize_setup(Array.new)
8
+
9
+ # Resolve the command using the PATH if present
10
+ env = ws.full_env
11
+ if !File.file?(cmd)
12
+ cmd = env.find_in_path(cmd) || cmd
13
+ end
14
+ exec(env.resolved_env, cmd, *args)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+
@@ -15,11 +15,28 @@ def run(args, options = Hash.new)
15
15
  return
16
16
  end
17
17
 
18
- exec(Autobuild.tool(:git), "--git-dir=#{ws.config_dir}/.git", 'reflog',
19
- Ops::Snapshot.import_state_log_ref, '--format=%Cgreen%gd %Cblue%cr %Creset%gs',
20
- *args)
18
+ common_args = [Autobuild.tool(:git), "--git-dir=#{ws.config_dir}/.git"]
19
+ if since = options[:since]
20
+ exec(*common_args, 'diff', parse_log_entry(since), 'autoproj@{0}')
21
+ elsif args.empty?
22
+ exec(*common_args, 'reflog',
23
+ Ops::Snapshot.import_state_log_ref, '--format=%Cgreen%gd %Cblue%cr %Creset%gs')
24
+ elsif options[:diff]
25
+ exec(*common_args, 'diff', *args.map { |entry| parse_log_entry(entry) })
26
+ else
27
+ exec(*common_args, 'show', *args.map { |entry| parse_log_entry(entry) })
28
+ end
29
+ end
30
+
31
+ def parse_log_entry(entry)
32
+ if entry =~ /^autoproj@{\d+}$/
33
+ entry
34
+ elsif entry =~ /^\d+$/
35
+ "autoproj@{#{entry}}"
36
+ else
37
+ raise ArgumentError, "unexpected revision name '#{entry}', expected either autoproj@{ID} or ID ('ID' being a number). Run 'autoproj log' without arguments for a list of known entries"
38
+ end
21
39
  end
22
40
  end
23
41
  end
24
42
  end
25
-
@@ -25,7 +25,15 @@ class Main < Thor
25
25
  no_commands do
26
26
  def run_autoproj_cli(filename, classname, report_options, *args, **extra_options)
27
27
  require "autoproj/cli/#{filename}"
28
- Autoproj.report(Hash[silent: !options[:debug], debug: options[:debug]].merge(report_options)) do
28
+ if Autobuild::Subprocess.transparent_mode = options[:tool]
29
+ Autobuild.silent = true
30
+ Autobuild.color = false
31
+ report_options[:silent] = true
32
+ report_options[:on_package_failures] = :exit_silent
33
+ extra_options[:silent] = true
34
+ end
35
+
36
+ Autoproj.report(**Hash[silent: !options[:debug], debug: options[:debug]].merge(report_options)) do
29
37
  options = self.options.dup
30
38
  # We use --local on the CLI but the APIs are expecting
31
39
  # only_local
@@ -131,7 +139,12 @@ def doc(*packages)
131
139
  option :auto_exclude, type: :boolean,
132
140
  desc: 'if true, packages that fail to import will be excluded from the build'
133
141
  def update(*packages)
134
- run_autoproj_cli(:update, :Update, Hash[silent: false], *packages)
142
+ report_options = Hash[silent: false, on_package_failures: :exit]
143
+ if options[:auto_exclude]
144
+ report_options[:on_package_failures] = :report
145
+ end
146
+
147
+ run_autoproj_cli(:update, :Update, report_options, *packages)
135
148
  end
136
149
 
137
150
  desc 'build [PACKAGES]', 'build packages'
@@ -146,7 +159,7 @@ def update(*packages)
146
159
  option :rebuild, type: :boolean, default: false,
147
160
  desc: 'clean and build the requested packages'
148
161
  option :osdeps, type: :boolean,
149
- desc: 'controls whether missing osdeps should be installed. In rebuild mode, also controls whether the osdeps should be reinstalled or not (the default is to reinstall them)'
162
+ desc: 'controls whether missing osdeps should be installed. In rebuild mode, also controls whether the osdeps should be reinstalled or not (the default is to reinstall them)'
150
163
  option :deps, type: :boolean,
151
164
  desc: "controls whether the operation should apply to the package's dependencies as well. -n is a shortcut for --no-deps",
152
165
  long_desc: <<-EOD
@@ -161,8 +174,17 @@ def update(*packages)
161
174
  desc: 'maximum number of parallel jobs'
162
175
  option :auto_exclude, type: :boolean,
163
176
  desc: 'if true, packages that fail to import will be excluded from the build'
177
+ option :tool, type: :boolean,
178
+ desc: "act as a build tool, transparently passing the subcommand's outputs to STDOUT"
179
+ option :confirm, type: :boolean, default: nil,
180
+ desc: '--force and --rebuild will ask confirmation if applied to the whole workspace. Use --no-confirm to disable this confirmation'
164
181
  def build(*packages)
165
- run_autoproj_cli(:build, :Build, Hash[silent: false], *packages)
182
+ report_options = Hash[silent: false, on_package_failures: :exit]
183
+ if options[:auto_exclude]
184
+ report_options[:on_package_failures] = :report
185
+ end
186
+
187
+ run_autoproj_cli(:build, :Build, Hash[silent: false].merge(report_options), *packages)
166
188
  end
167
189
 
168
190
  desc 'cache CACHE_DIR', 'create or update a cache directory that can be given to AUTOBUILD_CACHE_DIR'
@@ -268,7 +290,11 @@ def versions(*packages)
268
290
  end
269
291
 
270
292
  stop_on_unknown_option! :log
271
- desc 'log', "shows the log of autoproj updates"
293
+ desc 'log [REF]', "shows the log of autoproj updates"
294
+ option :since, type: :string, default: nil,
295
+ desc: 'show what got updated since the given version'
296
+ option :diff, type: :boolean, default: false,
297
+ desc: 'show the difference between two stages in the log'
272
298
  def log(*args)
273
299
  run_autoproj_cli(:log, :Log, Hash[], *args)
274
300
  end
@@ -324,6 +350,25 @@ def commit(*packages)
324
350
  end
325
351
 
326
352
  desc 'switch-config VCS URL [OPTIONS]', 'switches the main build configuration'
353
+ long_desc <<-EOD
354
+ Changes source of the main configuration that is checked out in autoproj/
355
+
356
+ For instance,
357
+ autoproj switch-config git http://github.com/rock-core/buildconf
358
+
359
+ Options are of the form key=value. To for instance specify a git branch one does
360
+ autoproj switch-config git http://github.com/rock-core/buildconf branch=test
361
+
362
+ The VCS types and options match the types and options available in the source.yml
363
+ files.
364
+
365
+ If the URL is changed, autoproj will delete the existing autoproj folder. Alternatively,
366
+ when using a VCS that supports it (right now, git), it is possible to change a VCS
367
+ option without deleting the folder. Simply omit the VCS type and URL:
368
+
369
+ autoproj switch-config branch=master
370
+ EOD
371
+
327
372
  def switch_config(*args)
328
373
  run_autoproj_cli(:switch_config, :SwitchConfig, Hash[], *args)
329
374
  end
@@ -393,7 +438,12 @@ def unpatch(*packages)
393
438
  def manifest(*name)
394
439
  run_autoproj_cli(:manifest, :Manifest, Hash[silent: true], *name)
395
440
  end
441
+
442
+ desc 'exec', "runs a command, applying the workspace's environment first"
443
+ def exec(*args)
444
+ require 'autoproj/cli/exec'
445
+ CLI::Exec.new.run(*args)
446
+ end
396
447
  end
397
448
  end
398
449
  end
399
-
@@ -7,12 +7,21 @@ class MainTest < Thor
7
7
 
8
8
  no_commands do
9
9
  def report(report_options = Hash.new)
10
- Autoproj.report(Hash[silent: !options[:debug], debug: options[:debug]].merge(report_options)) do
11
- yield
10
+ options = self.options.merge(parent_options)
11
+ extra_options = Hash.new
12
+ if Autobuild::Subprocess.transparent_mode = options[:tool]
13
+ Autobuild.silent = true
14
+ Autobuild.color = false
15
+ report_options[:silent] = true
16
+ report_options[:on_package_failures] = :exit_silent
17
+ extra_options[:silent] = true
18
+ end
19
+ Autoproj.report(**Hash[debug: options[:debug]].merge(report_options)) do
20
+ yield(extra_options)
12
21
  end
13
22
  end
14
23
  end
15
-
24
+
16
25
  desc 'enable [PACKAGES]', 'enable tests for the given packages (or for all packages if none are given)'
17
26
  option :deps, type: :boolean, default: false,
18
27
  desc: 'controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)'
@@ -59,19 +68,25 @@ def list(*packages)
59
68
  desc: 'return with a nonzero exit code if the test does not pass'
60
69
  option :coverage, type: :boolean, default: false,
61
70
  desc: 'whether code coverage should be generated if possible'
71
+ option :tool, type: :boolean, default: false,
72
+ desc: "build in tool mode, which do not redirect the subcommand's outputs"
73
+ option :color, type: :boolean, default: TTY::Color.color?,
74
+ desc: 'enables or disables colored display (enabled by default if the terminal supports it)'
75
+ option :progress, type: :boolean, default: TTY::Color.color?,
76
+ desc: 'enables or disables progress display (enabled by default if the terminal supports it)'
62
77
  def exec(*packages)
63
78
  require 'autoproj/cli/test'
64
- report do
79
+ options = self.options.merge(parent_options)
80
+ report do |extra_options|
65
81
  cli = Test.new
66
- Autobuild.pass_test_errors = options[:fail]
67
- Autobuild.ignore_errors = options[:keep_going]
68
- Autobuild::TestUtility.coverage_enabled = options[:coverage]
69
- args = cli.validate_options(packages, deps: options[:deps])
82
+ Autobuild.pass_test_errors = options.delete(:fail)
83
+ Autobuild.ignore_errors = options.delete(:keep_going)
84
+ Autobuild::TestUtility.coverage_enabled = options.delete(:coverage)
85
+ options.delete(:tool)
86
+ args = cli.validate_options(packages, options.merge(extra_options))
70
87
  cli.run(*args)
71
88
  end
72
89
  end
73
90
  end
74
91
  end
75
92
  end
76
-
77
-
@@ -129,12 +129,14 @@ def run(selected_packages, options)
129
129
 
130
130
  export_env_sh
131
131
 
132
- if import_failure && configuration_import_failure
133
- raise ImportFailed.new(configuration_import_failure.original_errors + import_failure.original_errors)
134
- elsif import_failure
135
- raise import_failure
136
- elsif configuration_import_failure
137
- raise configuration_import_failure
132
+ if !options[:auto_exclude]
133
+ if import_failure && configuration_import_failure
134
+ raise ImportFailed.new(configuration_import_failure.original_errors + import_failure.original_errors)
135
+ elsif import_failure
136
+ raise import_failure
137
+ elsif configuration_import_failure
138
+ raise configuration_import_failure
139
+ end
138
140
  end
139
141
 
140
142
  return command_line_selection, source_packages, osdep_packages
@@ -1,8 +1,8 @@
1
1
  module Autoproj
2
2
  # Manifest of installed packages imported from another autoproj installation
3
3
  class InstallationManifest
4
- Package = Struct.new :name, :srcdir, :prefix, :builddir, :logdir, :dependencies
5
- PackageSet = Struct.new :name, :raw_local_dir, :user_local_dir
4
+ Package = Struct.new :name, :type, :vcs, :srcdir, :prefix, :builddir, :logdir, :dependencies
5
+ PackageSet = Struct.new :name, :vcs, :raw_local_dir, :user_local_dir
6
6
 
7
7
  attr_reader :path
8
8
  attr_reader :packages
@@ -47,11 +47,11 @@ def load
47
47
  raw.each do |entry|
48
48
  if entry['package_set']
49
49
  pkg_set = PackageSet.new(
50
- entry['package_set'], entry['raw_local_dir'], entry['user_local_dir'])
50
+ entry['package_set'], entry['vcs'], entry['raw_local_dir'], entry['user_local_dir'])
51
51
  package_sets[pkg_set.name] = pkg_set
52
52
  else
53
53
  pkg = Package.new(
54
- entry['name'], entry['srcdir'], entry['prefix'],
54
+ entry['name'], entry['type'], entry['vcs'], entry['srcdir'], entry['prefix'],
55
55
  entry['builddir'], entry['logdir'], entry['dependencies'])
56
56
  packages[pkg.name] = pkg
57
57
  end
@@ -64,12 +64,15 @@ def save(path = self.path)
64
64
  File.open(path, 'w') do |io|
65
65
  marshalled_package_sets = each_package_set.map do |v|
66
66
  Hash['package_set' => v.name,
67
+ 'vcs' => v.vcs.to_hash,
67
68
  'raw_local_dir' => v.raw_local_dir,
68
69
  'user_local_dir' => v.user_local_dir]
69
70
  end
70
- marshalled_packages = each_package.map do |v|
71
- v = v.autobuild
71
+ marshalled_packages = each_package.map do |package_def|
72
+ v = package_def.autobuild
72
73
  Hash['name' => v.name,
74
+ 'type' => v.class.name,
75
+ 'vcs' => package_def.vcs.to_hash,
73
76
  'srcdir' => v.srcdir,
74
77
  'builddir' => (v.builddir if v.respond_to?(:builddir)),
75
78
  'logdir' => v.logdir,
@@ -33,6 +33,11 @@ def self.warn(message, *style)
33
33
  Autobuild.warn(message, *style)
34
34
  end
35
35
 
36
+ def self.report_interrupt(io = STDERR)
37
+ io.puts
38
+ io.puts color("Interrupted by user", :red, :bold)
39
+ end
40
+
36
41
  # Subclass of Autobuild::Reporter, used to display a message when the build
37
42
  # finishes/fails.
38
43
  class Reporter < Autobuild::Reporter
@@ -52,44 +57,44 @@ def success
52
57
  end
53
58
  end
54
59
 
55
- def self.report(options = Hash.new)
56
- options = Kernel.validate_options options,
57
- root_dir: nil,
58
- silent: false,
59
- debug: Autobuild.debug
60
-
60
+ def self.report(root_dir: nil, silent: nil, debug: Autobuild.debug,
61
+ on_package_success: :report,
62
+ on_package_failures: Autobuild::Reporting.default_report_on_package_failures)
61
63
  reporter = Autoproj::Reporter.new
62
64
  Autobuild::Reporting << reporter
63
- Autobuild::Reporting.report do
64
- yield
65
+ interrupted = nil
66
+ package_failures = Autobuild::Reporting.report(on_package_failures: :report_silent) do
67
+ begin
68
+ yield
69
+ rescue Interrupt => e
70
+ interrupted = e
71
+ end
65
72
  end
66
- if !options[:silent]
67
- Autobuild::Reporting.success
73
+
74
+ if !silent.nil?
75
+ on_package_success = silent ? :silent : :report
68
76
  end
77
+ silent_errors = [:report_silent, :exit_silent].include?(on_package_failures)
69
78
 
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
79
+ if package_failures.empty?
80
+ if interrupted
81
+ raise interrupted
82
+ elsif on_package_success == :report
83
+ Autobuild::Reporting.success
84
+ end
85
+ return []
86
+ else
87
+ Autobuild::Reporting.report_finish_on_error(
88
+ package_failures, on_package_failures: on_package_failures, interrupted_by: interrupted)
75
89
  end
90
+
76
91
  rescue SystemExit
77
92
  raise
78
- rescue Exception => e
79
- STDERR.puts
80
- STDERR.puts Autobuild.color(e.message, :red, :bold)
81
- if root_dir = options[:root_dir]
82
- root_dir = /#{Regexp.quote(root_dir)}(?!\/\.gems)/
83
- e.backtrace.find_all { |path| path =~ root_dir }.
84
- each do |path|
85
- STDERR.puts Autobuild.color(" in #{path}", :red, :bold)
86
- end
87
- end
88
- if options[:debug] then raise
89
- else exit 1
90
- end
91
93
  ensure
94
+ if !silent_errors && interrupted
95
+ report_interrupt
96
+ end
97
+
92
98
  Autobuild::Reporting.remove(reporter) if reporter
93
99
  end
94
100
  end
95
-
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.2.2"
2
+ VERSION = "2.3.0"
3
3
  end
@@ -624,13 +624,18 @@ def export_installation_manifest
624
624
  install_manifest.save
625
625
  end
626
626
 
627
- # Export the workspace's env.sh file
628
- def export_env_sh(package_names = nil, shell_helpers: true)
627
+ # The environment as initialized by all selected packages
628
+ def full_env
629
629
  env = self.env.dup
630
630
  manifest.all_selected_source_packages.each do |pkg|
631
631
  pkg.autobuild.apply_env(env)
632
632
  end
633
- env.export_env_sh(shell_helpers: shell_helpers)
633
+ env
634
+ end
635
+
636
+ # Export the workspace's env.sh file
637
+ def export_env_sh(package_names = nil, shell_helpers: true)
638
+ full_env.export_env_sh(shell_helpers: shell_helpers)
634
639
  end
635
640
 
636
641
  def pristine_os_packages(packages, options = Hash.new)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
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-10-05 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.11.0
33
+ version: 1.12.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: 1.11.0
40
+ version: 1.12.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: utilrb
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -260,6 +260,7 @@ files:
260
260
  - lib/autoproj/cli/commit.rb
261
261
  - lib/autoproj/cli/doc.rb
262
262
  - lib/autoproj/cli/envsh.rb
263
+ - lib/autoproj/cli/exec.rb
263
264
  - lib/autoproj/cli/inspection_tool.rb
264
265
  - lib/autoproj/cli/locate.rb
265
266
  - lib/autoproj/cli/log.rb
@@ -365,4 +366,3 @@ signing_key:
365
366
  specification_version: 4
366
367
  summary: Easy installation and management of sets of software packages
367
368
  test_files: []
368
- has_rdoc: