autoproj 1.13.7 → 2.0.0.b1

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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.gemtest +0 -0
  3. data/Manifest.txt +27 -21
  4. data/Rakefile +4 -6
  5. data/bin/alocate +5 -1
  6. data/bin/amake +3 -53
  7. data/bin/aup +3 -50
  8. data/bin/autoproj +3 -264
  9. data/bin/autoproj_bootstrap +294 -349
  10. data/bin/autoproj_bootstrap.in +27 -3
  11. data/lib/autoproj.rb +23 -1
  12. data/lib/autoproj/autobuild.rb +51 -89
  13. data/lib/autoproj/base.rb +0 -9
  14. data/lib/autoproj/build_option.rb +1 -3
  15. data/lib/autoproj/cli.rb +1 -0
  16. data/lib/autoproj/cli/base.rb +155 -0
  17. data/lib/autoproj/cli/bootstrap.rb +119 -0
  18. data/lib/autoproj/cli/build.rb +72 -0
  19. data/lib/autoproj/cli/cache.rb +31 -0
  20. data/lib/autoproj/cli/clean.rb +37 -0
  21. data/lib/autoproj/cli/commit.rb +41 -0
  22. data/lib/autoproj/cli/doc.rb +22 -0
  23. data/lib/autoproj/cli/envsh.rb +22 -0
  24. data/lib/autoproj/cli/inspection_tool.rb +73 -0
  25. data/lib/autoproj/cli/locate.rb +96 -0
  26. data/lib/autoproj/cli/log.rb +26 -0
  27. data/lib/autoproj/cli/main.rb +249 -0
  28. data/lib/autoproj/cli/main_test.rb +57 -0
  29. data/lib/autoproj/cli/osdeps.rb +30 -0
  30. data/lib/autoproj/cli/query.rb +43 -0
  31. data/lib/autoproj/cli/reconfigure.rb +19 -0
  32. data/lib/autoproj/cli/reset.rb +7 -32
  33. data/lib/autoproj/cli/show.rb +219 -0
  34. data/lib/autoproj/cli/snapshot.rb +1 -1
  35. data/lib/autoproj/cli/status.rb +149 -0
  36. data/lib/autoproj/cli/switch_config.rb +28 -0
  37. data/lib/autoproj/cli/tag.rb +9 -35
  38. data/lib/autoproj/cli/test.rb +34 -55
  39. data/lib/autoproj/cli/update.rb +158 -0
  40. data/lib/autoproj/cli/versions.rb +32 -69
  41. data/lib/autoproj/configuration.rb +95 -34
  42. data/lib/autoproj/default.osdeps +25 -35
  43. data/lib/autoproj/environment.rb +85 -63
  44. data/lib/autoproj/exceptions.rb +50 -0
  45. data/lib/autoproj/gitorious.rb +11 -9
  46. data/lib/autoproj/manifest.rb +199 -231
  47. data/lib/autoproj/metapackage.rb +0 -8
  48. data/lib/autoproj/ops/build.rb +1 -17
  49. data/lib/autoproj/ops/configuration.rb +92 -90
  50. data/lib/autoproj/ops/import.rb +222 -0
  51. data/lib/autoproj/ops/loader.rb +18 -8
  52. data/lib/autoproj/ops/main_config_switcher.rb +45 -73
  53. data/lib/autoproj/ops/snapshot.rb +5 -10
  54. data/lib/autoproj/ops/tools.rb +10 -44
  55. data/lib/autoproj/options.rb +35 -6
  56. data/lib/autoproj/osdeps.rb +97 -68
  57. data/lib/autoproj/package_selection.rb +39 -20
  58. data/lib/autoproj/package_set.rb +26 -24
  59. data/lib/autoproj/reporter.rb +91 -0
  60. data/lib/autoproj/system.rb +50 -149
  61. data/lib/autoproj/variable_expansion.rb +32 -6
  62. data/lib/autoproj/vcs_definition.rb +57 -17
  63. data/lib/autoproj/version.rb +1 -1
  64. data/lib/autoproj/workspace.rb +550 -0
  65. data/test/ops/test_snapshot.rb +26 -0
  66. data/test/test_package.rb +30 -0
  67. data/test/test_vcs_definition.rb +46 -0
  68. metadata +55 -50
  69. data/bin/autolocate +0 -3
  70. data/bin/autoproj-bootstrap +0 -68
  71. data/bin/autoproj-cache +0 -18
  72. data/bin/autoproj-clean +0 -13
  73. data/bin/autoproj-commit +0 -10
  74. data/bin/autoproj-create-set +0 -118
  75. data/bin/autoproj-doc +0 -28
  76. data/bin/autoproj-envsh +0 -14
  77. data/bin/autoproj-list +0 -69
  78. data/bin/autoproj-locate +0 -85
  79. data/bin/autoproj-log +0 -5
  80. data/bin/autoproj-query +0 -82
  81. data/bin/autoproj-reset +0 -13
  82. data/bin/autoproj-show +0 -192
  83. data/bin/autoproj-snapshot +0 -27
  84. data/bin/autoproj-switch-config +0 -24
  85. data/bin/autoproj-tag +0 -13
  86. data/bin/autoproj-test +0 -31
  87. data/bin/autoproj-versions +0 -20
  88. data/bin/autoproj_stress_test +0 -40
  89. data/lib/autoproj/cmdline.rb +0 -1649
