autoproj 2.0.0.rc38 → 2.0.0.rc39

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: 8b53d93cd01cc0b8c5e434458cb24c73edfd49c9
4
- data.tar.gz: a1d11757027126a5fbb843bf96f040b3d54f5964
3
+ metadata.gz: d50b298207a3006893877e6c968a46ec5614ed91
4
+ data.tar.gz: f6e394d4adb73e2d0f4ed6f9d2e8113e041aede9
5
5
  SHA512:
6
- metadata.gz: ab152231c4aa64cb65edcc79ffb0bf17493b3e538bb6197218b04c6436c8ea5990155e9173f2b03354b69b96567177bbdc2a4613d0e652003ecfd91ba4bc1bc4
7
- data.tar.gz: 7fd86ca99c09b5445af96e027abe5a01fab4aaaec6fc678241f7dae7b1d9fe318d22f6474db539d7f3cd521a2e94fae844fc4b9473055d2d127d1033b203d18c
6
+ metadata.gz: 267238c6a85992b631faaa5283558e5e90ad05d4cac54cedb4ed3a8cf480445b569536c324089b17a7f91d3f89965f6c93f1adfd27076b8750e5a317dd95036f
7
+ data.tar.gz: 329ac2bb6222d965f9aa4121cfce725a9e4911301a606913a00b062f6f42c5ad3a037a3c327e773c9d9518b75f410185b3d5d973db31c6a712aa7704da79852a
data/.travis.yml CHANGED
@@ -1,21 +1,23 @@
1
- sudo: false
1
+ sudo: true
2
2
  language: ruby
3
3
  rvm:
4
4
  - '2.0'
5
- - '2.1'
6
- - '2.2'
7
- - '2.3.1'
8
- - 'jruby-9.1.2.0'
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ - jruby-9.1.5.0
9
9
  matrix:
10
10
  allow_failures:
11
- - rvm: 'jruby-9.1.2.0'
11
+ - rvm: jruby-9.1.5.0
12
12
 
13
13
  cache: bundler
14
14
 
15
15
  install:
16
+ - git config --global user.name "Autoproj on Travis CI"
17
+ - git config --global user.email "autoproj@travis"
16
18
  - gem install bundler
17
19
  # Some tests expect gems to be present in vendor/bundle
18
20
  - bundler install --path vendor/bundle
19
21
  script:
20
22
  - bundler exec rake
21
- - bundler exec rake test
23
+ - AUTOPROJ_SKIP_LONG_TESTS=1 bundler exec rake test
@@ -5,11 +5,9 @@ module Autoproj
5
5
  module CLI
6
6
  class Build < Update
7
7
  def validate_options(selected_packages, options)
8
- selected_packages, options = super
9
- if options[:amake] && selected_packages.empty? && !options[:all]
10
- selected_packages = ['.']
11
- end
12
-
8
+ selected_packages, options =
9
+ super(selected_packages, options.merge(
10
+ checkout_only: true, aup: options[:amake]))
13
11
  if options[:deps].nil?
14
12
  options[:deps] =
15
13
  !(options[:rebuild] || options[:force])
@@ -23,8 +21,6 @@ def run(selected_packages, options)
23
21
  rebuild: false,
24
22
  parallel: nil
25
23
 
26
- Autobuild.ignore_errors = options[:keep_going]
27
-
28
24
  command_line_selection, source_packages, osdep_packages =
29
25
  super(selected_packages, options.merge(checkout_only: true))
30
26
 
@@ -38,6 +34,8 @@ def run(selected_packages, options)
38
34
  pkg.disable
39
35
  end
40
36
 
37
+ Autobuild.ignore_errors = options[:keep_going]
38
+
41
39
  ops = Ops::Build.new(ws.manifest)
42
40
  if build_options[:rebuild] || build_options[:force]
43
41
  packages_to_rebuild =
@@ -361,6 +361,11 @@ def patch(*packages)
361
361
  def unpatch(*packages)
362
362
  run_autoproj_cli(:patcher, :Patcher, Hash[], *packages, patch: false)
363
363
  end
364
+
365
+ desc 'manifest', 'select or displays the active manifest'
366
+ def manifest(*name)
367
+ run_autoproj_cli(:manifest, :Manifest, Hash[silent: true], *name)
368
+ end
364
369
  end
365
370
  end
366
371
  end
