autoproj 1.10.2 → 1.11.0.b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +9 -0
  3. data/Rakefile +4 -0
  4. data/bin/aup +5 -1
  5. data/bin/autolocate +1 -82
  6. data/bin/autoproj +6 -56
  7. data/bin/autoproj-bootstrap +31 -3
  8. data/bin/autoproj-cache +3 -60
  9. data/bin/autoproj-clean +1 -1
  10. data/bin/autoproj-create-set +0 -0
  11. data/bin/autoproj-doc +1 -1
  12. data/bin/autoproj-envsh +0 -0
  13. data/bin/autoproj-list +1 -1
  14. data/bin/autoproj-locate +17 -16
  15. data/bin/autoproj-query +0 -0
  16. data/bin/autoproj-show +0 -0
  17. data/bin/autoproj-switch-config +23 -0
  18. data/bin/autoproj-test +2 -2
  19. data/bin/autoproj_bootstrap +354 -210
  20. data/bin/autoproj_bootstrap.in +8 -0
  21. data/bin/autoproj_stress_test +1 -1
  22. data/lib/autoproj.rb +7 -0
  23. data/lib/autoproj/autobuild.rb +14 -35
  24. data/lib/autoproj/build_option.rb +104 -0
  25. data/lib/autoproj/cmdline.rb +62 -355
  26. data/lib/autoproj/configuration.rb +161 -0
  27. data/lib/autoproj/gitorious.rb +31 -20
  28. data/lib/autoproj/installation_manifest.rb +7 -1
  29. data/lib/autoproj/manifest.rb +124 -342
  30. data/lib/autoproj/ops/build.rb +107 -0
  31. data/lib/autoproj/ops/cache.rb +82 -0
  32. data/lib/autoproj/ops/configuration.rb +302 -0
  33. data/lib/autoproj/ops/loader.rb +97 -0
  34. data/lib/autoproj/ops/main_config_switcher.rb +271 -0
  35. data/lib/autoproj/ops/tools.rb +54 -0
  36. data/lib/autoproj/options.rb +26 -178
  37. data/lib/autoproj/osdeps.rb +49 -9
  38. data/lib/autoproj/package_set.rb +168 -87
  39. data/lib/autoproj/system.rb +6 -23
  40. data/lib/autoproj/variable_expansion.rb +0 -1
  41. data/lib/autoproj/vcs_definition.rb +23 -0
  42. data/lib/autoproj/version.rb +1 -1
  43. metadata +17 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a840434e06242556cb58e8b6c31c19f7a0bb1df
4
- data.tar.gz: 4133e112675520bad959d89e9bdf08e75db32567
3
+ metadata.gz: a6d9f944537d588d5d919fd531860f93dea6f072
4
+ data.tar.gz: 899edc4f1296f7b0b57e94005b713d6f0f8b05e2
5
5
  SHA512:
6
- metadata.gz: 141ae467ba7ecb832f5b59e9ab64c929b602031c118626e66917dfea3c7782e488288ac0671d4896dc64cff519f5f1eb8d6ebc60bd069bd0b56ce88946d41894
7
- data.tar.gz: 500bd6468d4bda5982f8cb4330ca070c5e0adca764ab9f3a54311fb464420419e394bf4518449cc9e7e4d77bd2a074216921b67f573914c39b498a6fda3534a7
6
+ metadata.gz: 2509de689250e5d00dfb76fa57617c558a793db9f0d81b75c94e1eb31ff9e0f9a55a9dd4aff8b9f5d5ed23ab1491eaded5b7ba2912ed66174599e442d0d709a8
7
+ data.tar.gz: db15a52b8ea0e89aa58e64586b4e39c6079a290e8d4f583ed91991c567bad18a9f4f35ecbf934bdc410af894de5aaca74d1c5b88857fd1015851d08261d7e883
@@ -18,6 +18,7 @@ bin/autoproj-locate
18
18
  bin/autoproj-query
19
19
  bin/autoproj-show
20
20
  bin/autoproj-snapshot