@@ -0,0 +1,28 @@
1
+ require 'autoproj'
2
+ require 'autoproj/cli/base'
3
+ require 'autoproj/ops/main_config_switcher'
4
+ require 'autoproj/ops/configuration'
5
+
6
+ module Autoproj
7
+ module CLI
8
+ class SwitchConfig < Base
9
+ def run(args, options = Hash.new)
10
+ if Dir.pwd.start_with?(ws.remotes_dir) || Dir.pwd.start_with?(ws.config_dir)
11
+ raise ConfigError, "you cannot run autoproj switch-config from autoproj's configuration directory or one of its subdirectories"
12
+ end
13
+
14
+ # We must switch to the root dir first, as it is required by the
15
+ # configuration switch code. This is acceptable as long as we
16
+ # quit just after the switch
17
+ switcher = Ops::MainConfigSwitcher.new(ws)
18
+ if switcher.switch_config(*args)
19
+ manifest = Manifest.load(File.join(ws.config_dir, 'manifest'))
20
+ update = Ops::Configuration.new(ws, ws.loader)
21
+ update.update_configuration
22
+ ws.config.save
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -1,38 +1,12 @@
1
- require 'autoproj/cli'
1
+ require 'autoproj'
2
2
  require 'autoproj/cli/versions'
3
+ require 'autoproj/ops/snapshot'
4
+ require 'autoproj/cli/base'
5
+
3
6
  module Autoproj
4
7
  module CLI
5
- class Tag
6
- include Ops::Tools
7
-
8
- attr_reader :manifest
9
-
10
- def initialize(manifest)
11
- @manifest = manifest
12
- end
13
-
14
- def parse_options(args)
15
- options = Hash[package_sets: true, keep_going: false]
16
- parser = OptionParser.new do |opt|
17
- opt.on '--[no-]package-sets', 'commit the package set state as well (enabled by default)' do |flag|
18
- options[:package_sets] = flag
19
- end
20
- opt.on '-k', '--keep-going', "ignore packages that can't be snapshotted (the default is to terminate with an error)" do
21
- options[:keep_going] = true
22
- end
23
- opt.on '-m MESSAGE', '--message=MESSAGE', String, "the message to use for the new commit (defaults to mentioning the tag creation)" do |message|
24
- options[:message] = message
25
- end
26
- end
27
- common_options(parser)
28
- remaining = parser.parse(args)
29
- if remaining.size > 1
30
- raise InvalidArguments, "expected only the tag name as argument"
31
- end
32
- return remaining.first, options
33
- end
34
-
35
- def run(tag_name, options)
8
+ class Tag < Base
9
+ def run(tag_name, *user_selection, options = Hash.new)
36
10
  pkg = manifest.main_package_set.create_autobuild_package
