autoproj 2.0.0.b7 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.gitignore +8 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +6 -0
  6. data/README.md +4 -0
  7. data/Rakefile +40 -81
  8. data/autoproj.gemspec +29 -0
  9. data/lib/autoproj/cli/cache.rb +7 -2
  10. data/lib/autoproj/cli/main.rb +46 -25
  11. data/lib/autoproj/cli/main_test.rb +6 -4
  12. data/lib/autoproj/cli/status.rb +2 -2
  13. data/lib/autoproj/configuration.rb +5 -0
  14. data/lib/autoproj/git_server_configuration.rb +117 -0
  15. data/lib/autoproj/osdeps.rb +14 -914
  16. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +70 -0
  17. data/lib/autoproj/package_managers/emerge_manager.rb +14 -0
  18. data/lib/autoproj/package_managers/gem_manager.rb +313 -0
  19. data/lib/autoproj/package_managers/homebrew_manager.rb +44 -0
  20. data/lib/autoproj/package_managers/manager.rb +45 -0
  21. data/lib/autoproj/package_managers/pacman_manager.rb +14 -0
  22. data/lib/autoproj/package_managers/pip_manager.rb +86 -0
  23. data/lib/autoproj/package_managers/pkg_manager.rb +14 -0
  24. data/lib/autoproj/package_managers/port_manager.rb +14 -0
  25. data/lib/autoproj/package_managers/shell_script_manager.rb +207 -0
  26. data/lib/autoproj/package_managers/unknown_os_manager.rb +42 -0
  27. data/lib/autoproj/package_managers/yum_manager.rb +56 -0
  28. data/lib/autoproj/package_managers/zypper_manager.rb +43 -0
  29. data/lib/autoproj/package_manifest.rb +1 -1
  30. data/lib/autoproj/test.rb +13 -14
  31. data/lib/autoproj/variable_expansion.rb +4 -2
  32. data/lib/autoproj/version.rb +1 -1
  33. data/lib/autoproj/workspace.rb +5 -1
  34. data/manifest.xml +20 -0
  35. metadata +73 -87
  36. data/.gemtest +0 -0
  37. data/Manifest.txt +0 -105
  38. data/test/data/empty_manifest.xml +0 -2
  39. data/test/data/full_manifest.xml +0 -19
  40. data/test/data/invalid_manifest.xml +0 -3
  41. data/test/data/os_release.with_complex_version_field +0 -3
  42. data/test/data/os_release.with_duplicate_values +0 -3
  43. data/test/data/os_release.with_missing_optional_fields +0 -2
  44. data/test/data/os_release.with_quoted_and_unquoted_fields +0 -2
  45. data/test/data/test_manifest/autoproj/local_set/local.autobuild +0 -0
  46. data/test/data/test_manifest/autoproj/local_set/source.yml +0 -1
  47. data/test/data/test_manifest/autoproj/manifest +0 -7
  48. data/test/ops/test_configuration.rb +0 -20
  49. data/test/ops/test_snapshot.rb +0 -26
  50. data/test/package_managers/apt-dpkg-status +0 -41
  51. data/test/package_managers/apt-dpkg-status.installed-last +0 -27
  52. data/test/package_managers/apt-dpkg-status.noninstalled-last +0 -12
  53. data/test/package_managers/test_apt_dpkg_manager.rb +0 -41
  54. data/test/package_managers/test_gem.rb +0 -156
  55. data/test/package_managers/test_pip.rb +0 -42
  56. data/test/test_manifest.rb +0 -48
  57. data/test/test_os_dependencies.rb +0 -586
  58. data/test/test_package.rb +0 -30
  59. data/test/test_package_manifest.rb +0 -65
  60. data/test/test_vcs_definition.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e73644d1f3143dffe36b4af50d2f9dbdc348e8a3
4
- data.tar.gz: 0ec902c6207a631ff578403a74e39eb6b72413ce
3
+ metadata.gz: 2e14963386c3223f37cae4cd4aac802b45309c50
4
+ data.tar.gz: e342ca9f0948df5ed55dc8fc04556eb86b6a633c
5
5
  SHA512:
6
- metadata.gz: 4374b8c9855e3a85af8e1d0eb36d233e56d592ff046adc9eeb6405d2b229f0aa60221bdbc5e5f70a6e73ff67c0ec1c2064d3931dda661e9e5f32817f888bff76
7
- data.tar.gz: d99c1417e26934cc5ebd0d2c55c1102a99e89ba10800aa593dbc21cbbc49deeb54ca0a9bcf3f714c62fe80e62b7b3ff342b3bda6ca31ad1691f687be718726d3
6
+ metadata.gz: d7ee59489d5403310fa672a19ed8421aeec98fc148c460f10dfaa4dc31cadde3481ddc33b64e0abb4ffd322fe057ac0237490327098f8f6a2970843da4375f6b
7
+ data.tar.gz: 513dfea794e5e082f408e5899f90258410f304688abec6c648758452587aafc37b6eaf637d60df4676d046d469a9a6c3fdb5a688eda6a0fbc74cddf250e00c68
data/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ *.rb diff=ruby
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ doc
2
+ *.sw*
3
+ webgen.cache
4
+ doc/guide/src/autoproj_bootstrap
5
+ pkg/
6
+ /vendor/
7
+ /.bundle
8
+ /coverage/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.6
5
+ - 2.2.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'autobuild', github: 'rock-core/autobuild', branch: 'autoproj-2.0'
4
+ gem 'pry'
5
+ gem 'pry-byebug'
6
+ gemspec
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ [![Build Status](https://travis-ci.org/rock-core/autoproj.svg?branch=autoproj-2.0)](https://travis-ci.org/rock-core/autoproj)
2
+ [![Gem Version](https://badge.fury.io/rb/autoproj.svg)](http://badge.fury.io/rb/autoproj)
3
+ [![Documentation](http://b.repl.ca/v1/yard-docs-blue.png)](http://rubydoc.info/gems/autoproj/frames)
4
+
1
5
  What is Autoproj
2
6
  ----------------
3
7
  Autoproj allows to easily install and maintain software that is under source
data/Rakefile CHANGED
@@ -1,93 +1,52 @@
1
- require 'utilrb/rake_common'
2
- $LOAD_PATH.unshift File.join(Dir.pwd, 'lib')
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
3
 
4
4
  task 'default'
5
- Utilrb::Rake.hoe do
6
- namespace 'dist' do
7
- Hoe.spec 'autoproj' do
8
- self.developer "Sylvain Joyeux", "sylvain.joyeux@m4x.org"
5
+ task 'gem' => 'build'
9
6
 
10
- self.urls = ["http://rock-robotics.org/documentation/autoproj"]
11
- self.group_name = 'autobuild'
12
- self.summary = 'Easy installation and management of sets of software packages'
13
- self.description = "autoproj is a manager for sets of software packages. It allows the user to import and build packages from source, still using the underlying distribution's native package manager for software that is available on it."
14
- self.email = "sylvain.joyeux@m4x.org"
15
-
16
- self.spec_extras[:required_ruby_version] = ">= 1.9.3"
17
-
18
- license 'BSD'
19
-
20
- extra_deps <<
21
- ['autobuild', '~> 1.9', '>= 1.9.0'] <<
22
- ['utilrb', '~> 2.0', '>= 2.0.0'] <<
23
- ['highline', '~> 1.7', '>= 1.7.0'] <<
24
- ['thor', '~> 0.19.0', '>= 0.19.1'] <<
25
- ['concurrent-ruby']
26
- end
27
- end
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << "lib" << Dir.pwd
9
+ t.test_files = FileList['test/**/test_*.rb']
28
10
  end
29
11
 
30
- namespace 'dist' do
31
- desc "generate the bootstrap script"
32
- task 'bootstrap' do
33
- require 'yaml'
34
- build_option_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'build_option.rb'))
35
- config_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'configuration.rb'))
36
- osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
37
- system_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'system.rb'))
38
- osdeps_defaults = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'default.osdeps'))
39
- require 'autobuild'
40
- tools_code = File.read(File.join(Autobuild::LIB_DIR, 'autobuild', 'tools.rb'))
41
- # Filter rubygems dependencies from the OSdeps default. They will be
42
- # installed at first build
43
- osdeps = YAML.load(osdeps_defaults)
44
- osdeps.delete_if do |name, content|
45
- if content.respond_to?(:delete)
46
- content.delete('gem')
47
- content.empty?
48
- else
49
- content == 'gem'
50
- end
51
- end
52
- osdeps_defaults = YAML.dump(osdeps)
53
- # Since we are using gsub to replace the content in the bootstrap file,
54
- # we have to quote all \
55
- [osdeps_code, system_code, osdeps_defaults, tools_code].each do |text|
56
- text.gsub! /\\/, '\\\\\\\\'
57
- end
58
-
59
- bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
60
- gsub('BUILD_OPTION_CODE', build_option_code).
61
- gsub('CONFIG_CODE', config_code).
62
- gsub('OSDEPS_CODE', osdeps_code).
63
- gsub('SYSTEM_CODE', system_code).
64
- gsub('OSDEPS_DEFAULTS', osdeps_defaults).
65
- gsub('TOOLS_CODE', tools_code)
66
- File.open(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap'), 'w') do |io|
67
- io.write bootstrap_code
12
+ desc "generate the bootstrap script"
13
+ task 'bootstrap' do
14
+ require 'yaml'
15
+ build_option_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'build_option.rb'))
16
+ config_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'configuration.rb'))
17
+ osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
18
+ system_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'system.rb'))
19
+ osdeps_defaults = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'default.osdeps'))
20
+ require 'autobuild'
21
+ tools_code = File.read(File.join(Autobuild::LIB_DIR, 'autobuild', 'tools.rb'))
22
+ # Filter rubygems dependencies from the OSdeps default. They will be
23
+ # installed at first build
24
+ osdeps = YAML.load(osdeps_defaults)
25
+ osdeps.delete_if do |name, content|
26
+ if content.respond_to?(:delete)
27
+ content.delete('gem')
28
+ content.empty?
29
+ else
30
+ content == 'gem'
68
31
  end