21
+ bin/autoproj-switch-config
21
22
  bin/autoproj-test
22
23
  bin/autoproj_bootstrap
23
24
  bin/autoproj_bootstrap.in
@@ -25,13 +26,21 @@ bin/autoproj_stress_test
25
26
  lib/autoproj.rb
26
27
  lib/autoproj/autobuild.rb
27
28
  lib/autoproj/base.rb
29
+ lib/autoproj/build_option.rb
28
30
  lib/autoproj/cmdline.rb
31
+ lib/autoproj/configuration.rb
29
32
  lib/autoproj/default.osdeps
30
33
  lib/autoproj/environment.rb
31
34
  lib/autoproj/gitorious.rb
32
35
  lib/autoproj/installation_manifest.rb
33
36
  lib/autoproj/manifest.rb
34
37
  lib/autoproj/metapackage.rb
38
+ lib/autoproj/ops/main_config_switcher.rb
39
+ lib/autoproj/ops/build.rb
40
+ lib/autoproj/ops/cache.rb
41
+ lib/autoproj/ops/configuration.rb
42
+ lib/autoproj/ops/loader.rb
43
+ lib/autoproj/ops/tools.rb
35
44
  lib/autoproj/options.rb
36
45
  lib/autoproj/osdeps.rb
37
46
  lib/autoproj/package_definition.rb
data/Rakefile CHANGED
@@ -29,6 +29,8 @@ namespace 'dist' do
29
29
  desc "generate the bootstrap script"
30
30
  task 'bootstrap' do
31
31
  require 'yaml'
32
+ build_option_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'build_option.rb'))
33
+ config_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'configuration.rb'))
32
34
  osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
33
35
  options_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'options.rb'))
34
36
  system_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'system.rb'))
@@ -54,6 +56,8 @@ namespace 'dist' do
54
56
  end
55
57
 
56
58
  bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
59
+ gsub('BUILD_OPTION_CODE', build_option_code).
60
+ gsub('CONFIG_CODE', config_code).
57
61
  gsub('OSDEPS_CODE', osdeps_code).
58
62
  gsub('OPTIONS_CODE', options_code).
59
63
  gsub('SYSTEM_CODE', system_code).
data/bin/aup CHANGED
@@ -1,7 +1,8 @@
1
1
  #! /usr/bin/env ruby
2
2
  require 'optparse'
3
+ require 'autoproj'
3
4
 
4
- build_all = false
5
+ build_all = (Dir.pwd == Autoproj.root_dir)
5
6
  parser = OptionParser.new do |opt|
6
7
  opt.banner = "aup [options] [dir_or_package]
7
8
  Runs autoproj update for the given directory or package name.
@@ -34,8 +35,11 @@ while !options.empty?
34
35
  end
35
36
  end
36
37
 
38
+
37
39
  # If --all is not given *and* there is no non-option argument (i.e. no directory
38
40
  # / package name), add the current directory to the command line
41
+ #
42
+ # BUT make running 'aup' in the root directory the equivalent of aup --all
39
43
  if remaining.grep(/^-/).size == remaining.size && !build_all
40
44
  remaining.push '.'
41
45
  end
@@ -1,84 +1,3 @@
1
1
  #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
