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
@@ -14,12 +14,15 @@ module Autoproj
14
14
  attr_reader :declared_options
15
15
  # The options that have already been shown to the user
16
16
  attr_reader :displayed_options
17
+ # The path to the underlying configuration file
18
+ attr_reader :path
17
19
 
18
- def initialize
20
+ def initialize(path = nil)
19
21
  @config = Hash.new
20
22
  @overrides = Hash.new
21
23
  @declared_options = Hash.new
22
24
  @displayed_options = Hash.new
25
+ @path = path
23
26
  end
24
27
 
25
28
  # Deletes the current value for an option
@@ -58,14 +61,14 @@ module Autoproj
58
61
  end
59
62
 
60
63
  # Get the value for a given option
61
- def get(key, default_value = nil)
64
+ def get(key, *default_value)
62
65
  if overrides.has_key?(key)
63
66
  return overrides[key]
64
67
  end
65
68
 
66
69
  value, validated = config[key]
67
- if value.nil? && !declared?(key) && !default_value.nil?
68
- default_value
70
+ if value.nil? && !declared?(key) && !default_value.empty?
71
+ default_value.first
69
72
  elsif value.nil? || (declared?(key) && !validated)
70
73
  value = configure(key)
71
74
  else
@@ -141,15 +144,27 @@ module Autoproj
141
144
  end
142
145
  end
143
146
 
144
- def load(path, reconfigure = false)
145
- if h = YAML.load(File.read(path))
147
+ def load(options = Hash.new)
148
+ options = validate_options options,
149
+ path: self.path,
150
+ reconfigure: false
151
+
152
+ if h = YAML.load(File.read(options[:path]))
146
153
  h.each do |key, value|
147
- set(key, value, !reconfigure)
154
+ set(key, value, !options[:reconfigure])
148
155
  end
149
156
  end
150
157
  end
151
158
 
152
- def save(path)
159
+ def reconfigure!
160
+ new_config = Hash.new
161
+ config.each do |key, (value, user_validated)|
162
+ new_config[key] = [value, false]
163
+ end
164
+ @config = new_config
165
+ end
166
+
167
+ def save(path = self.path)
153
168
  File.open(path, "w") do |io|
154
169
  h = Hash.new
155
170
  config.each do |key, value|
@@ -176,17 +191,13 @@ module Autoproj
176
191
  end
177
192
 
178
193
  def ruby_executable
179
- @ruby_executable ||= OSDependencies.autodetect_ruby_program
180
- end
181
-
182
- # For Autoproj 2.0 forward compatibility
183
- def shell_helpers?
184
- Autoproj.shell_helpers?
185
- end
186
-
187
- # For Autoproj 2.0 forward compatibility
188
- def shell_helpers=(flag)
189
- Autoproj.shell_helpers = flag
194
+ if path = get('ruby_executable', nil)
195
+ path
196
+ else
197
+ path = OSDependencies.autodetect_ruby_program
198
+ set('ruby_executable', path, true)
199
+ path
200
+ end
190
201
  end
191
202
 
192
203
  def validate_ruby_executable
@@ -210,6 +221,14 @@ module Autoproj
210
221
  use_prerelease
211
222
  end
212
223
 
224
+ def shell_helpers?
225
+ get 'shell_helpers', true
226
+ end
227
+
228
+ def shell_helpers=(flag)
229
+ set 'shell_helpers', flag, true
230
+ end
231
+
213
232
  def apply_autobuild_configuration
214
233
  if has_value_for?('autobuild')
215
234
  params = get('autobuild')
@@ -221,11 +240,46 @@ module Autoproj
221
240
  end
222
241
  end
223
242
 