@@ -0,0 +1,52 @@
1
+ require 'autoproj'
2
+ module Autoproj
3
+ module CLI
4
+ class Manifest
5
+ attr_reader :ws
6
+
7
+ def initialize(ws = Workspace.default)
8
+ @ws = ws
9
+ end
10
+
11
+ def validate_options(args, options)
12
+ return args, options
13
+ end
14
+
15
+ def run(name, options = Hash.new)
16
+ ws.load_config
17
+ if name.empty?
18
+ Autoproj.message "current manifest is #{ws.manifest_file_path}"
19
+ elsif name.size == 1
20
+ name = name.first
21
+ if File.file?(full_path = File.expand_path(name))
22
+ if File.dirname(full_path) != ws.config_dir
23
+ raise ArgumentError, "#{full_path} is not part of #{ws.config_dir}"
24
+ end
25
+ else
26
+ full_path = File.join(ws.config_dir, name)
27
+ end
28
+
29
+ if !File.file?(full_path)
30
+ alternative_full_path = File.join(ws.config_dir, "manifest.#{name}")
31
+ if !File.file?(alternative_full_path)
32
+ raise ArgumentError, "neither #{full_path} nor #{alternative_full_path} exist"
33
+ end
34
+ full_path = alternative_full_path
35
+ end
36
+ begin
37
+ Autoproj::Manifest.new(ws).load(full_path)
38
+ rescue Exception
39
+ Autoproj.error "failed to load #{full_path}"
40
+ raise
41
+ end
42
+ ws.config.set 'manifest_name', File.basename(full_path)
43
+ ws.save_config
44
+ Autoproj.message "set manifest to #{full_path}"
45
+ else
46
+ raise ArgumentError, "expected zero or one argument, but got #{name.size}"
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
@@ -5,7 +5,7 @@ module CLI
5
5
  class Patcher < InspectionTool
6
6
  def run(packages, patch: true)
7
7
  initialize_and_load
8
- packages, _ = finalize_setup(packages, recursive: false, non_imported_packages: nil)
8
+ packages, _ = finalize_setup(packages, recursive: false, non_imported_packages: :ignore)
9
9
  packages.each do |package_name|
10
10
  pkg = ws.manifest.package_definition_by_name(package_name)
11
11
  if patch
@@ -49,7 +49,7 @@ def format_package(format, priority, package)
49
49
  fields['PREFIX'] = autobuild_package.prefix
50
50
  fields['NAME'] = package.name
51
51
  fields['PRIORITY'] = priority
52
- fields['URL'] = (package.vcs.url if package.vcs)
52
+ fields['URL'] = (package.vcs.url if !package.vcs.none?)
53
53
  fields['PRESENT'] = File.directory?(autobuild_package.srcdir)
54
54
  Autoproj.expand(format, fields)
55
55
  end
@@ -5,23 +5,22 @@
5
5
  module Autoproj
6
6
  module CLI
7
7
  class Update < Base
8
- def validate_options(packages, options)
9
- packages, options = super
10
-
11
- if !options[:osdeps]
12
- options[:osdeps_mode] = Array.new
13
- end
8
+ def validate_options(selection, options)
9
+ selection, options = super
14
10
 
15
11
  if from = options[:from]
16
12
  options[:from] = Autoproj::InstallationManifest.from_workspace_root(options[:from])
17
13
  end
18
- ws.os_package_installer.filter_uptodate_packages = options[:osdeps_filter_uptodate]
19
14
 
20
- if options[:aup] && !options[:all] && packages.empty?
21
- packages = ['.']
15
+ if options[:aup] && !options[:all] && selection.empty?
16
+ if Dir.pwd == ws.root_dir
17
+ options[:all] = true
18
+ else
19
+ selection = [Dir.pwd]
20
+ end
22
21
  end
23
22
 
24
- if options[:force_reset]
23
+ if options.delete(:force_reset)
25
24
  options[:reset] = :force
26
25
  end
27
26
 
@@ -31,21 +30,16 @@ def validate_options(packages, options)
31
30
  end
32
31
  end
33
32
 
34
- return packages, options
35
- end
36
-
37
- def run(selected_packages, options)
38
- ws.manifest.accept_unavailable_osdeps = !options[:osdeps]
39
- explicit_selection = !selected_packages.empty?
40
- selected_packages, config_selected =
41
- normalize_command_line_package_selection(selected_packages)
33
+ has_explicit_selection = !selection.empty?
34
+ selection, config_selected =
35
+ normalize_command_line_package_selection(selection)
42
36
 
43
37
  # Autoproj and configuration are updated only if (1) it is
44
38
  # explicitely selected or (2) nothing is explicitely selected
45
39
  update_autoproj =
46
40
  (options[:autoproj] || (
47
41
  options[:autoproj] != false &&
48
- !explicit_selection &&
42
+ !has_explicit_selection &&
49
43
  !options[:config] &&
50
44
  !options[:checkout_only])
51
45
  )
@@ -53,35 +47,93 @@ def run(selected_packages, options)
53
47
  update_config =
54
48
  (options[:config] || config_selected || (
55
49
  options[:config] != false &&
56
- !explicit_selection &&
50
+ !has_explicit_selection &&
57
51
  !options[:autoproj]))
58
52
 