-
6
- Autoproj.silent = true
7
- root_dir = Autoproj::CmdLine.initialize_root_directory
8
- selection = Autoproj::CmdLine.initialize_and_load(ARGV)
9
- if selection.empty?
10
- puts root_dir
11
- exit 0
12
- elsif selection.size > 1
13
- STDERR.puts Autoproj.console.color("more than one name given on the command line", :red)
14
- exit 1
15
- end
16
- selection = selection.first
17
-
18
- selection_rx = Regexp.new(Regexp.quote(selection))
19
- candidates = []
20
- Autoproj.manifest.each_package do |pkg|
21
- name = pkg.name
22
- next if !Autoproj.manifest.package_enabled?(name)
23
-
24
- srcdir = Autobuild::Package[name].srcdir
25
- if name == selection
26
- puts srcdir
27
- exit(0)
28
- elsif name =~ selection_rx
29
- candidates << srcdir
30
- end
31
- end
32
-
33
- if candidates.empty?
34
- # Try harder. Match directory prefixes
35
- directories = selection.split('/')
36
- rx = directories.
37
- map { |d| "#{Regexp.quote(d)}\\w*" }.
38
- join("/")
39
- rx = Regexp.new(rx)
40
-
41
- rx_strict = directories[0..-2].
42
- map { |d| "#{Regexp.quote(d)}\\w*" }.
43
- join("/")
44
- rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$")
45
-
46
- candidates_strict = []
47
- Autoproj.manifest.each_package do |pkg|
48
- name = pkg.name
49
- next if !Autoproj.manifest.package_enabled?(name)
50
-
51
- srcdir = Autobuild::Package[name].srcdir
52
- if name =~ rx
53
- candidates << srcdir
54
- end
55
- if name =~ rx_strict
56
- candidates_strict << srcdir
57
- end
58
- end
59
-
60
- if candidates.size > 1 && candidates_strict.size == 1
61
- candidates = candidates_strict
62
- end
63
- end
64
-
65
- if candidates.size > 1
66
- # If there is more than one candidate, check if there are some that are not
67
- # present on disk
68
- present = candidates.find_all { |dir| File.directory?(dir) }
69
- if present.size == 1
70
- candidates = present
71
- end
72
- end
73
-
74
- if candidates.empty?
75
- STDERR.puts Autoproj.console.color("cannot find #{selection} in the current autoproj installation", :bold, :red)
76
- exit 1
77
- elsif candidates.size > 1
78
- STDERR.puts Autoproj.console.color("multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}", :bold, :red)
79
- exit 1
80
- else
81
- puts candidates.first
82
- exit(0)
83
- end
2
+ load File.expand_path('autoproj-locate', File.dirname(__FILE__))
84
3
 
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- if RUBY_VERSION < "1.8.7"
4
- STDERR.puts "autoproj requires Ruby >= 1.8.7"
3
+ if RUBY_VERSION < "1.9.2"
4
+ STDERR.puts "autoproj requires Ruby >= 1.9.2"
5
5
  exit 1
6
6
  end
7
7
 
@@ -18,15 +18,9 @@ def color(*args)
18
18
  Autoproj.color(*args)
19
19
  end
20
20
 
21
- if defined? Encoding # This is a 1.9-only thing
22
- Encoding.default_internal = Encoding::UTF_8
23
- Encoding.default_external = Encoding::UTF_8
24
- end
21
+ Encoding.default_internal = Encoding::UTF_8
22
+ Encoding.default_external = Encoding::UTF_8
25
23
  Autoproj::OSDependencies.autodetect_ruby
26
- if defined? Encoding # This is a 1.9-only thing
27
- Encoding.default_internal = Encoding::UTF_8
28
- Encoding.default_external = Encoding::UTF_8
29
- end
30
24
 
31
25
  # Check the first element of ARGV. If a tool called autoproj-VALUE exists, just
32
26
  # pass the hand to it
@@ -47,27 +41,7 @@ end
47
41
 
48
42
  # Find the autoproj root dir
49
43
  Autoproj::CmdLine.report do
50
- selected_packages =
51
- begin Autoproj::CmdLine.parse_arguments(ARGV.dup)
52
- rescue RuntimeError => e
53
- if Autoproj::CmdLine.bootstrap? && !Autoproj.in_autoproj_installation?(Dir.pwd)
54
- STDERR.puts <<EOTEXT
55
-
56
-
57
- #{color('autoproj bootstrap failed', :red, :bold)}
58
- To retry, first source the #{Autoproj::ENV_FILENAME} script with
59
- source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
60
- and then re-run autoproj bootstrap with
61
- autoproj bootstrap <vcs_type> <vcs_url> <vcs_options>
62
-
63
- where
64
- 'vcs_type' is git, svn, darcs, cvs
65
- 'vcs_url' is the vcs-specific URL to the repository, and
66
- 'vcs_options' are optional values that can be given to the chosen VCS
67
- EOTEXT
68
- end
69
- raise
70
- end
44
+ selected_packages = Autoproj::CmdLine.parse_arguments(ARGV.dup)
71
45
 