224
- def apply_autoproj_prefix
225
- if has_value_for?('prefix')
226
- Autoproj.prefix = get('prefix')
227
- else Autoproj.prefix = 'install'
228
- end
243
+ # The directory in which packages will be installed.
244
+ #
245
+ # If it is a relative path, it is relative to the root dir of the
246
+ # installation.
247
+ #
248
+ # The default is "install"
249
+ #
250
+ # @return [String]
251
+ def prefix_dir
252
+ get('prefix', 'install')
253
+ end
254
+
255
+ # Defines the temporary area in which packages should put their build
256
+ # files
257
+ #
258
+ # If absolute, it is handled as {#prefix_dir}: the package name will be
259
+ # appended to it. If relative, it is relative to the package's source
260
+ # directory
261
+ #
262
+ # The default is "build"
263
+ #
264
+ # @return [String]
265
+ def build_dir
266
+ get('build', 'build')
267
+ end
268
+
269
+ # Returns true if there should be one prefix per package
270
+ #
271
+ # The default is false (disabled)
272
+ #
273
+ # @return [Boolean]
274
+ def separate_prefixes?
275
+ get('separate_prefixes', false)
276
+ end
277
+
278
+ # Controls whether there should be one prefix per package
279
+ #
280
+ # @see separate_prefixes?
281
+ def separate_prefixes=(flag)
282
+ set('separate_prefixes', flag, true)
229
283
  end
230
284
 
231
285
  # Returns true if packages and prefixes should be auto-generated, based
@@ -292,17 +346,17 @@ module Autoproj
292
346
  set("#{utility_key(utility)}_default", true)
293
347
  end
294
348
 
295
- # Enables a utility for a specific package
296
- #
297
- # Note that if the default for this utility is to be enabled, this is
298
- # essentially a no-op.
349
+ # Enables a utility for a set of packages
299
350
  #
300
351
  # @param [String] utility the utility name (e.g. 'doc' or 'test')
301
- # @param [String] package the package name
352
+ # @param [String] packages the package names
302
353
  # @return [void]
303
- def utility_enable_for(utility, package)
354
+ def utility_enable(utility, *packages)
304
355
  utility_config = get(utility_key(utility), Hash.new)
305
- set(utility_key(utility), utility_config.merge(package => true))
356
+ packages.each do |pkg_name|
357
+ utility_config[pkg_name] = true
358
+ end
359
+ set(utility_key(utility), utility_config)
306
360
  end
307
361
 
308
362
  # Disables a utility for all packages
@@ -324,11 +378,18 @@ module Autoproj
324
378
  # essentially a no-op.
325
379
  #
326
380
  # @param [String] utility the utility name (e.g. 'doc' or 'test')
327
- # @param [String] package the package name
381
+ # @param [String] packages the package names
328
382
  # @return [void]
329
- def utility_disable_for(utility, package)
383
+ def utility_disable(utility, *packages)
330
384
  utility_config = get(utility_key(utility), Hash.new)
331
- set(utility_key(utility), utility_config.merge(package => false))
385
+ packages.each do |pkg_name|
386
+ utility_config[pkg_name] = false
387
+ end
388
+ set(utility_key(utility), utility_config)
389
+ end
390
+
391
+ def merge(conf)
392
+ config.merge!(conf.config)
332
393
  end
333
394
  end
334
395
  end
@@ -2,6 +2,13 @@
2
2
  none: ignore
3
3
 
4
4
  ruby19:
5
+ debian:
6
+ - ruby1.9.1
7
+ - ruby1.9.1-dev
8
+ - rubygems1.9.1
9
+ - rake
10
+ - rubygems-integration
11
+
5
12
  ubuntu:
6
13
  '12.04':
7
14
  - ruby1.9.1
@@ -10,7 +17,17 @@ ruby19:
10
17
  - ri1.9.1
11
18
  - libopenssl-ruby1.9.1
12
19
  - rake
13
- default: ignore
20
+ default:
21
+ - ruby1.9.1
22
+ - ruby1.9.1-dev
23
+ - rubygems1.9.1
24
+ - ri1.9.1
25
+ - libopenssl-ruby1.9.1
26
+ - rake
27
+ - rubygems-integration
28
+ gentoo:
29
+ - dev-lang/ruby:1.9
30
+ - rake
14
31
  fedora:
15
32
  "17":
16
33
  - ruby
@@ -47,13 +64,12 @@ ruby20:
47
64
 
48
65
  ruby21:
49
66
  debian:
50
- jessie:
51
- - ruby2.1
52
- - ruby2.1-dev
53
- - rake
54
- - rubygems-integration
67
+ - ruby2.1
68
+ - ruby2.1-dev
69
+ - rake
70
+ - rubygems-integration
55
71
  ubuntu:
56
- '14.10,15.04,15.10':
72
+ '14.10':
57
73
  - ruby2.1
