autoproj 1.13.7 → 2.0.0.b1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,13 +0,0 @@
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
- Autoproj::CmdLine.initialize_and_load(ARGV)
9
-
10
- Autoproj.manifest.each_autobuild_package do |pkg|
11
- pkg.prepare_for_rebuild
12
- end
13
-
@@ -1,10 +0,0 @@
1
- #! /bin/sh
2
-
3
- set -e
4
-
5
- cd $(autoproj locate)
6
- autoproj versions --save
7
- cd autoproj
8
- git add overrides.d/50-versions.yml
9
- git commit "$@"
10
-
@@ -1,118 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
-
6
- pwd = Dir.pwd
7
- root_dir = Autoproj::CmdLine.initialize_root_directory
8
- Autoproj.silent do
9
- Autoproj::CmdLine.initialize_and_load([])
10
- end
11
-
12
- parser = OptionParser.new do |opt|
13
- opt.banner = ['autoproj create-set path [package package ..]',
14
- '',
15
- 'Creates a new package set that includes the given packages',
16
- 'Packages can be already defined in other package sets',
17
- 'or (more commonly) paths to checked out packages on disk',
18
- '',
19
- 'The path argument is the path where the package set should',
20
- 'be created. The basename will be used as the package set name',
21
- 'For instance,',
22
- ' autoproj create-set new_set/lead',
23
- 'Will create a new package set definition in the new_set/lead',
24
- 'directory. The new set will be named "lead"'].join("\n")
25
-
26
- end
27
- user_selection = parser.parse(ARGV)
28
-
29
- if !(new_set_path = user_selection.shift)
30
- Autoproj.message("missing path to the generated package set on the command line", :red)
31
- exit 1
32
- end
33
- new_set_path = File.expand_path(new_set_path, pwd)
34
- new_set_name = File.basename(new_set_path)
35
- selection = Autoproj::CmdLine.resolve_user_selection(user_selection)
36
- Autoproj::CmdLine.validate_user_selection(user_selection, selection)
37
-
38
- # Must re-load the package manifests, as the user selection might have triggered
39
- # some auto-add
40
- Autoproj.manifest.packages.each_value do |pkg|
41
- if File.directory?(pkg.autobuild.srcdir)
42
- Autoproj.manifest.load_package_manifest(pkg.autobuild.name)
43
- end
44
- end
45
-
46
- # Extract auto-import and new package information
47
- new_packages, imported_packages = [], []
48
- selection.each do |pkg_name|
49
- pkgs = Autoproj.manifest.resolve_package_name(pkg_name)
50
- pkgs = pkgs.
51
- map { |type, name| name if type == :package }.
52
- compact
53
-
54
- # We look only at direct dependencies. The rest is not our problem (the
55
- # other package set must take care of importing / loading what's needed)
56
- deps = Set.new
57
- pkgs.each do |pkg_name|
58
- Autobuild::Package[pkg_name].dependencies.each do |dep_name|
59
- deps << dep_name
60
- end
61
- end
62
- pkgs = pkgs.to_set | deps
63
- pkgs.each do |pkg_name|
64
- pkg_def = Autoproj.manifest.package(pkg_name)
65
-
66
- if pkg_def.package_set.name == "local"
67
- new_packages << pkg_def
68
- else
69
- imported_packages << pkg_def
70
- end
71
- end
72
- end
73
-
74
- puts
75
- puts
76
- new_packages.each do |pkg|
77
- if !pkg.vcs
78
- # Try to autodetect the VCS
79
- srcdir = pkg.autobuild.srcdir
80
- handler = [Autobuild::Git].find do |vcs_handler|
81
- vcs_handler.can_handle?(srcdir)
82
- end
83
- if handler
84
- raw_vcs = handler.vcs_definition_for(srcdir)
85
- pkg.vcs = Autoproj::VCSDefinition.from_raw(raw_vcs)
86
- else
87
- puts " package #{pkg.autobuild.name} has no version control information"
88
- puts " and I am not able to autodetect it."
89
- puts " you will have to provide this in the generated source.yml file"
90
- end
91
- end
92
- end
93
-
94
- TEMPLATE_DIR = File.expand_path(File.join("..", "lib", "autoproj", "templates"), File.dirname(__FILE__))
95
- def render_template(*args)
96
- binding = args.pop
97
- template = File.read(File.join(TEMPLATE_DIR, *args))
98
- template = ERB.new(template)
99
- template.result(binding)
100
- end
101
-
102
- if File.exists?(new_set_path)
103
- Autoproj.error("There is already a directory, file or symlink in #{new_set_path}.")
104
- Autoproj.error("Delete it or move it before trying again")
105
- exit 1
106
- end
107
-
108
- FileUtils.mkdir_p new_set_path
109
- autobuild = render_template("create-set", "packages.autobuild", binding)
110
- File.open(File.join(new_set_path, "packages.autobuild"), "w") do |io|
111
- io.write autobuild
112
- end
113
-
114
- source_yml = render_template("create-set", "source.yml", binding)
115
- File.open(File.join(new_set_path, "source.yml"), "w") do |io|
116
- io.write source_yml
117
- end
118
-
@@ -1,28 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
-
6
- user_selection = Autoproj.silent do
7
- Autoproj::CmdLine.initialize_root_directory
8
- Autoproj::CmdLine.initialize_and_load(ARGV)
9
- end
10
-
11
- user_selection = user_selection.map do |arg|
12
- if File.directory?(arg)
13
- File.expand_path(arg)
14
- else arg
15
- end
16
- end
17
-
18
- Autobuild.pass_doc_errors = false
19
-
20
- Autoproj::CmdLine.report do
21
- resolved_selection = Autoproj::CmdLine.
22
- resolve_user_selection(user_selection, :filter => false)
23
- # This calls #prepare, which is required to run build_packages
24
- packages = Autoproj::CmdLine.import_packages(resolved_selection)
25
- packages.each { |pkg| Autobuild::Package[pkg].disable_phases('import', 'prepare', 'install') }
26
- Autobuild.apply(packages, "autoproj-doc", ['doc'])
27
- end
28
-
@@ -1,14 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
- Autoproj::CmdLine.report do
6
- Autoproj.silent do
7
- Autoproj::CmdLine.initialize_root_directory
8
- Autoproj::CmdLine.initialize_and_load(ARGV)
9
- end
10
- Autoproj.export_env_sh
11
- Autoproj::CmdLine.export_installation_manifest
12
- Autoproj.message "autoproj: updated #{Autoproj.root_dir}/#{Autoproj::ENV_FILENAME}", :green
13
- end
14
-
@@ -1,69 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
-
6
- Autoproj.silent do
7
- Autoproj::CmdLine.initialize_root_directory
8
- Autoproj::CmdLine.initialize_and_load(ARGV)
9
- end
10
- manifest = Autoproj.manifest
11
-
12
- # Load the manifest for packages that are already present on the
13
- # file system
14
- manifest.packages.each_value do |pkg|
15
- if File.directory?(pkg.autobuild.srcdir)
16
- manifest.load_package_manifest(pkg.autobuild.name)
17
- end
18
- end
19
-
20
- all_packages = Hash.new
21
- package_sets = manifest.each_package_set.to_a
22
- package_sets.each do |pkg_set|
23
- pkg_set.each_package do |pkg|
24
- all_packages[pkg.name] = [pkg, pkg_set.name]
25
- end
26
- end
27
-
28
- metapackages = manifest.metapackages.values
29
-
30
- if package_sets.empty?
31
- Autoproj.message("autoproj: no package sets defined in autoproj/manifest", :bold, :red)
32
- exit(0)
33
- end
34
-
35
- Autoproj.message
36
- Autoproj.message("autoproj: package sets", :bold)
37
- package_sets.sort_by(&:name).each do |pkg_set|
38
- next if pkg_set.empty?
39
- if !pkg_set.imported_from.empty?
40
- imported_from = pkg_set.imported_from.map(&:name).sort
41
- Autoproj.message " #{pkg_set.name} (imported by #{imported_from.join(", ")})"
42
- else
43
- Autoproj.message " #{pkg_set.name} (listed in manifest)"
44
- end
45
- end
46
-
47
- Autoproj.message
48
- Autoproj.message("autoproj: metapackages", :bold)
49
- metapackages.sort_by(&:name).each do |metap|
50
- Autoproj.message " #{metap.name}"
51
- end
52
-
53
- packages_not_present = []
54
-
55
- Autoproj.message
56
- Autoproj.message("autoproj: packages", :bold)
57
- all_packages.to_a.sort_by(&:first).map(&:last).each do |pkg, pkg_set|
58
- if File.exists?(File.join(pkg.srcdir, "manifest.xml"))
59
- manifest.load_package_manifest(pkg.name)
60
- manifest.resolve_optional_dependencies
61
- end
62
-
63
- pkg_manifest = pkg.description
64
- if File.directory?(pkg.srcdir)
65
- Autoproj.message " #{pkg.name}#{": #{pkg_manifest.short_documentation}" if pkg_manifest && pkg_manifest.short_documentation}"
66
- else
67
- Autoproj.message " #{pkg.name}: not yet checked out", :magenta
68
- end
69
- end
@@ -1,85 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
-
6
- root_dir = Autoproj::CmdLine.initialize_root_directory
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?
15
- puts root_dir
16
- exit 0
17
- elsif ARGV.size > 1
18
- Autoproj.error "more than one name given on the command line"
19
- exit 1
20
- end
21
- selection = ARGV.first
22
-
23
- selection_rx = Regexp.new(Regexp.quote(selection))
24
- candidates = []
25
- manifest.each do |pkg|
26
- name = pkg.name
27
- srcdir = pkg.srcdir
28
- if name == selection
29
- puts srcdir
30
- exit(0)
31
- elsif name =~ selection_rx
32
- candidates << srcdir
33
- end
34
- end
35
-
36
- if candidates.empty?
37
- # Try harder. Match directory prefixes
38
- directories = selection.split('/')
39
- rx = directories.
40
- map { |d| "#{Regexp.quote(d)}\\w*" }.
41
- join("/")
42
- rx = Regexp.new(rx)
43
-
44
- rx_strict = directories[0..-2].
45
- map { |d| "#{Regexp.quote(d)}\\w*" }.
46
- join("/")
47
- rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$")
48
-
49
- candidates_strict = []
50
- manifest.each do |pkg|
51
- name = pkg.name
52
- srcdir = pkg.srcdir
53
- if name =~ rx
54
- candidates << srcdir
55
- end
56
- if name =~ rx_strict
57
- candidates_strict << srcdir
58
- end
59
- end
60
-
61
- if candidates.size > 1 && candidates_strict.size == 1
62
- candidates = candidates_strict
63
- end
64
- end
65
-
66
- if candidates.size > 1
67
- # If there is more than one candidate, check if there are some that are not
68
- # present on disk
69
- present = candidates.find_all { |dir| File.directory?(dir) }
70
- if present.size == 1
71
- candidates = present
72
- end
73
- end
74
-
75
- if candidates.empty?
76
- Autoproj.error "cannot find #{selection} in the current autoproj installation"
77
- exit 1
78
- elsif candidates.size > 1
79
- Autoproj.error "multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}"
80
- exit 1
81
- else
82
- puts candidates.first
83
- exit(0)
84
- end
85
-
@@ -1,5 +0,0 @@
1
- #! /bin/sh
2
-
3
- set -e
4
- cd $(autolocate)/autoproj
5
- git reflog autoproj --format="%Cgreen%gd %Cblue%cr %Creset%gs"
@@ -1,82 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- require 'autoproj'
4
- require 'autoproj/cmdline'
5
-
6
- Autoproj.silent = true
7
- display_all = false
8
- display_format = "$NAME"
9
- search_all = false
10
-
11
- parser = OptionParser.new do |opt|
12
- opt.banner = "autoproj query <query_string>
13
- Finds packages that match query_string and displays information about them (one per line)
14
- By default, only the package name is displayed. It can be customized with the --format option
15
-
16
- QUERY KEYS
17
- autobuild.name: the package name
18
- autobuild.srcdir: the package source directory
19
- autobuild.class.name: the package class
20
- vcs.type: the VCS type (as used in the source.yml files)
21
- vcs.url: the URL from the VCS. The exact semantic of it depends on the VCS type
22
- package_set.name: the name of the package set that defines the package
23
-
24
- FORMAT SPECIFICATION
25
-
26
- The format is a string in which special values can be expanded using a $VARNAME format. The following variables are accepted:
27
- NAME: the package name
28
- SRCDIR: the full path to the package source directory
29
- PREFIX: the full path to the package installation directory"
30
-
31
- opt.on('--search-all', "search in all defined packages instead of only in those selected selected in the layout") do
32
- search_all = true
33
- end
34
- opt.on('--format FORMAT', String, "customize what should be displayed. See FORMAT SPECIFICATION above") do |format|
35
- display_format = format
36
- end
37
- end
38
- remaining = parser.parse(ARGV)
39
-
40
- root_dir = Autoproj::CmdLine.initialize_root_directory
41
- Autoproj::CmdLine.report do
42
- selection = Autoproj::CmdLine.initialize_and_load(remaining)
43
-
44
- if selection.empty?
45
- STDERR.puts Autoproj.console.color("no query given on the command line", :red)
46
- exit 1
47
- elsif selection.size > 1
48
- STDERR.puts Autoproj.console.color("more than one query given on the command line", :red)
49
- exit 1
50
- end
51
- selection = selection.first
52
- query = Autoproj::Query.parse_query(selection)
53
-
54
- packages =
55
- if search_all
56
- Autoproj.manifest.packages.to_a
57
- else
58
- Autoproj.manifest.all_selected_packages.map do |pkg_name|
59
- [pkg_name, Autoproj.manifest.packages[pkg_name]]
60
- end
61
- end
62
-
63
- matches = packages.map do |name, pkg_def|
64
- if priority = query.match(pkg_def)
65
- [priority, name]
66
- end
67
- end.compact
68
-
69
- fields = Hash.new
70
- matches = matches.sort
71
- matches.each do |priority, name|
72
- pkg = Autobuild::Package[name]
73
- fields['SRCDIR'] = pkg.srcdir
74
- fields['PREFIX'] = pkg.prefix
75
- fields['NAME'] = name
76
- fields['PRIORITY'] = priority
77
-
78
- value = Autoproj.expand(display_format, fields)
79
- puts value
80
- end
81
- end
82
-
@@ -1,13 +0,0 @@
1
- #! /usr/bin/env ruby
2
- require 'autoproj/cli/reset'
3
-
4
- Autoproj::CmdLine.report(silent: true) do
5
- Autoproj.silent do
6
- Autoproj::CmdLine.initialize_root_directory
7
- Autoproj::CmdLine.initialize_and_load([])
8
- end
9
-
10
- cli = Autoproj::CLI::Reset.new(Autoproj.manifest)
11
- ref_name, options = cli.parse_options(ARGV)
12
- cli.run(ref_name, options)
13
- end