72
46
  # Expand directories in the selected_packages set, before we chdir to the
73
47
  # autoproj root
@@ -166,30 +140,6 @@ EOTEXT
166
140
  Autoproj::CmdLine.display_configuration(manifest, selected_packages.packages)
167
141
  end
168
142
 
169
- if Autoproj::CmdLine.bootstrap?
170
- STDERR.puts <<EOTEXT
171
-
172
-
173
- #{color('autoproj bootstrap successfully finished', :green, :bold)}
174
-
175
- #{color('To further use autoproj and the installed software', :bold)}, you
176
- must add the following line at the bottom of your .bashrc:
177
- source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
178
-
179
- WARNING: autoproj will not work until your restart all
180
- your consoles, or run the following in them:
181
- $ source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
182
-
183
- #{color('To import and build the packages', :bold)}, you can now run
184
- autoproj update
185
- autoproj build
186
-
187
- The resulting software is installed in
188
- #{Dir.pwd}/install
189
-
190
- EOTEXT
191
- end
192
-
193
143
  if Autoproj::CmdLine.only_config? || Autoproj::CmdLine.reconfigure?
194
144
  exit(0)
195
145
  end
@@ -284,7 +234,7 @@ EOTEXT
284
234
  Autoproj.message
285
235
  Autoproj.message "statistics about the build", :bold
286
236
 
287
- Autoproj.manifest.each_package.sort_by(&:name).each do |pkg|
237
+ Autoproj.manifest.each_autobuild_package.sort_by(&:name).each do |pkg|
288
238
  next if pkg.statistics.empty?
289
239
 
290
240
  if per_phase.empty?
@@ -1,15 +1,43 @@
1
1
  #! /usr/bin/env ruby
2
2
  require 'autoproj'
3
+ require 'autoproj/ops/main_config_switcher'
3
4
 
5
+ root_dir = Dir.pwd
4
6
  Autoproj::CmdLine.report do
7
+ switcher = Autoproj::Ops::MainConfigSwitcher.new(root_dir)
5
8
  begin
6
- Autoproj::CmdLine.bootstrap(*ARGV)
9
+ switcher.bootstrap(*ARGV)
10
+ manifest = Autoproj::Manifest.load(File.join(Autoproj.config_dir, 'manifest'))
11
+ update = Autoproj::Ops::Configuration.new(manifest, Autoproj::Ops.loader)
12
+ update.update_configuration
7
13
 
8
- rescue RuntimeError => e
14
+ STDERR.puts <<EOTEXT
15
+
16
+
17
+ #{color('autoproj bootstrap successfully finished', :green, :bold)}
18
+
19
+ #{color('To further use autoproj and the installed software', :bold)}, you
20
+ must add the following line at the bottom of your .bashrc:
21
+ source #{root_dir}/#{Autoproj::ENV_FILENAME}
22
+
23
+ WARNING: autoproj will not work until your restart all
24
+ your consoles, or run the following in them:
25
+ $ source #{root_dir}/#{Autoproj::ENV_FILENAME}
26
+
27
+ #{color('To import and build the packages', :bold)}, you can now run
28
+ autoproj update
29
+ autoproj build
30
+
31
+ The resulting software is installed in
32
+ #{root_dir}/install
33
+
34
+ EOTEXT
35
+
36
+ rescue RuntimeError
9
37
  STDERR.puts <<-EOTEXT
10
38
  #{color('autoproj bootstrap failed', :red, :bold)}
11
39
  To retry, first source the #{Autoproj::ENV_FILENAME} script with
