autoproj 2.12.0 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +30 -0
- data/.rubocop.yml +79 -91
- data/.rubocop_todo.yml +1473 -0
- data/Gemfile +9 -9
- data/Rakefile +24 -24
- data/autoproj.gemspec +22 -22
- data/bin/alocate +4 -4
- data/bin/alog +6 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +2 -2
- data/bin/autoproj_bootstrap +186 -183
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +185 -182
- data/bin/autoproj_install.in +6 -7
- data/lib/autoproj/aruba_minitest.rb +6 -11
- data/lib/autoproj/autobuild.rb +5 -6
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
- data/lib/autoproj/autobuild_extensions/dsl.rb +61 -44
- data/lib/autoproj/autobuild_extensions/git.rb +27 -26
- data/lib/autoproj/autobuild_extensions/package.rb +23 -22
- data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
- data/lib/autoproj/base.rb +1 -1
- data/lib/autoproj/bash_completion.rb +5 -6
- data/lib/autoproj/build_option.rb +22 -24
- data/lib/autoproj/cli/base.rb +27 -27
- data/lib/autoproj/cli/bootstrap.rb +14 -16
- data/lib/autoproj/cli/build.rb +18 -10
- data/lib/autoproj/cli/cache.rb +51 -8
- data/lib/autoproj/cli/clean.rb +10 -10
- data/lib/autoproj/cli/commit.rb +7 -8
- data/lib/autoproj/cli/doc.rb +2 -2
- data/lib/autoproj/cli/envsh.rb +1 -2
- data/lib/autoproj/cli/exec.rb +60 -20
- data/lib/autoproj/cli/inspection_tool.rb +18 -13
- data/lib/autoproj/cli/locate.rb +30 -41
- data/lib/autoproj/cli/log.rb +7 -7
- data/lib/autoproj/cli/main.rb +217 -205
- data/lib/autoproj/cli/main_doc.rb +22 -21
- data/lib/autoproj/cli/main_global.rb +44 -19
- data/lib/autoproj/cli/main_plugin.rb +18 -18
- data/lib/autoproj/cli/main_test.rb +28 -27
- data/lib/autoproj/cli/manifest.rb +7 -7
- data/lib/autoproj/cli/osdeps.rb +12 -11
- data/lib/autoproj/cli/patcher.rb +2 -3
- data/lib/autoproj/cli/query.rb +17 -18
- data/lib/autoproj/cli/reconfigure.rb +1 -2
- data/lib/autoproj/cli/reset.rb +9 -12
- data/lib/autoproj/cli/show.rb +48 -55
- data/lib/autoproj/cli/status.rb +56 -44
- data/lib/autoproj/cli/switch_config.rb +5 -6
- data/lib/autoproj/cli/tag.rb +12 -11
- data/lib/autoproj/cli/test.rb +7 -7
- data/lib/autoproj/cli/update.rb +104 -51
- data/lib/autoproj/cli/utility.rb +14 -12
- data/lib/autoproj/cli/version.rb +42 -40
- data/lib/autoproj/cli/versions.rb +14 -15
- data/lib/autoproj/cli/watch.rb +33 -37
- data/lib/autoproj/cli/which.rb +16 -20
- data/lib/autoproj/cli.rb +4 -2
- data/lib/autoproj/configuration.rb +78 -85
- data/lib/autoproj/default.osdeps +29 -3
- data/lib/autoproj/environment.rb +42 -23
- data/lib/autoproj/exceptions.rb +9 -3
- data/lib/autoproj/find_workspace.rb +20 -25
- data/lib/autoproj/git_server_configuration.rb +40 -44
- data/lib/autoproj/gitorious.rb +1 -1
- data/lib/autoproj/installation_manifest.rb +64 -29
- data/lib/autoproj/local_package_set.rb +13 -11
- data/lib/autoproj/manifest.rb +145 -135
- data/lib/autoproj/metapackage.rb +2 -6
- data/lib/autoproj/ops/atomic_write.rb +7 -6
- data/lib/autoproj/ops/build.rb +4 -6
- data/lib/autoproj/ops/cache.rb +64 -53
- data/lib/autoproj/ops/cached_env.rb +7 -6
- data/lib/autoproj/ops/configuration.rb +511 -506
- data/lib/autoproj/ops/import.rb +90 -61
- data/lib/autoproj/ops/install.rb +179 -175
- data/lib/autoproj/ops/loader.rb +77 -76
- data/lib/autoproj/ops/main_config_switcher.rb +36 -45
- data/lib/autoproj/ops/phase_reporting.rb +4 -4
- data/lib/autoproj/ops/snapshot.rb +250 -247
- data/lib/autoproj/ops/tools.rb +76 -78
- data/lib/autoproj/ops/watch.rb +6 -6
- data/lib/autoproj/ops/which.rb +17 -14
- data/lib/autoproj/options.rb +13 -2
- data/lib/autoproj/os_package_installer.rb +102 -92
- data/lib/autoproj/os_package_query.rb +7 -13
- data/lib/autoproj/os_package_resolver.rb +189 -140
- data/lib/autoproj/os_repository_installer.rb +4 -4
- data/lib/autoproj/os_repository_resolver.rb +8 -6
- data/lib/autoproj/package_definition.rb +12 -13
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +46 -31
- data/lib/autoproj/package_managers/bundler_manager.rb +156 -118
- data/lib/autoproj/package_managers/debian_version.rb +25 -21
- data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
- data/lib/autoproj/package_managers/gem_manager.rb +68 -77
- data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
- data/lib/autoproj/package_managers/manager.rb +8 -3
- data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
- data/lib/autoproj/package_managers/pip_manager.rb +37 -27
- data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
- data/lib/autoproj/package_managers/port_manager.rb +2 -3
- data/lib/autoproj/package_managers/shell_script_manager.rb +66 -36
- data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
- data/lib/autoproj/package_managers/yum_manager.rb +12 -15
- data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
- data/lib/autoproj/package_manifest.rb +66 -53
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +128 -114
- data/lib/autoproj/python.rb +285 -0
- data/lib/autoproj/query_base.rb +20 -14
- data/lib/autoproj/reporter.rb +19 -19
- data/lib/autoproj/repository_managers/apt.rb +101 -67
- data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
- data/lib/autoproj/shell_completion.rb +16 -13
- data/lib/autoproj/source_package_query.rb +29 -36
- data/lib/autoproj/system.rb +32 -21
- data/lib/autoproj/test.rb +131 -106
- data/lib/autoproj/variable_expansion.rb +10 -10
- data/lib/autoproj/vcs_definition.rb +53 -37
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +162 -117
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +53 -53
- data/samples/autoproj/init.rb +1 -2
- metadata +62 -72
- data/.travis.yml +0 -22
data/lib/autoproj/environment.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Autoproj
|
2
2
|
ENV_FILENAME =
|
3
3
|
if Autobuild.windows? then "env.bat"
|
4
|
-
else
|
4
|
+
else
|
5
|
+
"env.sh"
|
5
6
|
end
|
6
7
|
|
7
8
|
class Environment < Autobuild::Environment
|
@@ -9,7 +10,7 @@ module Autoproj
|
|
9
10
|
|
10
11
|
def prepare(root_dir)
|
11
12
|
@root_dir = root_dir
|
12
|
-
set
|
13
|
+
set "AUTOPROJ_CURRENT_ROOT", root_dir
|
13
14
|
super()
|
14
15
|
end
|
15
16
|
|
@@ -17,36 +18,43 @@ module Autoproj
|
|
17
18
|
Autoproj.filter_out_paths_in_workspace(env)
|
18
19
|
end
|
19
20
|
|
21
|
+
def env_filename(shell, *subdir)
|
22
|
+
env_filename = if shell == "sh"
|
23
|
+
ENV_FILENAME
|
24
|
+
else
|
25
|
+
(Pathname(ENV_FILENAME).sub_ext "").to_s.concat(".#{shell}")
|
26
|
+
end
|
27
|
+
|
28
|
+
File.join(root_dir, *subdir, env_filename)
|
29
|
+
end
|
30
|
+
|
31
|
+
def each_env_filename(*subdir)
|
32
|
+
(["sh"] + Autoproj.workspace.config.user_shells).to_set.each do |shell|
|
33
|
+
yield shell, env_filename(shell, *subdir)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
20
37
|
def export_env_sh(subdir = nil, options = Hash.new)
|
21
38
|
if subdir.kind_of?(Hash)
|
22
|
-
|
39
|
+
options = subdir
|
40
|
+
subdir = nil
|
23
41
|
end
|
24
42
|
options = validate_options options,
|
25
|
-
|
43
|
+
shell_helpers: true
|
26
44
|
|
27
45
|
shell_dir = File.expand_path(File.join("..", "..", "shell"), File.dirname(__FILE__))
|
28
|
-
completion_dir = File.join(shell_dir,
|
46
|
+
completion_dir = File.join(shell_dir, "completion")
|
29
47
|
env_updated = false
|
30
48
|
|
31
|
-
([
|
32
|
-
env_filename = if shell == 'sh'
|
33
|
-
ENV_FILENAME
|
34
|
-
else
|
35
|
-
(Pathname(ENV_FILENAME).sub_ext '').to_s.concat(".#{shell}")
|
36
|
-
end
|
37
|
-
|
38
|
-
filename = if subdir
|
39
|
-
File.join(root_dir, subdir, env_filename)
|
40
|
-
else
|
41
|
-
File.join(root_dir, env_filename)
|
42
|
-
end
|
43
|
-
|
49
|
+
each_env_filename(*[subdir].compact) do |shell, filename|
|
44
50
|
helper = File.join(shell_dir, "autoproj_#{shell}")
|
45
51
|
if options[:shell_helpers]
|
46
52
|
source_after(helper, shell: shell) if File.file?(helper)
|
47
53
|
%w[alocate alog amake aup autoproj].each do |tool|
|
48
54
|
completion_file = File.join(completion_dir, "#{tool}_#{shell}")
|
49
|
-
|
55
|
+
if File.file?(completion_file)
|
56
|
+
source_after(completion_file, shell: shell)
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
@@ -55,7 +63,7 @@ module Autoproj
|
|
55
63
|
rescue SystemCallError
|
56
64
|
end
|
57
65
|
|
58
|
-
StringIO.open(new_content = String.new,
|
66
|
+
StringIO.open(new_content = String.new, "w") do |io|
|
59
67
|
if inherit?
|
60
68
|
io.write <<-EOF
|
61
69
|
if test -n "$AUTOPROJ_CURRENT_ROOT" && test "$AUTOPROJ_CURRENT_ROOT" != "#{root_dir}"; then
|
@@ -80,46 +88,57 @@ module Autoproj
|
|
80
88
|
def self.env_set(name, *value)
|
81
89
|
env.set(name, *value)
|
82
90
|
end
|
91
|
+
|
83
92
|
# @deprecated call Autoproj.env.add instead
|
84
93
|
def self.env_add(name, *value)
|
85
94
|
env.add(name, *value)
|
86
95
|
end
|
96
|
+
|
87
97
|
# @deprecated call Autoproj.env.set_path instead
|
88
98
|
def self.env_set_path(name, *value)
|
89
99
|
env.set_path(name, *value)
|
90
100
|
end
|
101
|
+
|
91
102
|
# @deprecated call Autoproj.env.add_path instead
|
92
103
|
def self.env_add_path(name, *value)
|
93
104
|
env.add_path(name, *value)
|
94
105
|
end
|
106
|
+
|
95
107
|
# @deprecated call Autoproj.env.source_after instead
|
96
|
-
def self.env_source_file(file, shell:
|
108
|
+
def self.env_source_file(file, shell: "sh")
|
97
109
|
env.source_after(file, shell: shell)
|
98
110
|
end
|
111
|
+
|
99
112
|
# @deprecated call Autoproj.env.source_after instead
|
100
|
-
def self.env_source_after(file, shell:
|
113
|
+
def self.env_source_after(file, shell: "sh")
|
101
114
|
env.source_after(file, shell: shell)
|
102
115
|
end
|
116
|
+
|
103
117
|
# @deprecated call Autoproj.env.source_before instead
|
104
|
-
def self.env_source_before(file, shell:
|
118
|
+
def self.env_source_before(file, shell: "sh")
|
105
119
|
env.source_before(file, shell: shell)
|
106
120
|
end
|
121
|
+
|
107
122
|
# @deprecated call Autoproj.env.inherit instead
|
108
123
|
def self.env_inherit(*names)
|
109
124
|
env.inherit(*names)
|
110
125
|
end
|
126
|
+
|
111
127
|
# @deprecated use Autoproj.env.isolate instead
|
112
128
|
def self.set_initial_env
|
113
129
|
isolate_environment
|
114
130
|
end
|
131
|
+
|
115
132
|
# @deprecated use Autoproj.env.isolate instead
|
116
133
|
def self.isolate_environment
|
117
134
|
env.isolate
|
118
135
|
end
|
136
|
+
|
119
137
|
# @deprecated call Autoproj.env.prepare directly
|
120
138
|
def self.prepare_environment(env = Autoproj.env, manifest = Autoproj.manifest)
|
121
139
|
env.prepare(manifest)
|
122
140
|
end
|
141
|
+
|
123
142
|
# @deprecated use Autoproj.env.export_env_sh instead
|
124
143
|
def self.export_env_sh(subdir = nil)
|
125
144
|
env.export_env_sh(subdir)
|
data/lib/autoproj/exceptions.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "autobuild/exceptions"
|
2
2
|
|
3
3
|
module Autoproj
|
4
4
|
class ConfigError < RuntimeError
|
5
5
|
attr_accessor :file
|
6
|
+
|
6
7
|
def initialize(file = nil)
|
7
8
|
super
|
8
9
|
@file = file
|
9
10
|
end
|
10
11
|
end
|
12
|
+
|
11
13
|
class InternalError < RuntimeError; end
|
12
14
|
|
13
15
|
class ImportFailed < Autobuild::CompositeException
|
@@ -48,8 +50,11 @@ module Autoproj
|
|
48
50
|
# Exception raised when a caller requires to use an excluded package
|
49
51
|
class ExcludedPackage < ConfigError
|
50
52
|
attr_reader :name
|
53
|
+
|
51
54
|
def initialize(name)
|
52
55
|
@name = name
|
56
|
+
|
57
|
+
super()
|
53
58
|
end
|
54
59
|
end
|
55
60
|
|
@@ -65,8 +70,11 @@ module Autoproj
|
|
65
70
|
# selection is completely excluded
|
66
71
|
class ExcludedSelection < ConfigError
|
67
72
|
attr_reader :selection
|
73
|
+
|
68
74
|
def initialize(selection)
|
69
75
|
@selection = selection
|
76
|
+
|
77
|
+
super()
|
70
78
|
end
|
71
79
|
end
|
72
80
|
|
@@ -90,5 +98,3 @@ module Autoproj
|
|
90
98
|
# Raised by 'which' when an executable cannot be found
|
91
99
|
class ExecutableNotFound < ArgumentError; end
|
92
100
|
end
|
93
|
-
|
94
|
-
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "pathname"
|
2
|
+
require "yaml"
|
3
3
|
|
4
4
|
module Autoproj
|
5
5
|
# The base path from which we search for workspaces
|
6
6
|
def self.default_find_base_dir
|
7
|
-
ENV[
|
7
|
+
ENV["AUTOPROJ_CURRENT_ROOT"] || Dir.pwd
|
8
8
|
end
|
9
9
|
|
10
10
|
# Looks for the autoproj workspace that is related to a given directory
|
@@ -29,19 +29,16 @@ module Autoproj
|
|
29
29
|
# if base_dir is not part of a workspace
|
30
30
|
def self.find_v2_workspace_config(base_dir)
|
31
31
|
path = Pathname.new(base_dir).expand_path
|
32
|
-
|
33
|
-
if (
|
34
|
-
|
35
|
-
end
|
32
|
+
until path.root?
|
33
|
+
break if path.join(".autoproj", "config.yml").exist?
|
34
|
+
|
36
35
|
path = path.parent
|
37
36
|
end
|
38
37
|
|
39
|
-
if path.root?
|
40
|
-
return
|
41
|
-
end
|
38
|
+
return if path.root?
|
42
39
|
|
43
|
-
config_path = path
|
44
|
-
|
40
|
+
config_path = path.join(".autoproj", "config.yml")
|
41
|
+
[path.to_s, (YAML.load(config_path.read) || Hash.new)]
|
45
42
|
end
|
46
43
|
|
47
44
|
# @private
|
@@ -58,17 +55,18 @@ module Autoproj
|
|
58
55
|
# there's none
|
59
56
|
def self.find_v2_root_dir(base_dir, config_field_name)
|
60
57
|
path, config = find_v2_workspace_config(base_dir)
|
61
|
-
return
|
58
|
+
return unless path
|
59
|
+
|
62
60
|
result = config[config_field_name] || path.to_s
|
63
61
|
result = File.expand_path(result, path.to_s)
|
64
|
-
if result == path.to_s
|
65
|
-
|
66
|
-
end
|
62
|
+
return result if result == path.to_s
|
63
|
+
|
67
64
|
resolved = find_v2_root_dir(result, config_field_name)
|
68
65
|
|
69
66
|
if !resolved || (resolved != result)
|
70
67
|
raise ArgumentError, "found #{path} as possible workspace root for #{base_dir}, but it contains a configuration file that points to #{result} and #{result} is not an autoproj workspace root"
|
71
68
|
end
|
69
|
+
|
72
70
|
resolved
|
73
71
|
end
|
74
72
|
|
@@ -84,7 +82,7 @@ module Autoproj
|
|
84
82
|
ws_path, ws_config = find_v2_workspace_config(p)
|
85
83
|
if ws_path
|
86
84
|
known_workspace_dirs << "#{ws_path}/"
|
87
|
-
if ws_dir = ws_config[
|
85
|
+
if (ws_dir = ws_config["workspace"])
|
88
86
|
known_workspace_dirs << "#{ws_dir}/"
|
89
87
|
end
|
90
88
|
false
|
@@ -97,12 +95,12 @@ module Autoproj
|
|
97
95
|
|
98
96
|
# {#find_workspace_dir} for v2 workspaces
|
99
97
|
def self.find_v2_workspace_dir(base_dir = default_find_base_dir)
|
100
|
-
find_v2_root_dir(base_dir,
|
98
|
+
find_v2_root_dir(base_dir, "workspace")
|
101
99
|
end
|
102
100
|
|
103
101
|
# {#find_prefix_dir} for v2 workspaces
|
104
102
|
def self.find_v2_prefix_dir(base_dir = default_find_base_dir)
|
105
|
-
find_v2_root_dir(base_dir,
|
103
|
+
find_v2_root_dir(base_dir, "prefix")
|
106
104
|
end
|
107
105
|
|
108
106
|
# {#find_workspace_dir} for v1 workspaces
|
@@ -110,15 +108,12 @@ module Autoproj
|
|
110
108
|
# Note that for v1 workspaces {#find_prefix_dir} cannot be implemented
|
111
109
|
def self.find_v1_workspace_dir(base_dir = default_find_base_dir)
|
112
110
|
path = Pathname.new(base_dir)
|
113
|
-
|
114
|
-
if (
|
115
|
-
|
116
|
-
return path.to_s
|
117
|
-
end
|
111
|
+
until path.root?
|
112
|
+
if path.join("autoproj").exist?
|
113
|
+
return path.to_s unless path.join(".autoproj").exist?
|
118
114
|
end
|
119
115
|
path = path.parent
|
120
116
|
end
|
121
117
|
nil
|
122
118
|
end
|
123
119
|
end
|
124
|
-
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module Autoproj
|
2
|
-
GIT_SERVER_CONFIG_VARS = %w
|
2
|
+
GIT_SERVER_CONFIG_VARS = %w[_ROOT _PUSH_ROOT _PRIVATE_ROOT]
|
3
3
|
|
4
4
|
GIT_SERVER_ACCESS_METHODS = Hash[
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
"git" => "git,ssh",
|
6
|
+
"ssh" => "ssh,ssh",
|
7
|
+
"http" => "http,http"]
|
9
8
|
|
10
9
|
# @api private
|
11
10
|
#
|
12
11
|
# Helper for {.git_server_configuration}
|
13
|
-
def self.git_server_validate_config_value(base_url, value, disabled_methods:
|
12
|
+
def self.git_server_validate_config_value(base_url, value, disabled_methods:)
|
14
13
|
values = (GIT_SERVER_ACCESS_METHODS[value] || value).split(",")
|
15
14
|
values.each do |access_method|
|
16
15
|
if !GIT_SERVER_ACCESS_METHODS.has_key?(access_method)
|
@@ -25,7 +24,7 @@ module Autoproj
|
|
25
24
|
# @api private
|
26
25
|
#
|
27
26
|
# Helper for {.git_server_configuration}
|
28
|
-
def self.git_server_resolve_master_config(name, config, base_url
|
27
|
+
def self.git_server_resolve_master_config(name, config, base_url:, git_url:, http_url:, ssh_url:, disabled_methods:)
|
29
28
|
access_mode = config.get(name)
|
30
29
|
begin
|
31
30
|
git_server_validate_config_value(base_url, access_mode, disabled_methods: disabled_methods)
|
@@ -35,7 +34,7 @@ module Autoproj
|
|
35
34
|
access_mode = config.get(name)
|
36
35
|
end
|
37
36
|
access_mode = GIT_SERVER_ACCESS_METHODS[access_mode] || access_mode
|
38
|
-
pull, push, private_pull = access_mode.split(
|
37
|
+
pull, push, private_pull = access_mode.split(",")
|
39
38
|
private_pull ||= push
|
40
39
|
[[pull, "_ROOT"], [push, "_PUSH_ROOT"], [private_pull, "_PRIVATE_ROOT"]].each do |method, var_suffix|
|
41
40
|
url = if method == "git" then git_url
|
@@ -44,7 +43,7 @@ module Autoproj
|
|
44
43
|
end
|
45
44
|
config.set("#{name}#{var_suffix}", url)
|
46
45
|
end
|
47
|
-
|
46
|
+
[pull, push, private_pull]
|
48
47
|
end
|
49
48
|
|
50
49
|
# Adds the relevant options to handle a gitorious server
|
@@ -67,53 +66,50 @@ module Autoproj
|
|
67
66
|
# which would be expanded to the expected URLs for pull and push.
|
68
67
|
#
|
69
68
|
def self.git_server_configuration(name, base_url,
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
git_url: "git://#{base_url}",
|
70
|
+
http_url: "https://git.#{base_url}",
|
71
|
+
ssh_url: "git@#{base_url}:",
|
72
|
+
default: "http,ssh",
|
73
|
+
disabled_methods: [],
|
74
|
+
config: Autoproj.config,
|
75
|
+
fallback_to_http: nil,
|
76
|
+
lazy: false)
|
78
77
|
|
79
78
|
disabled_methods = Array(disabled_methods)
|
80
79
|
|
81
80
|
long_doc = [
|
82
|
-
"How should I interact with #{base_url} (#{(GIT_SERVER_ACCESS_METHODS.keys - disabled_methods).sort.join(
|
81
|
+
"How should I interact with #{base_url} (#{(GIT_SERVER_ACCESS_METHODS.keys - disabled_methods).sort.join(', ')})",
|
83
82
|
"If you give one value, it's going to be the method used for all access",
|
84
83
|
"If you give multiple values, comma-separated, the first one will be",
|
85
84
|
"used for pulling and the second one for pushing. An optional third value",
|
86
85
|
"will be used to pull from private repositories (the same than pushing is",
|
87
|
-
"used by default)"
|
86
|
+
"used by default)"
|
87
|
+
]
|
88
88
|
|
89
|
-
config.declare name,
|
89
|
+
config.declare name, "string", default: default, doc: long_doc do |value|
|
90
90
|
git_server_validate_config_value(base_url, value, disabled_methods: disabled_methods)
|
91
91
|
end
|
92
92
|
|
93
|
-
|
93
|
+
unless lazy
|
94
94
|
pull, push, private_pull = git_server_resolve_master_config(name, config,
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
base_url: base_url,
|
96
|
+
git_url: git_url,
|
97
|
+
http_url: http_url,
|
98
|
+
ssh_url: ssh_url,
|
99
|
+
disabled_methods: disabled_methods)
|
100
100
|
end
|
101
101
|
|
102
102
|
Autoproj.add_source_handler name.downcase do |url, private: false, **vcs_options|
|
103
|
-
if url !~ /\.git$/
|
104
|
-
|
105
|
-
end
|
106
|
-
if url !~ /^\//
|
107
|
-
url = "/#{url}"
|
108
|
-
end
|
103
|
+
url += ".git" if url !~ /\.git$/
|
104
|
+
url = "/#{url}" if url !~ /^\//
|
109
105
|
|
110
|
-
|
106
|
+
unless GIT_SERVER_CONFIG_VARS.all? { |v| config.has_value_for?("#{name}#{v}") }
|
111
107
|
pull, push, private_pull = git_server_resolve_master_config(name, config,
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
108
|
+
base_url: base_url,
|
109
|
+
git_url: git_url,
|
110
|
+
http_url: http_url,
|
111
|
+
ssh_url: ssh_url,
|
112
|
+
disabled_methods: disabled_methods)
|
117
113
|
end
|
118
114
|
pull_base_url =
|
119
115
|
if private
|
@@ -122,10 +118,10 @@ module Autoproj
|
|
122
118
|
config.get("#{name}_ROOT")
|
123
119
|
end
|
124
120
|
push_base_url = config.get("#{name}_PUSH_ROOT")
|
125
|
-
Hash[type:
|
121
|
+
Hash[type: "git",
|
126
122
|
url: "#{pull_base_url}#{url}",
|
127
123
|
push_to: "#{push_base_url}#{url}",
|
128
|
-
interactive: (private && private_pull ==
|
124
|
+
interactive: (private && private_pull == "http"),
|
129
125
|
retry_count: 10,
|
130
126
|
repository_id: "#{name.downcase}:#{url}"].merge(vcs_options)
|
131
127
|
end
|
@@ -133,14 +129,14 @@ module Autoproj
|
|
133
129
|
|
134
130
|
def self.gitorious_server_configuration(name, base_url, **options)
|
135
131
|
Autoproj.warn_deprecated "gitorious_server_configuration",
|
136
|
-
|
132
|
+
"use require 'git_server_configuration' and
|
137
133
|
Autoproj.git_server_configuration instead. note that the method call
|
138
134
|
interface has not changed, you just have to change the name(s)"
|
139
135
|
git_server_configuration(name, base_url, **options)
|
140
136
|
end
|
141
137
|
end
|
142
138
|
|
143
|
-
|
144
|
-
Autoproj.git_server_configuration(
|
145
|
-
Autoproj.git_server_configuration(
|
139
|
+
unless $autoproj_disable_github_gitorious_definitions
|
140
|
+
Autoproj.git_server_configuration("GITORIOUS", "gitorious.org", default: "http,ssh", disabled_methods: "git", lazy: true)
|
141
|
+
Autoproj.git_server_configuration("GITHUB", "github.com", http_url: "https://github.com", default: "http,ssh")
|
146
142
|
end
|
data/lib/autoproj/gitorious.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "autoproj/git_server_configuration"
|
@@ -8,33 +8,76 @@ module Autoproj
|
|
8
8
|
attr_reader :path
|
9
9
|
attr_reader :packages
|
10
10
|
attr_reader :package_sets
|
11
|
-
|
11
|
+
|
12
|
+
def initialize(path = nil)
|
12
13
|
@path = path
|
13
14
|
@packages = Hash.new
|
14
15
|
@package_sets = Hash.new
|
15
16
|
end
|
16
17
|
|
17
18
|
def exist?
|
18
|
-
File.exist?(path)
|
19
|
+
File.exist?(path) if path
|
19
20
|
end
|
20
21
|
|
22
|
+
# Add a {PackageDefinition} to this manifest
|
23
|
+
#
|
24
|
+
# @return [Package] the package in the installation manifest format
|
21
25
|
def add_package(pkg)
|
22
|
-
packages[pkg.name] =
|
26
|
+
packages[pkg.name] =
|
27
|
+
case pkg
|
28
|
+
when PackageDefinition
|
29
|
+
v = pkg.autobuild
|
30
|
+
Package.new(
|
31
|
+
v.name, v.class.name, pkg.vcs.to_hash, v.srcdir,
|
32
|
+
(v.importdir if v.respond_to?(:importdir)),
|
33
|
+
v.prefix,
|
34
|
+
(v.builddir if v.respond_to?(:builddir)),
|
35
|
+
v.logdir, v.dependencies
|
36
|
+
)
|
37
|
+
else
|
38
|
+
pkg
|
39
|
+
end
|
23
40
|
end
|
24
41
|
|
42
|
+
# Add a {Autoproj::PackageSet} to this manifest
|
43
|
+
#
|
44
|
+
# @return [PackageSet] the package set in the installation manifest format
|
25
45
|
def add_package_set(pkg_set)
|
26
|
-
package_sets[pkg_set.name] =
|
46
|
+
package_sets[pkg_set.name] = PackageSet.new(
|
47
|
+
pkg_set.name, pkg_set.vcs.to_hash,
|
48
|
+
pkg_set.raw_local_dir, pkg_set.user_local_dir
|
49
|
+
)
|
27
50
|
end
|
28
51
|
|
52
|
+
# Enumerate this {InstallationManifest}'s package sets
|
53
|
+
#
|
54
|
+
# @yieldparam [PackageSet]
|
29
55
|
def each_package_set(&block)
|
30
56
|
package_sets.each_value(&block)
|
31
57
|
end
|
32
58
|
|
59
|
+
# Enumerate this {InstallationManifest}'s packages
|
60
|
+
#
|
61
|
+
# @yieldparam [Package]
|
33
62
|
def each_package(&block)
|
34
63
|
packages.each_value(&block)
|
35
64
|
end
|
36
65
|
|
37
|
-
|
66
|
+
# Resolve a package set by name
|
67
|
+
#
|
68
|
+
# @return [Package]
|
69
|
+
def find_package_set_by_name(name)
|
70
|
+
@package_sets[name]
|
71
|
+
end
|
72
|
+
|
73
|
+
# Resolve a package by name
|
74
|
+
#
|
75
|
+
# @return [Package]
|
76
|
+
def find_package_by_name(name)
|
77
|
+
@packages[name]
|
78
|
+
end
|
79
|
+
|
80
|
+
def load(path = @path)
|
38
81
|
@packages = Hash.new
|
39
82
|
raw = YAML.load(File.open(path))
|
40
83
|
if raw.respond_to?(:to_str) # old CSV-based format
|
@@ -46,14 +89,16 @@ module Autoproj
|
|
46
89
|
save(path)
|
47
90
|
else
|
48
91
|
raw.each do |entry|
|
49
|
-
if entry[
|
92
|
+
if entry["package_set"]
|
50
93
|
pkg_set = PackageSet.new(
|
51
|
-
entry[
|
94
|
+
entry["package_set"], entry["vcs"], entry["raw_local_dir"], entry["user_local_dir"]
|
95
|
+
)
|
52
96
|
package_sets[pkg_set.name] = pkg_set
|
53
97
|
else
|
54
98
|
pkg = Package.new(
|
55
|
-
entry[
|
56
|
-
entry[
|
99
|
+
entry["name"], entry["type"], entry["vcs"], entry["srcdir"], entry["importdir"],
|
100
|
+
entry["prefix"], entry["builddir"], entry["logdir"], entry["dependencies"]
|
101
|
+
)
|
57
102
|
packages[pkg.name] = pkg
|
58
103
|
end
|
59
104
|
end
|
@@ -61,25 +106,15 @@ module Autoproj
|
|
61
106
|
end
|
62
107
|
|
63
108
|
# Save the installation manifest
|
64
|
-
def save(path =
|
109
|
+
def save(path = @path)
|
65
110
|
Ops.atomic_write(path) do |io|
|
66
|
-
marshalled_package_sets = each_package_set.map do |
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
'user_local_dir' => v.user_local_dir]
|
111
|
+
marshalled_package_sets = each_package_set.map do |pkg_set|
|
112
|
+
set = pkg_set.to_h.transform_keys(&:to_s)
|
113
|
+
set["package_set"] = set["name"]
|
114
|
+
set
|
71
115
|
end
|
72
|
-
marshalled_packages = each_package.map do |
|
73
|
-
|
74
|
-
Hash['name' => v.name,
|
75
|
-
'type' => v.class.name,
|
76
|
-
'vcs' => package_def.vcs.to_hash,
|
77
|
-
'srcdir' => v.srcdir,
|
78
|
-
'importdir' => (v.importdir if v.respond_to?(:importdir)),
|
79
|
-
'builddir' => (v.builddir if v.respond_to?(:builddir)),
|
80
|
-
'logdir' => v.logdir,
|
81
|
-
'prefix' => v.prefix,
|
82
|
-
'dependencies' => v.dependencies]
|
116
|
+
marshalled_packages = each_package.map do |pkg|
|
117
|
+
pkg.to_h.transform_keys(&:to_s)
|
83
118
|
end
|
84
119
|
io.write YAML.dump(marshalled_package_sets + marshalled_packages)
|
85
120
|
end
|
@@ -91,18 +126,18 @@ module Autoproj
|
|
91
126
|
# @param [String] root_dir
|
92
127
|
# @return [String]
|
93
128
|
def self.path_for_workspace_root(root_dir)
|
94
|
-
File.join(root_dir,
|
129
|
+
File.join(root_dir, ".autoproj", "installation-manifest")
|
95
130
|
end
|
96
131
|
|
97
132
|
def self.from_workspace_root(root_dir)
|
98
133
|
path = path_for_workspace_root(root_dir)
|
99
134
|
manifest = InstallationManifest.new(path)
|
100
|
-
|
135
|
+
unless manifest.exist?
|
101
136
|
raise ConfigError.new, "no #{path} file found. You should probably rerun autoproj envsh in that folder first"
|
102
137
|
end
|
138
|
+
|
103
139
|
manifest.load
|
104
140
|
manifest
|
105
141
|
end
|
106
142
|
end
|
107
143
|
end
|
108
|
-
|