69
32
  end
70
- end
71
- file 'bin/autoproj_bootstrap' => 'dist:bootstrap'
72
-
73
- Utilrb::Rake.rdoc do
74
- task 'doc' => 'doc:all'
75
- task 'clobber_docs' => 'doc:clobber'
76
- task 'redocs' do
77
- Rake::Task['doc:clobber'].invoke
78
- Rake::Task['doc'].invoke
33
+ osdeps_defaults = YAML.dump(osdeps)
34
+ # Since we are using gsub to replace the content in the bootstrap file,
35
+ # we have to quote all \
36
+ [osdeps_code, system_code, osdeps_defaults, tools_code].each do |text|
37
+ text.gsub! /\\/, '\\\\\\\\'
79
38
  end
80
39
 
81
- namespace 'doc' do
82
- task 'all' => %w{api}
83
- task 'clobber' => 'clobber_api'
84
- RDoc::Task.new("api") do |rdoc|
85
- rdoc.rdoc_dir = 'doc'
86
- rdoc.title = "autoproj"
87
- rdoc.options << '--show-hash'
88
- rdoc.rdoc_files.include('lib/**/*.rb')
89
- end
40
+ bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
41
+ gsub('BUILD_OPTION_CODE', build_option_code).
42
+ gsub('CONFIG_CODE', config_code).
43
+ gsub('OSDEPS_CODE', osdeps_code).
44
+ gsub('SYSTEM_CODE', system_code).
45
+ gsub('OSDEPS_DEFAULTS', osdeps_defaults).
46
+ gsub('TOOLS_CODE', tools_code)
47
+ File.open(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap'), 'w') do |io|
48
+ io.write bootstrap_code
90
49
  end
91
50
  end
92
-
51
+ file 'bin/autoproj_bootstrap' => 'bootstrap'
93
52
 
data/autoproj.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'autoproj/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "autoproj"
8
+ s.version = Autoproj::VERSION
9
+ s.authors = ["Sylvain Joyeux"]
10
+ s.email = "sylvain.joyeux@m4x.org"
11
+ s.summary = "Easy installation and management of sets of software packages"
12
+ s.description = "autoproj is a manager for sets of software packages. It allows the user to import and build packages from source, still using the underlying distribution's native package manager for software that is available on it."
13
+ s.homepage = "http://rock-robotics.org"
14
+ s.licenses = ["BSD"]
15
+
16
+ s.require_paths = ["lib"]
17
+ s.extensions = []
18
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+
20
+ s.add_runtime_dependency "autobuild", ">= 1.10.0.a"
21
+ s.add_runtime_dependency "utilrb", ">= 2.0"
22
+ s.add_runtime_dependency "thor", '~> 0.19.0', '>= 0.19.1'
23
+ s.add_runtime_dependency 'concurrent-ruby'
24
+ s.add_development_dependency "flexmock", ">= 2.0.0"
25
+ s.add_development_dependency "minitest", ">= 5.0", "~> 5.0"
26
+ s.add_development_dependency "fakefs"
27
+ s.add_development_dependency "simplecov"
28
+ end
29
+
@@ -8,9 +8,14 @@ def validate_options(argv, options = Hash.new)
8
8
  argv, options = super
9
9
 
10
10
  if argv.empty?
11
- raise ArgumentError, "expected one cache directory as argument"
11
+ default_cache_dirs = Autobuild::Importer.default_cache_dirs
12
+ if !default_cache_dirs || default_cache_dirs.empty?
13
+ raise ArgumentError, "no cache directory defined with e.g. the AUTOBUILD_CACHE_DIR environment variable, expected one cache directory as argument"
14
+ end
15
+ Autoproj.warn "using cache directory #{default_cache_dirs.first} from the autoproj configuration"
16
+ argv << default_cache_dirs.first
12
17
  elsif argv.size > 1
13
- raise ArgumentError, "expected one cache directory as argument"
18
+ raise ArgumentError, "expected only one cache directory as argument"
14
19
  end
15
20
 
16
21
  return File.expand_path(argv.first, ws.root_dir), options
@@ -64,13 +64,13 @@ def status(*packages)
64
64
  run_autoproj_cli(:status, :Status, Hash[], *packages)
65
65
  end
66
66
 
67
- desc 'doc', 'generate API documentation for packages that support it'
67
+ desc 'doc [PACKAGES]', 'generate API documentation for packages that support it'
68
68
  option :without_deps, desc: 'generate documentation for the packages given on the command line, and not for their dependencies'
69
69
  def doc(*packages)
70
70
  run_autoproj_cli(:doc, :Doc, Hash[], *packages)
71
71
  end
72
72
 
73
- desc 'update', 'update packages'
73
+ desc 'update [PACKAGES]', 'update packages'
74
74
  option :aup, default: false, hide: true, type: :boolean,
75
75
  desc: 'behave like aup'
76
76
  option :all, default: false, hide: true, type: :boolean,
@@ -110,7 +110,7 @@ def update(*packages)
110
110
  run_autoproj_cli(:update, :Update, Hash[silent: false], *packages)
111
111
  end
112
112
 
113
- desc 'build', 'build packages'
113
+ desc 'build [PACKAGES]', 'build packages'
114
114
  option :amake, default: false, hide: true, type: :boolean,
115
115
  desc: 'behave like amake'
116
116
  option :all, default: false, hide: true, type: :boolean,
@@ -136,8 +136,8 @@ def build(*packages)
136
136
  desc: 'do not stop on errors'
137
137
  option :checkout_only, aliases: :c, type: :boolean, default: false,
138
138
  desc: "only checkout packages, do not update already-cached ones"
139
- def cache(cache_dir)
140
- run_autoproj_cli(:cache, :Cache, Hash[], cache_dir)
139
+ def cache(*cache_dir)
140
+ run_autoproj_cli(:cache, :Cache, Hash[], *cache_dir)
141
141
  end
142
142
 
143
143
  desc 'clean [PACKAGES]', 'remove build byproducts for the given packages'
@@ -164,7 +164,7 @@ def reconfigure
164
164
  desc 'test', 'interface for running tests'
165
165
  subcommand 'test', MainTest
166
166
 
167
- desc 'show', 'show informations about package(s)'
167
+ desc 'show [PACKAGES]', 'show informations about package(s)'
168
168
  option :mainline, type: :string,
169
169
  desc: "compare to the given baseline. if 'true', the comparison will ignore any override, otherwise it will take into account overrides only up to the given package set"
170
170
  def show(*packages)
@@ -216,14 +216,27 @@ def log(*args)
216
216
  run_autoproj_cli(:log, :Log, Hash[], *args)
217
217
  end
218
218
 
219
- desc 'reset VERSION_ID', 'resets packages to the required version (either reflog from autoproj log or commit/tag in the build configuration'
219
+ desc 'reset VERSION_ID', 'resets packages to the state stored in the required version'
220
+ long_desc <<-EOD
221
+ reset VERSION_ID will infer the state of packages from the state stored in the requested version,
222
+ and reset the packages to these versions. VERSION_ID can be:
223
+ - an autoproj log entry (e.g. autoproj@{10})
224
+ - a branch or tag from the autoproj main build configuration
225
+ EOD
220
226
  option :freeze, type: :boolean, default: false,
221
227
  desc: 'whether the version we reset to should be saved in overrides.d or not'
222
228
  def reset(version_id)
223
229
  run_autoproj_cli(:reset, :Reset, Hash[], version_id)
224
230
  end
225
231
 
226
- desc 'tag [TAG_NAME] [PACKAGES]', 'save the package current versions as a tag in the main build configuration, or lists the available tags if given no arguments'
232
+ desc 'tag [TAG_NAME] [PACKAGES]', 'save the package current versions as a tag, or lists the available tags if given no arguments.'
233
+ long_desc <<-EOD
234
+ The tag subcommand stores the state of all packages (or of the packages selected
235
+ on the command line) into a tag in the build configuration. This state can be
236
+ retrieved later on by using "autoproj reset"
237
+
238
+ If given no arguments, will list the existing tags
239
+ EOD
227
240
  option :package_sets, type: :boolean,
228
241
  desc: 'commit the package set state as well (enabled by default)'
229
242
  option :keep_going, aliases: :k, type: :boolean,
@@ -235,7 +248,15 @@ def tag(tag_name = nil, *packages)
235
248
  run_autoproj_cli(:tag, :Tag, Hash[], tag_name, *packages)
236
249
  end
237
250
 
238
- desc 'tag [PACKAGES]', 'save the package current versions as a new commit in the main build configuration'
251
+ desc 'commit [PACKAGES]', 'save the package current versions as a new commit in the main build configuration'
252
+ long_desc <<-EOD
253
+ The commit subcommand stores the state of all packages (or of the packages
254
+ selected on the command line) into a new commit in the currently checked-out
255
+ branch of the build configuration. This state can be retrieved later on by using
256
+ "autoproj reset"
257
+
258
+ If given no arguments, will list the existing tags
259
+ EOD
239
260
  option :package_sets, type: :boolean,
240
261
  desc: 'commit the package set state as well (enabled by default)'
241
262
  option :keep_going, aliases: :k, type: :boolean,
@@ -243,8 +264,8 @@ def tag(tag_name = nil, *packages)
243
264
  desc: 'do not stop on build or checkout errors'
244
265
  option :message, aliases: :m, type: :string,
245
266
  desc: 'the message to use for the new commit (the default is to mention the creation of the tag)'
246
- def tag(*packages)
247
- run_autoproj_cli(:tag, :Tag, Hash[], *packages)
267
+ def commit(*packages)
268
+ run_autoproj_cli(:commit, :Commit, Hash[], *packages)
248
269
  end
249
270
 
250
271
  desc 'switch-config VCS URL [OPTIONS]', 'switches the main build configuration'
@@ -254,27 +275,27 @@ def switch_config(*args)
254
275
 
255
276
  desc 'query [QUERY]', 'searches for packages matching a query string. With no query string, matches all packages.'
256
277
  long_desc <<-EOD
257
- Finds packages that match query_string and displays information about them (one per line)
258
- By default, only the package name is displayed. It can be customized with the --format option
278
+ Finds packages that match query_string and displays information about them (one per line)
279
+ By default, only the package name is displayed. It can be customized with the --format option
259
280
 
260
- QUERY KEYS
281
+ QUERY KEYS
261
282
 
262
- autobuild.name: the package name,
263
- autobuild.srcdir: the package source directory,
264
- autobuild.class.name: the package class,
265
- vcs.type: the VCS type (as used in the source.yml files),
266
- vcs.url: the URL from the VCS,
267
- package_set.name: the name of the package set that defines the package
283
+ autobuild.name: the package name,
284
+ autobuild.srcdir: the package source directory,
285
+ autobuild.class.name: the package class,
286
+ vcs.type: the VCS type (as used in the source.yml files),
287
+ vcs.url: the URL from the VCS,
288
+ package_set.name: the name of the package set that defines the package
268
289
 
269
- FORMAT SPECIFICATION
290
+ FORMAT SPECIFICATION
270
291
 
271
- The format is a string in which special values can be expanded using a $VARNAME format. The following variables are accepted:
292
+ The format is a string in which special values can be expanded using a $VARNAME format. The following variables are accepted:
272
293
 
273
- NAME: the package name,
294
+ NAME: the package name,
274
295
 
275
- SRCDIR: the full path to the package source directory,
296
+ SRCDIR: the full path to the package source directory,
276
297
 
277
- PREFIX: the full path to the package installation directory
298
+ PREFIX: the full path to the package installation directory
278
299
  EOD
279
300
  option :search_all, type: :boolean,
280
301
  desc: 'search in all defined packages instead of only in those selected selected in the layout'
@@ -1,10 +1,12 @@
1
1
  module Autoproj
2
2
  module CLI
3
3
  class MainTest < Thor
4
+ namespace 'test'
5
+
4
6
  default_command 'exec'
5
7
 
6
8
  desc 'enable [PACKAGES]', 'enable tests for the given packages (or for all packages if none are given)'
7
- option :deps, default: false,
9
+ option :deps, type: :boolean, default: false,
8
10
  desc: 'controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)'
9
11
  def enable(*packages)
10
12
  require 'autoproj/cli/test'
@@ -16,7 +18,7 @@ def enable(*packages)
16
18
  end
17
19
 
18
20
  desc 'disable [PACKAGES]', 'disable tests for the given packages (or for all packages if none are given)'
19
- option :deps, default: false,
21
+ option :deps, type: :boolean, default: false,
20
22
  desc: 'controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)'
21
23
  def disable(*packages)
22
24
  require 'autoproj/cli/test'
@@ -28,7 +30,7 @@ def disable(*packages)
28
30
  end
29
31
 
30
32
  desc 'list [PACKAGES]', 'show test enable/disable status for the given packages (or all packages if none are given)'
31
- option :deps, default: false,
33
+ option :deps, type: :boolean, default: false,
32
34
  desc: 'controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)'
33
35
  def list(*packages)
34
36
  require 'autoproj/cli/test'
@@ -40,7 +42,7 @@ def list(*packages)
40
42
  end
41
43
 
42
44
  desc 'exec [PACKAGES]', 'execute the tests for the given packages, or all if no packages are given on the command line'
43
- option :deps, default: false,
45
+ option :deps, type: :boolean, default: false,
44
46
  desc: 'controls whether to execute the tests of the dependencies of the packages given on the command line (the default is not)'
45
47
  def exec(*packages)
46
48
  require 'autoproj/cli/test'
@@ -72,8 +72,8 @@ def status_of_package(package_description, options = Hash.new)
72
72
  end
73
73
  if snapshot_overrides_vcs?(importer, package_description.vcs, snapshot)
74
74
  non_nil_values = snapshot.delete_if { |k, v| !v }
75
- package_status.msg << Autoproj.color(" found configuration that contains all local changes: #{non_nil_values.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(", ")}", :light_green)
76
- package_status.msg << Autoproj.color(" consider adding this to your overrides, or use autoproj versions to do it for you", :light_green)
75
+ package_status.msg << Autoproj.color(" found configuration that contains all local changes: #{non_nil_values.sort_by(&:first).map { |k, v| "#{k}: #{v}" }.join(", ")}", :bright_green)
76
+ package_status.msg << Autoproj.color(" consider adding this to your overrides, or use autoproj versions to do it for you", :bright_green)
77
77
  if options[:snapshot]
78
78
  importer.relocate(importer.repository, snapshot)
79
79
  end
@@ -255,6 +255,11 @@ def apply_autobuild_configuration
255
255
  end
256
256
  end
257
257
  end
258
+
259
+ # A cache directory for autobuild's importers
260
+ def importer_cache_dir
261
+ get('importer_cache_dir', nil)
262
+ end
258
263
 
259
264
  # The directory in which packages will be installed.
260
265
  #
@@ -0,0 +1,117 @@
1
+ module Autoproj
2
+ # Adds the relevant options to handle a gitorious server
3
+ # What this does is ask the user how he would like to access the gitorious
4
+ # server. Then, it sets
5
+ #
6
+ # #{name}_ROOT to be the base URL for pulling
7
+ # #{name}_PUSH_ROOT to be the corresponding ssh-based URL for pushing
8
+ #
9
+ # For instance, with
10
+ #
11
+ # git_server_configuration "GITHUB", "github.com"
12
+ #
13
+ #
14
+ # One would use the following shortcut in its source.yml:
15
+ #
16
+ # - my/package:
17
+ # github: account/package
18
+ #
19
+ # which would be expanded to the expected URLs for pull and push.
20
+ #
21
+ def self.git_server_configuration(name, base_url, options = Hash.new)
22
+ options = Kernel.validate_options options,
23
+ git_url: "git://#{base_url}",
24
+ http_url: "https://git.#{base_url}",
25
+ ssh_url: "git@#{base_url}:",
26
+ default: 'http,ssh',
27
+ disabled_methods: [],
28
+ config: Autoproj.config,
29
+ fallback_to_http: nil
30
+
31
+ config = options.delete(:config)
32
+ disabled_methods = Array(options[:disabled_methods])
33
+
34
+ access_methods = Hash[
35
+ 'git' => 'git,ssh',
36
+ 'ssh' => 'ssh,ssh',
37
+ 'http' => 'http,http']
38
+
39
+ gitorious_long_doc = [
40
+ "How should I interact with #{base_url} (#{(access_methods.keys - disabled_methods).sort.join(", ")})",
41
+ "If you give one value, it's going to be the method used for all access",
42
+ "If you give multiple values, comma-separated, the first one will be",
43
+ "used for pulling and the second one for pushing. An optional third value",
44
+ "will be used to pull from private repositories (the same than pushing is",
45
+ "used by default)"]
46
+
47
+ validator = lambda do |value|
48
+ values = (access_methods[value] || value).split(",")
49
+ values.each do |access_method|
50
+ if !access_methods.has_key?(access_method)
51
+ raise Autoproj::InputError, "#{access_method} is not a known access method"
52
+ elsif disabled_methods.include?(access_method)
53
+ raise Autoproj::InputError, "#{access_method} is disabled on #{base_url}"
54
+ end
55
+ end
56
+ value
57
+ end
58
+
59
+ config.declare name, 'string',
60
+ default: options[:default],
61
+ doc: gitorious_long_doc, &validator
62
+
63
+ access_mode = config.get(name)
64
+ begin
65
+ validator[access_mode]
66
+ rescue Autoproj::InputError => e
67
+ Autoproj.warn e.message
68
+ config.reset(name)
69
+ access_mode = config.get(name)
70
+ end
71
+ access_mode = access_methods[access_mode] || access_mode
72
+ pull, push, private_pull = access_mode.split(',')
73
+ private_pull ||= push
74
+ [[pull, "_ROOT"], [push, "_PUSH_ROOT"], [private_pull, "_PRIVATE_ROOT"]].each do |method, var_suffix|
75
+ url = if method == "git" then options[:git_url]
76
+ elsif method == "http" then options[:http_url]
77
+ elsif method == "ssh" then options[:ssh_url]
78
+ end
79
+ config.set("#{name}#{var_suffix}", url)
80
+ end
81
+
82
+ Autoproj.add_source_handler name.downcase do |url, vcs_options|
83
+ if url !~ /\.git$/
84
+ url += ".git"
85
+ end
86
+ if url !~ /^\//
87
+ url = "/#{url}"
88
+ end
89
+ github_options, vcs_options = Kernel.filter_options vcs_options,
90
+ private: false
91
+
92
+ pull_base_url =
93
+ if github_options[:private]
94
+ config.get("#{name}_PRIVATE_ROOT")
95
+ else
96
+ config.get("#{name}_ROOT")
97
+ end
98
+ push_base_url = config.get("#{name}_PUSH_ROOT")
99
+ Hash[type: 'git',
100
+ url: "#{pull_base_url}#{url}",
101
+ push_to: "#{push_base_url}#{url}",
102
+ interactive: (github_options[:private] && private_pull == 'http'),
103
+ retry_count: 10,
104
+ repository_id: "#{name.downcase}:#{url}"].merge(vcs_options)
105
+ end
106
+ end
107
+
108
+ def self.gitorious_server_configuration(name, base_url, options = Hash.new)
109
+ Autoproj.warn "gitorious_server_configuration is deprecated, replace by git_server_configuration"
110
+ Autoproj.warn "Note that the call interface has not changed, you only need to change the method name"
111
+ git_server_configuration(name, base_url, options)
112
+ end
113
+ end
114
+
115
+ Autoproj.git_server_configuration('GITORIOUS', 'gitorious.org', default: 'http,ssh', disabled_methods: 'git')
116
+ Autoproj.git_server_configuration('GITHUB', 'github.com', http_url: 'https://github.com', default: 'http,ssh')
117
+