12
- source #{Dir.pwd}/#{Autoproj::ENV_FILENAME}
40
+ source #{root_dir}/#{Autoproj::ENV_FILENAME}
13
41
  and then re-run autoproj bootstrap with
14
42
  autoproj bootstrap <vcs_type> <vcs_url> <vcs_options>
15
43
 
@@ -1,75 +1,18 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
3
  require 'autoproj'
4
+ require 'autoproj/ops/cache'
4
5
 
5
6
  root_dir = Autoproj::CmdLine.initialize_root_directory
6
7
 
7
- def with_retry(count)
8
- (count + 1).times do |i|
9
- begin
10
- break yield
11
- rescue Autobuild::SubcommandFailed
12
- if i == count
13
- raise
14
- else
15
- Autobuild.message " failed, retrying (#{i}/#{count})"
16
- end
17
- end
18
- end
19
- end
20
-
21
8
  Autoproj::CmdLine.report do
22
9
  cache_dir, *_ =
23
10
  Autoproj.silent do
24
11
  Autoproj::CmdLine.initialize_and_load(ARGV)
25
12
  end
26
- manifest = Autoproj.manifest
27
-
28
13
  cache_dir = File.expand_path(cache_dir, root_dir)
29
- if !File.exists?(cache_dir)
30
- Autoproj.message " creating autoproj cache in #{cache_dir}"
31
- FileUtils.mkdir_p cache_dir
32
- else
33
- Autoproj.message " updating already existing cache repository in #{cache_dir}"
34
- end
35
- archive_cache_dir = File.join(cache_dir, 'archives')
36
- if !File.directory?(archive_cache_dir)
37
- Autoproj.message " creating archive cache in #{archive_cache_dir}"
38
- FileUtils.mkdir_p archive_cache_dir
39
- else
40
- Autoproj.message " updating already existing archive cache in #{archive_cache_dir}"
41
- end
42
- git_cache_dir = File.join(cache_dir, 'git')
43
- if !File.directory?(git_cache_dir)
44
- Autoproj.message " creating git cache in #{git_cache_dir}"
45
- FileUtils.mkdir_p git_cache_dir
46
- Autobuild::Subprocess.run("autoproj-cache", "import", Autobuild.tool(:git), "--git-dir", git_cache_dir, 'init', "--bare")
47
- else
48
- Autoproj.message " updating already existing git cache in #{git_cache_dir}"
49
- end
50
-
51
- manifest.each_package do |pkg|
52
- if pkg.importer.kind_of?(Autobuild::Git)
53
- Autoproj.message " caching #{pkg.name} (git)"
54
- pkg.importdir = git_cache_dir
55
- pkg.importer.local_branch = nil
56
- pkg.importer.remote_branch = nil
57
- remote_name = pkg.name.gsub(/[^\w]/, '_')
58
- pkg.importer.remote_name = remote_name
59
- pkg.importer.update_remotes_configuration(pkg, 'autoproj-cache')
60
-
61
- with_retry(10) do
62
- Autobuild::Subprocess.run('autoproj-cache', :import, Autobuild.tool('git'), '--git-dir', git_cache_dir, 'remote', 'update', remote_name)
63
- end
64
- elsif pkg.importer.kind_of?(Autobuild::ArchiveImporter)
65
- Autoproj.message " caching #{pkg.name} (archive)"
66
- pkg.importer.cachedir = archive_cache_dir
67
- with_retry(10) do
68
- pkg.importer.update_cache(pkg)
69
- end
70
- end
71
- end
72
14
 
73
- Autobuild::Subprocess.run('autoproj-cache', :import, Autobuild.tool('git'), '--git-dir', git_cache_dir, 'gc', '--aggressive', '--prune=all')
15
+ cache_op = Autoproj::Ops::Cache.new(cache_dir, Autoproj.manifest)
16
+ cache_op.create_or_update
74
17
  end
75
18
 
@@ -7,7 +7,7 @@ Autoproj.silent = true
7
7
  root_dir = Autoproj::CmdLine.initialize_root_directory
8
8
  Autoproj::CmdLine.initialize_and_load(ARGV)