37
11
  importer = pkg.importer
38
12
  if !importer || !importer.kind_of?(Autobuild::Git)
@@ -40,7 +14,7 @@ module Autoproj
40
14
  end
41
15
 
42
16
  versions_file = File.join(
43
- OVERRIDES_DIR,
17
+ Workspace::OVERRIDES_DIR,
44
18
  Versions::DEFAULT_VERSIONS_FILE_BASENAME)
45
19
 
46
20
  if tag_name.nil?
@@ -65,9 +39,9 @@ module Autoproj
65
39
  message = options[:message] ||
66
40
  "autoproj created tag #{tag_name}"
67
41
  commit_id = Ops::Snapshot.create_commit(pkg, versions_file, message) do |io|
68
- versions = CLI::Versions.new(manifest)
42
+ versions = CLI::Versions.new(ws)
69
43
  Autoproj.message "creating versions file, this may take a while"
70
- versions.run(Array.new,
44
+ versions.run(user_selection,
71
45
  package_sets: options[:package_sets],
72
46
  output_file: io.path,
73
47
  replace: true,
@@ -1,67 +1,48 @@
1
- require 'autoproj/ops/tools'
1
+ require 'autoproj/cli/inspection_tool'
2
2
 
3
3
  module Autoproj
4
4
  module CLI
5
- class Test
6
- include Ops::Tools
7
-
8
- attr_reader :manifest
9
-
10
- def initialize(manifest)
11
- @manifest = manifest
12
- end
13
-
14
- def parse_options(args)
15
- Autoproj.load_config
16
-
17
- modified_config = false
18
- mode = nil
19
- options = Hash.new
20
- option_parser = OptionParser.new do |opt|
21
- opt.on '--enable[=PACKAGE,PACKAGE]', Array, 'enable tests for all packages or for specific packages (does not run the tests)' do |packages|
22
- if !packages
23
- Autoproj.config.utility_enable_all('test')
24
- else
25
- Autoproj.config.utility_enable_for('test', *packages)
26
- end
27
- modified_config = true
28
- end
29
- opt.on '--disable[=PACKAGE,PACKAGE]', Array, 'disable tests for all packages or for specific packages (does not run the tests)' do |packages|
30
- if !packages
31
- Autoproj.config.utility_disable_all('test')
32
- else
33
- Autoproj.config.utility_disable_for('test', *packages)
34
- end
35
- modified_config = true
36
- end
37
- opt.on '--list', 'list the test availability and enabled/disabled state information' do
38
- mode = 'list'
39
- end
40
- opt.on '--[no-]recursion', '(do not) run or list the tests of the dependencies of the packages given on the command line (the default is false)' do |flag|
41
- options[:recursive] = flag
42
- end
43
- end
44
-
45
- user_selection = option_parser.parse(ARGV)
46
- if !mode && !(modified_config && user_selection.empty?)
47
- mode = 'run'
5
+ class Test < InspectionTool
6
+ def enable(user_selection, options = Hash.new)
7
+ if user_selection.empty?
8
+ ws.load_config
9
+ ws.config.utility_enable_all('test')
10
+ else
11
+ initialize_and_load
12
+ selection, _ = finalize_setup(
13
+ user_selection,
14
+ recursive: options[:deps],
15
+ ignore_non_imported_packages: true)
16
+ ws.config.utility_enable('test', *selection)
48
17
  end
18
+ ws.config.save
19
+ end
49
20
 
50
- if modified_config
51
- Autoproj.save_config
21
+ def disable(user_selection, options = Hash.new)
22
+ if user_selection.empty?
23
+ ws.load_config
24
+ ws.config.utility_disable_all('test')
25
+ else
26
+ initialize_and_load
27
+ selection, _ = finalize_setup(
28
+ user_selection,
29
+ recursive: options[:deps],
30
+ ignore_non_imported_packages: true)
31
+ ws.config.utility_disable('test', *selection)
52
32
  end
53
- return mode, user_selection, options
33
+ ws.config.save
54
34
  end
55
35
 
56
36
  def list(user_selection, options = Hash.new)
57
- resolved_selection = resolve_selection(
37
+ initialize_and_load
38
+ resolved_selection, _ = finalize_setup(
58
39
  user_selection,
59
- recursive: options[:recursive],
40
+ recursive: options[:dep],
60
41
  ignore_non_imported_packages: true)
61
42
 
62
43
  lines = Array.new
63
44
  resolved_selection.each do |pkg_name|
64
- pkg = manifest.find_package(pkg_name).autobuild
45
+ pkg = ws.manifest.find_package(pkg_name).autobuild
65
46
  lines << [pkg.name, pkg.test_utility.enabled?, pkg.test_utility.available?]
66
47
  end
67
48
  lines = lines.sort_by { |name, _| name }
@@ -74,11 +55,9 @@ module Autoproj
74
55
  end
75
56
 
76
57
  def run(user_selection, options = Hash.new)
77
- packages = resolve_selection(
78
- user_selection,
79
- recursive: options[:recursive],
80
- ignore_non_imported_packages: true)
81
- # This calls #prepare, which is required to run build_packages
58
+ initialize_and_load
59
+ packages, _ = finalize_setup(user_selection)
60
+
82
61
  packages.each do |pkg|
83
62
  Autobuild::Package[pkg].disable_phases('import', 'prepare', 'install')
84
63
  end
@@ -0,0 +1,158 @@
1
+ require 'autoproj/cli'
2
+ require 'autoproj/cli/base'
3
+ require 'autoproj/ops/import'
4
+
5
+ module Autoproj
6
+ module CLI
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
14
+
15
+ if from = options[:from]
16
+ options[:from] = Autoproj::InstallationManifest.from_root(options[:from])
17
+ end
18
+ ws.osdeps.filter_uptodate_packages = options[:osdeps_filter_uptodate]
19
+
20
+ if options[:aup] && !options[:all] && packages.empty?
21
+ packages = ['.']
22
+ end
23
+
24
+ if options[:autoproj].nil?
25
+ options[:autoproj] = packages.empty?
26
+ end
27
+
28
+ return packages, options
29
+ end
30
+
31
+ def run(selected_packages, options)
32
+ selected_packages, config_selected =
33
+ normalize_command_line_package_selection(selected_packages)
34
+
35
+ if options[:config].nil?
36
+ options[:config] = selected_packages.empty? || config_selected
37
+ end
38
+
39
+ ws.setup
40
+ ws.install_ruby_shims
41
+
42
+ # Do that AFTER we have properly setup ws.osdeps as to avoid
43
+ # unnecessarily redetecting the operating system
44
+ if options[:osdeps]
45
+ ws.config.set(
46
+ 'operating_system',
47
+ Autoproj::OSDependencies.operating_system(:force => true),
48
+ true)
49
+ end
50
+
51
+ if options[:autoproj]
52
+ ws.update_autoproj
53
+ end
54
+
55
+ ws.load_package_sets(
56
+ only_local: options[:local],
57
+ checkout_only: !options[:config] || options[:checkout_only],
58
+ ignore_errors: options[:keep_going])
59
+ if selected_packages.empty? && config_selected
60
+ return
61
+ end
62
+
63
+ ws.setup_all_package_directories
64
+ # Call resolve_user_selection once to auto-add packages
65
+ resolve_user_selection(selected_packages)
66
+ # Now we can finalize and re-resolve the selection since the
67
+ # overrides.rb files might have changed it
68
+ ws.finalize_package_setup
69
+ # Finally, filter out exclusions
70
+ resolved_selected_packages, _ =
71
+ resolve_user_selection(selected_packages)
72
+ validate_user_selection(selected_packages, resolved_selected_packages)
73
+
74
+ if !selected_packages.empty?
75
+ command_line_selection = resolved_selected_packages.dup
76
+ else
77
+ command_line_selection = Array.new
78
+ end
79
+ selected_packages = resolved_selected_packages
80
+
81
+ if other_root = options[:from]
82
+ setup_update_from(other_root)
83
+ end
84
+
85
+ osdeps_options = Hash[install_only: options[:checkout_only]]
86
+ if options[:osdeps_mode]
87
+ osdeps_options[:osdeps_mode] = options[:osdeps_mode]
88
+ end
89
+
90
+ if options[:osdeps]
91
+ # Install the osdeps for the version control
92
+ vcs_to_install = Set.new
93
+ selected_packages.each_source_package_name do |pkg_name|
94
+ if pkg = ws.manifest.find_package(pkg_name)
95
+ if pkg.vcs
96
+ vcs_to_install << pkg.vcs.type
97
+ end
98
+ else
99
+ raise "cannot find package #{pkg_name}"
100
+ end
101
+ end
102
+ ws.osdeps.install(vcs_to_install, osdeps_options)
103
+ end
104
+
105
+ ops = Autoproj::Ops::Import.new(ws)
106
+ source_packages, osdep_packages =
107
+ ops.import_packages(selected_packages,
108
+ checkout_only: options[:checkout_only],
109
+ only_local: options[:local],
110
+ reset: options[:reset],
111
+ recursive: options[:deps],
112
+ ignore_errors: options[:keep_going])
113
+
114
+ ws.finalize_setup
115
+ load_all_available_package_manifests
116
+ ws.export_installation_manifest
117
+
118
+ if options[:osdeps] && !osdep_packages.empty?
119
+ ws.osdeps.install(osdep_packages, osdeps_options)
120
+ end
121
+
122
+ ws.env.export_env_sh
123
+ Autoproj.message "autoproj: updated #{ws.root_dir}/#{Autoproj::ENV_FILENAME}", :green
124
+
125
+ return command_line_selection, source_packages, osdep_packages
126
+ end
127
+
128
+ def load_all_available_package_manifests
129
+ # Load the manifest for packages that are already present on the
130
+ # file system
131
+ ws.manifest.packages.each_value do |pkg|
132
+ if File.directory?(pkg.autobuild.srcdir)
133
+ begin
134
+ ws.manifest.load_package_manifest(pkg.autobuild.name)
135
+ rescue Interrupt
136
+ raise
137
+ rescue Exception => e
138
+ Autoproj.warn "cannot load package manifest for #{pkg.autobuild.name}: #{e.message}"
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ def setup_update_from(other_root)
145
+ manifest.each_autobuild_package do |pkg|
146
+ if pkg.importer.respond_to?(:pick_from_autoproj_root)
147
+ if !pkg.importer.pick_from_autoproj_root(pkg, other_root)
148
+ pkg.update = false
149
+ end
150
+ else
151
+ pkg.update = false
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
158
+
@@ -1,91 +1,54 @@
1
1
  require 'autoproj'
2
- require 'autoproj/cmdline'
2
+ require 'autoproj/cli/inspection_tool'
3
3
  require 'autoproj/ops/tools'
4
4
  require 'autoproj/ops/snapshot'
5
5
 
6
6
  module Autoproj
7
7
  module CLI
8
- class Versions
9
- include Ops::Tools
10
-
8
+ class Versions < InspectionTool
11
9
  DEFAULT_VERSIONS_FILE_BASENAME = Ops::Snapshot::DEFAULT_VERSIONS_FILE_BASENAME
12
10
 
13
11
  def default_versions_file
14
12
  File.join( Autoproj.overrides_dir, DEFAULT_VERSIONS_FILE_BASENAME )
15
13
  end
16
14
 
17
- attr_reader :manifest
18
-
19
- def initialize(manifest)
20
- @manifest = manifest
21
- end
22
-
23
- def resolve_selection( user_selection )
24
- resolved_selection = CmdLine.
25
- resolve_user_selection(user_selection, :filter => false)
26
- resolved_selection.filter_excluded_and_ignored_packages(manifest)
27
- # This calls #prepare, which is required to run build_packages
28
- packages = CmdLine.import_packages(resolved_selection)
29
-
30
- # Remove non-existing packages
31
- packages.each do |pkg|
32
- if !File.directory?(manifest.package(pkg).autobuild.srcdir)
33
- raise ConfigError, "cannot commit #{pkg} as it is not checked out"
34
- end
15
+ def validate_options(packages, options = Hash.new)
16
+ packages, options = super
17
+ if options.has_key?(:save)
18
+ options[:save] = case options[:save]
19
+ when '.'
20
+ nil
21
+ when true
22
+ default_versions_file
23
+ else
24
+ options[:save].to_str
25
+ end
35
26
  end
36
- packages
37
- end
38
-
39
-
40
- def parse_options(args)
41
- options = Hash.new
42
- parser = OptionParser.new do |opt|
43
- opt.on '--[no-]package-sets', 'commit the package set state as well (default if no packages are selected)' do |flag|
44
- options[:package_sets] = flag
45
- end
46
- opt.on '--replace', String, 'if the file given to --save exists, replace it instead of updating it' do
47
- options[:replace] = true
48
- end
49
- opt.on '-k', '--keep-going', "ignore packages that can't be snapshotted (the default is to terminate with an error)" do
50
- options[:keep_going] = true
51
- end
52
- opt.on '--save[=FILE]', String, "the file into which the versions should be saved (if no file is given, defaults to #{default_versions_file})" do |file|
53
- options[:output_file] =
54
- if file == '-'
55
- nil
56
- elsif !file
57
- default_versions_file
58
- else
59
- file
60
- end
61
- end
62
- end
63
- common_options(parser)
64
- remaining = parser.parse(args)
65
- return remaining, options
27
+ return packages, options
66
28
  end
67
29
 
68
30
  def run(user_selection, options)
69
- do_package_sets = options[:package_sets]
70
- if do_package_sets.nil? && user_selection.empty?
71
- do_package_sets = true
31
+ initialize_and_load
32
+ packages, *, config_selected =
33
+ finalize_setup(user_selection,
34
+ ignore_non_imported_packages: true)
35
+
36
+ if (config_selected || user_selection.empty?) && (options[:package_sets] != false)
37
+ options[:package_sets] = true
72
38
  end
73
39
 
74
- CmdLine.report(silent: true) do
75
- packages = resolve_selection user_selection
76
- ops = Ops::Snapshot.new(manifest, keep_going: options[:keep_going])
40
+ ops = Ops::Snapshot.new(ws.manifest, keep_going: options[:keep_going])
77
41
 
78
- versions = Array.new
79
- if do_package_sets
80
- versions += ops.snapshot_package_sets
81
- end
82
- versions += ops.snapshot_packages(packages)
83
- if output_file = options[:output_file]
84
- ops.save_versions(versions, output_file, replace: options[:replace])
85
- else
86
- versions = ops.sort_versions(versions)
87
- puts YAML.dump(versions)
88
- end
42
+ versions = Array.new
43
+ if options[:package_sets]
44
+ versions += ops.snapshot_package_sets
45
+ end
46
+ versions += ops.snapshot_packages(packages)
47
+ if output_file = options[:save]
48
+ ops.save_versions(versions, output_file, replace: options[:replace])
49
+ else
50
+ versions = ops.sort_versions(versions)
51
+ puts YAML.dump(versions)
89
52
  end
90
53
  end
91
54
  end