58
74
  - ruby2.1-dev
59
75
  - rake
@@ -64,31 +80,6 @@ ruby21:
64
80
  - gem: rake
65
81
  default: ignore # we assume that if the user has a ruby 2.1 runtime, it is usable
66
82
 
67
- ruby22:
68
- ubuntu:
69
- '15.10':
70
- - ruby2.2
71
- - ruby2.2-dev
72
- - rake
73
- - rubygems-integration
74
- default: ignore
75
- default: ignore # we assume that if the user has a ruby 2.2 runtime, it is usable
76
-
77
- ruby23:
78
- debian:
79
- unstable:
80
- - ruby2.3
81
- - ruby2.3-dev
82
- - rake
83
- - rubygems-integration
84
- ubuntu:
85
- '16.04':
86
- - ruby2.3-dev
87
- - rake
88
- - rubygems-integration
89
- default: ignore
90
- default: ignore # we assume that if the user has a ruby 2.3 runtime, it is usable
91
-
92
83
  build-essential:
93
84
  debian,ubuntu: build-essential
94
85
  gentoo: ignore
@@ -99,10 +90,10 @@ build-essential:
99
90
  default: clang
100
91
 
101
92
  autobuild:
102
- - gem: autobuild~>1.9.0
93
+ - gem: autobuild
103
94
  - osdep: readline
104
95
  autoproj:
105
- - gem: autoproj~>1.13.0
96
+ - gem: autoproj
106
97
  - osdep: readline
107
98
 
108
99
  readline:
@@ -216,7 +207,6 @@ pip:
216
207
  freebsd: pip
217
208
 
218
209
  sudo:
219
- macos-brew: ignore
220
210
  default: sudo
221
211
 
222
212
  # vim: expandtab
@@ -1,79 +1,101 @@
1
1
  module Autoproj
2
- # Sets an environment variable
3
- #
4
- # This sets (or resets) the environment variable +name+ to the given value.
5
- # If multiple values are given, they are joined with File::PATH_SEPARATOR
6
- #
7
- # The values can contain configuration parameters using the
8
- # $CONF_VARIABLE_NAME syntax.
9
- def self.env_set(name, *value)
10
- Autobuild.env_clear(name)
11
- env_add(name, *value)
2
+ ENV_FILENAME =
3
+ if Autobuild.windows? then "env.bat"
4
+ else "env.sh"
5
+ end
6
+
7
+ class Environment < Autobuild::Environment
8
+ attr_reader :root_dir
9
+
10
+ def prepare(root_dir)
11
+ @root_dir = root_dir
12
+ set 'AUTOPROJ_CURRENT_ROOT', root_dir
13
+ end
14
+
15
+ def expand(value)
16
+ Autoproj.expand_environment(value)
17
+ end
18
+
19
+ def export_env_sh(subdir = nil, options = Hash.new)
20
+ if subdir.kind_of?(Hash)
21
+ subdir, options = nil, subdir
22
+ end
23
+ options = validate_options options,
24
+ shell_helpers: true
25
+
26
+ filename = if subdir
27
+ File.join(root_dir, subdir, ENV_FILENAME)
28
+ else
29
+ File.join(root_dir, ENV_FILENAME)
30
+ end
31
+
32
+ shell_dir = File.expand_path(File.join("..", "..", "shell"), File.dirname(__FILE__))
33
+ if options[:shell_helpers]
34
+ Autoproj.message "sourcing autoproj shell helpers"
35
+ Autoproj.message "add \"Autoproj.config.shell_helpers = false\" in autoproj/init.rb to disable"
36
+ source_after(File.join(shell_dir, "autoproj_sh"))
37
+ end
38
+
39
+ File.open(filename, "w") do |io|
40
+ if inherit?
41
+ io.write <<-EOF
42
+ if test -n "$AUTOPROJ_CURRENT_ROOT" && test "$AUTOPROJ_CURRENT_ROOT" != "#{root_dir}"; then
43
+ echo "the env.sh from $AUTOPROJ_CURRENT_ROOT is already loaded. Start a new shell before sourcing this one"
44
+ return
45
+ fi
46
+ EOF
47
+ end
48
+ super(io)
49
+ end
50
+ end
12
51
  end