9
9
 
10
- Autoproj.manifest.each_package do |pkg|
10
+ Autoproj.manifest.each_autobuild_package do |pkg|
11
11
  pkg.prepare_for_rebuild
12
12
  end
13
13
 
File without changes
@@ -23,6 +23,6 @@ Autoproj::CmdLine.report do
23
23
  # This calls #prepare, which is required to run build_packages
24
24
  packages = Autoproj::CmdLine.import_packages(resolved_selection)
25
25
  packages.each { |pkg| Autobuild::Package[pkg].disable_phases('import', 'prepare', 'install') }
26
- Autoproj::CmdLine.build_packages(resolved_selection, packages, ['doc'])
26
+ Autobuild.apply(packages, "autoproj-doc", ['doc'])
27
27
  end
28
28
 
File without changes
@@ -20,7 +20,7 @@ end
20
20
  all_packages = Hash.new
21
21
  package_sets = manifest.each_package_set.to_a
22
22
  package_sets.each do |pkg_set|
23
- pkg_set.each_package.each do |pkg|
23
+ pkg_set.each_autobuild_package.each do |pkg|
24
24
  all_packages[pkg.name] = [pkg, pkg_set.name]
25
25
  end
26
26
  end
@@ -3,25 +3,28 @@
3
3
  require 'autoproj'
4
4
  require 'autoproj/cmdline'
5
5
 
6
- Autoproj.silent = true
7
6
  root_dir = Autoproj::CmdLine.initialize_root_directory
8
- selection = Autoproj::CmdLine.initialize_and_load(ARGV)
9
- if selection.empty?
7
+
8
+ manifest = Autoproj::InstallationManifest.new(root_dir)
9
+ if !File.file?(manifest.default_manifest_path)
10
+ Autoproj.error "the installation manifest is not present, please run autoproj envsh to generate it"
11
+ end
12
+ manifest.load
13
+
14
+ if ARGV.empty?
10
15
  puts root_dir
11
16
  exit 0
12
- elsif selection.size > 1
13
- STDERR.puts Autoproj.console.color("more than one name given on the command line", :red)
17
+ elsif ARGV.size > 1
18
+ Autoproj.error "more than one name given on the command line"
14
19
  exit 1
15
20
  end
16
- selection = selection.first
21
+ selection = ARGV.first
17
22
 
18
23
  selection_rx = Regexp.new(Regexp.quote(selection))
19
24
  candidates = []
20
- Autoproj.manifest.each_package do |pkg|
25
+ manifest.each do |pkg|
21
26
  name = pkg.name
22
- next if !Autoproj.manifest.package_enabled?(name)
23
-
24
- srcdir = Autobuild::Package[name].srcdir
27
+ srcdir = pkg.srcdir
25
28
  if name == selection
26
29
  puts srcdir
27
30
  exit(0)
@@ -44,11 +47,9 @@ if candidates.empty?
44
47
  rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$")
45
48
 
46
49
  candidates_strict = []
47
- Autoproj.manifest.each_package do |pkg|
50
+ manifest.each do |pkg|
48
51
  name = pkg.name
49
- next if !Autoproj.manifest.package_enabled?(name)
50
-
51
- srcdir = Autobuild::Package[name].srcdir
52
+ srcdir = pkg.srcdir
52
53
  if name =~ rx
53
54
  candidates << srcdir
54
55
  end
@@ -72,10 +73,10 @@ if candidates.size > 1
72
73
  end
73
74
 
74
75
  if candidates.empty?
75
- STDERR.puts Autoproj.console.color("cannot find #{selection} in the current autoproj installation", :bold, :red)
76
+ Autoproj.error "cannot find #{selection} in the current autoproj installation"
76
77
  exit 1
77
78
  elsif candidates.size > 1
78
- STDERR.puts Autoproj.console.color("multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}", :bold, :red)
79
+ Autoproj.error "multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}"
79
80
  exit 1
80
81
  else
81
82
  puts candidates.first