59
53
  update_packages =
60
54
  options[:all] ||
61
- (explicit_selection && !selected_packages.empty?) ||
62
- (!explicit_selection && !options[:config] && !options[:autoproj])
55
+ (has_explicit_selection && !selection.empty?) ||
56
+ (!has_explicit_selection && !options[:config] && !options[:autoproj])
63
57
 
64
- ws.setup
65
- parallel = options[:parallel] || ws.config.parallel_import_level
58
+ options[:autoproj] = update_autoproj
59
+ options[:config] = update_config
60
+ options[:packages] = update_packages
61
+ return selection, options
62
+ end
63
+
64
+ def run(selected_packages, options)
65
+ ws.manifest.accept_unavailable_osdeps = !options[:osdeps]
66
66
 
67
+ ws.setup
67
68
  ws.autodetect_operating_system(force: true)
68
69
 
69
- if update_autoproj
70
+ if options[:autoproj]
70
71
  ws.update_autoproj
71
72
  end
72
73
 
73
- ws.load_package_sets(
74
- mainline: options[:mainline],
75
- only_local: options[:only_local],
76
- checkout_only: !update_config || options[:checkout_only],
77
- reset: options[:reset],
78
- ignore_errors: options[:keep_going],
79
- retry_count: options[:retry_count])
80
- ws.config.save
81
- if !update_packages
82
- return [], [], true
74
+ begin
75
+ ws.load_package_sets(
76
+ mainline: options[:mainline],
77
+ only_local: options[:only_local],
78
+ checkout_only: !options[:config] || options[:checkout_only],
79
+ reset: options[:reset],
80
+ keep_going: options[:keep_going],
81
+ retry_count: options[:retry_count])
82
+ rescue ImportFailed => configuration_import_failure
83
+ if !options[:keep_going] || !options[:packages]
84
+ raise
85
+ end
86
+ ensure
87
+ ws.config.save
88
+ end
89
+
90
+ if !options[:packages]
91
+ return [], [], []
92
+ end
93
+
94
+ osdeps_options = normalize_osdeps_options(
95
+ checkout_only: options[:checkout_only],
96
+ osdeps_mode: options[:osdeps_mode],
97
+ osdeps: options[:osdeps],
98
+ osdeps_filter_uptodate: options[:osdeps_filter_uptodate])
99
+
100
+ command_line_selection, selected_packages =
101
+ finish_loading_configuration(selected_packages)
102
+ source_packages, osdep_packages, import_failure =
103
+ update_packages(
104
+ selected_packages,
105
+ osdeps: options[:osdeps], osdeps_options: osdeps_options,
106
+ from: options[:from],
107
+ checkout_only: options[:checkout_only],
108
+ only_local: options[:only_local],
109
+ reset: options[:reset],
110
+ deps: options[:deps],
111
+ keep_going: options[:keep_going],
112
+ parallel: options[:parallel] || ws.config.parallel_import_level,
113
+ retry_count: options[:retry_count])
114
+
115
+ ws.finalize_setup
116
+ ws.export_installation_manifest
117
+
118
+ if options[:osdeps] && !osdep_packages.empty?
119
+ ws.install_os_packages(osdep_packages, **osdeps_options)
120
+ end
121
+
122
+ ws.export_env_sh(source_packages)
123
+ Autoproj.message " updated #{ws.root_dir}/#{Autoproj::ENV_FILENAME}", :green
124
+
125
+ if import_failure && configuration_import_failure
126
+ raise ImportFailed.new(configuration_import_failure.original_errors + import_failure.original_errors)
127
+ elsif import_failure
128
+ raise import_failure
129
+ elsif configuration_import_failure
130
+ raise configuration_import_failure
83
131
  end
84
132
 
133
+ return command_line_selection, source_packages, osdep_packages
134
+ end
135
+
136
+ def finish_loading_configuration(selected_packages)
85
137
  ws.setup_all_package_directories
86
138
  # Call resolve_user_selection once to auto-add packages
87
139
  resolve_user_selection(selected_packages)
@@ -98,40 +150,49 @@ def run(selected_packages, options)
98
150
  else
99
151
  command_line_selection = Array.new
100
152
  end
101
- selected_packages = resolved_selected_packages
153
+ return command_line_selection, resolved_selected_packages
154
+ end
155
+
156
+ def normalize_osdeps_options(
157
+ checkout_only: false, osdeps: true, osdeps_mode: nil,
158
+ osdeps_filter_uptodate: true)
102
159
 
103
- if other_root = options[:from]
104
- setup_update_from(other_root)
160
+ osdeps_options = Hash[install_only: checkout_only]
161
+ if osdeps_mode
162
+ osdeps_options[:osdeps_mode] = osdeps_mode
163
+ elsif !osdeps
164
+ osdeps_options[:osdeps_mode] = Array.new
105
165
  end