13
52
 
14
- # Adds new values to a given environment variable
15
- #
16
- # Adds the given value(s) to the environment variable named +name+. The
17
- # values are added using the File::PATH_SEPARATOR marker
18
- #
19
- # The values can contain configuration parameters using the
20
- # $CONF_VARIABLE_NAME syntax.
53
+ # @deprecated call Autoproj.env.set instead
54
+ def self.env_set(name, *value)
55
+ env.set(name, *value)
56
+ end
57
+ # @deprecated call Autoproj.env.add instead
21
58
  def self.env_add(name, *value)
22
- value = value.map { |v| expand_environment(v) }
23
- Autobuild.env_add(name, *value)
59
+ env.add(name, *value)
24
60
  end
25
-
26
- # Sets an environment variable which is a path search variable (such as
27
- # PATH, RUBYLIB, PYTHONPATH)
28
- #
29
- # This sets (or resets) the environment variable +name+ to the given value.
30
- # If multiple values are given, they are joined with File::PATH_SEPARATOR.
31
- # Unlike env_set, duplicate values will be removed.
32
- #
33
- # The values can contain configuration parameters using the
34
- # $CONF_VARIABLE_NAME syntax.
61
+ # @deprecated call Autoproj.env.set_path instead
35
62
  def self.env_set_path(name, *value)
36
- Autobuild.env_clear(name)
37
- env_add_path(name, *value)
63
+ env.set_path(name, *value)
38
64
  end
39
-
40
- # Adds new values to a given environment variable, which is a path search
41
- # variable (such as PATH, RUBYLIB, PYTHONPATH)
42
- #
43
- # Adds the given value(s) to the environment variable named +name+. The
44
- # values are added using the File::PATH_SEPARATOR marker. Unlike env_set,
45
- # duplicate values
46
- # will be removed.
47
- #
48
- # The values can contain configuration parameters using the
49
- # $CONF_VARIABLE_NAME syntax.
50
- #
51
- # This is usually used in package configuration blocks to add paths
52
- # dependent on the place of install, such as
53
- #
54
- # cmake_package 'test' do |pkg|
55
- # Autoproj.env_add_path 'RUBYLIB', File.join(pkg.srcdir, 'bindings', 'ruby')
56
- # end
65
+ # @deprecated call Autoproj.env.add_path instead
57
66
  def self.env_add_path(name, *value)
58
- value = value.map { |v| expand_environment(v) }
59
- Autobuild.env_add_path(name, *value)
67
+ env.add_path(name, *value)
60
68
  end
61
-
62
- # Requests that autoproj source the given shell script in its own env.sh
63
- # script
69
+ # @deprecated call Autoproj.env.source_after instead
64
70
  def self.env_source_file(file)
65
- Autobuild.env_source_file(file)
71
+ env.source_after(file)
66
72
  end
67
-
68
- # Requests that autoproj source the given shell script in its own env.sh
69
- # script
73
+ # @deprecated call Autoproj.env.source_after instead
70
74
  def self.env_source_after(file)
71
- Autobuild.env_source_after(file)
75
+ env.source_after(file)
72
76
  end
73
-
74
- # Requests that autoproj source the given shell script in its own env.sh
75
- # script
77
+ # @deprecated call Autoproj.env.source_before instead
76
78
  def self.env_source_before(file)
77
- Autobuild.env_source_before(file)
79
+ env.source_before(file)
80
+ end
81
+ # @deprecated call Autoproj.env.inherit instead
82
+ def self.env_inherit(*names)
83
+ env.inherit(*names)
84
+ end
85
+ # @deprecated use Autoproj.env.isolate instead
86
+ def self.set_initial_env
87
+ isolate_environment
88
+ end
89
+ # @deprecated use Autoproj.env.isolate instead
90
+ def self.isolate_environment
91
+ env.isolate
92
+ end
93
+ # @deprecated call Autoproj.env.prepare directly
94
+ def self.prepare_environment(env = Autoproj.env, manifest = Autoproj.manifest)
95
+ env.prepare(manifest)
96
+ end
97
+ # @deprecated use Autoproj.env.export_env_sh instead
98
+ def self.export_env_sh(subdir = nil)
99
+ env.export_env_sh(subdir)
78
100
  end
79
101
  end