166
+ ws.os_package_installer.filter_uptodate_packages = osdeps_filter_uptodate
167
+ osdeps_options
168
+ end
106
169
 
107
- osdeps_options = Hash[install_only: options[:checkout_only]]
108
- if options[:osdeps_mode]
109
- osdeps_options[:osdeps_mode] = options[:osdeps_mode]
170
+ def update_packages(selected_packages,
171
+ from: nil, checkout_only: false, only_local: false, reset: false,
172
+ deps: true, keep_going: false, parallel: 1,
173
+ retry_count: 0, osdeps: true, osdeps_options: Hash.new)
174
+
175
+ if from
176
+ setup_update_from(from)
110
177
  end
111
178
 
112
179
  ops = Autoproj::Ops::Import.new(ws)
113
180
  source_packages, osdep_packages =
114
- ops.import_packages(selected_packages,
115
- checkout_only: options[:checkout_only],
116
- only_local: options[:only_local],
117
- reset: options[:reset],
118
- recursive: options[:deps],
119
- ignore_errors: options[:keep_going],
120
- parallel: parallel,
121
- retry_count: options[:retry_count],
122
- install_vcs_packages: (osdeps_options if options[:osdeps]))
123
-
124
- ws.finalize_setup
125
- ws.export_installation_manifest
126
-
127
- if options[:osdeps] && !osdep_packages.empty?
128
- ws.install_os_packages(osdep_packages, **osdeps_options)
181
+ ops.import_packages(selected_packages,
182
+ checkout_only: checkout_only,
183
+ only_local: only_local,
184
+ reset: reset,
185
+ recursive: deps,
186
+ keep_going: keep_going,
187
+ parallel: parallel,
188
+ retry_count: retry_count,
189
+ install_vcs_packages: (osdeps_options if osdeps))
190
+ return source_packages, osdep_packages, nil
191
+ rescue PackageImportFailed => import_failure
192
+ if !keep_going
193
+ raise
129
194
  end
130
-
131
- ws.export_env_sh(source_packages)
132
- Autoproj.message " updated #{ws.root_dir}/#{Autoproj::ENV_FILENAME}", :green
133
-
134
- return command_line_selection, source_packages, osdep_packages
195
+ return import_failure.source_packages, import_failure.osdep_packages, import_failure
135
196
  end
136
197
 
137
198
  def load_all_available_package_manifests
@@ -33,7 +33,7 @@ def run(user_selection, options)
33
33
  finalize_setup(user_selection,
34
34
  recursive: options[:deps])
35
35
 
36
- ops = Ops::Snapshot.new(ws.manifest, ignore_errors: options[:keep_going])
36
+ ops = Ops::Snapshot.new(ws.manifest, keep_going: options[:keep_going])
37
37
 
38
38
  if user_selection.empty?
39
39
  snapshot_package_sets = (options[:config] != false)
@@ -8,6 +8,26 @@ def initialize(file = nil)
8
8
  end
9
9
  class InternalError < RuntimeError; end
10
10
 
11
+ class ImportFailed < Autobuild::CompositeException
12
+ def empty?
13
+ original_errors.empty?
14
+ end
15
+ end
16
+
17
+ class PackageImportFailed < ImportFailed
18
+ # The list of the source packages that have been updated
19
+ attr_reader :source_packages
20
+ # The list of osdep packages that should be installed because of
21
+ # {#source_packages}
22
+ attr_reader :osdep_packages
23
+
24
+ def initialize(original_errors, source_packages: [], osdep_packages: [])
25
+ super(original_errors)
26
+ @source_packages = source_packages
27
+ @osdep_packages = osdep_packages
28
+ end
29
+ end
30
+
11
31
  # Exception raised when trying to resolve a package name and it failed
12
32
  class PackageNotFound < ConfigError
13
33
  end
@@ -67,14 +67,13 @@ def self.find_v2_root_dir(base_dir, config_field_name)
67
67
  resolved = find_v2_root_dir(result, config_field_name)
68
68
 
69
69
  if !resolved || (resolved != result)
70
- raise ArgumentError, "found #{path} as possible workspace root for #{base_dir}, but it contains a configuration file in #{config_path} that points to #{result} and #{result} is not an autoproj workspace root"
70
+ raise ArgumentError, "found #{path} as possible workspace root for #{base_dir}, but it contains a configuration file that points to #{result} and #{result} is not an autoproj workspace root"
71
71
  end
72
72
  resolved
73
73
  end
74
74
 
75
75
  # Filters in the given list of paths the paths that are within a workspace
76
76
  def self.filter_out_paths_in_workspace(paths)
77
- known_valid_dirs = Set.new
78
77
  known_workspace_dirs = Array.new
79
78
  paths.find_all do |p|
80
79
  if !File.directory?(p)