autoproj 2.12.1 → 2.15.1
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 +24 -22
- data/bin/alocate +4 -4
- data/bin/alog +6 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +225 -200
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +224 -199
- data/bin/autoproj_install.in +6 -7
- data/lib/autoproj/aruba_minitest.rb +6 -11
- data/lib/autoproj/autobuild.rb +9 -6
- data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
- data/lib/autoproj/autobuild_extensions/dsl.rb +66 -36
- data/lib/autoproj/autobuild_extensions/git.rb +27 -26
- data/lib/autoproj/autobuild_extensions/package.rb +23 -22
- data/lib/autoproj/autobuild_extensions/python.rb +18 -0
- 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 +26 -26
- data/lib/autoproj/cli/bootstrap.rb +14 -16
- data/lib/autoproj/cli/build.rb +10 -7
- data/lib/autoproj/cli/cache.rb +11 -11
- 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 +13 -7
- 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 +38 -39
- 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 +97 -43
- 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 -86
- 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 +139 -132
- 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 +41 -43
- data/lib/autoproj/ops/cached_env.rb +5 -4
- data/lib/autoproj/ops/configuration.rb +519 -507
- data/lib/autoproj/ops/import.rb +88 -63
- data/lib/autoproj/ops/install.rb +218 -192
- 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 +19 -11
- data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
- 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 +30 -28
- 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 +47 -25
- 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 +28 -74
- data/lib/autoproj/package_selection.rb +187 -187
- data/lib/autoproj/package_set.rb +145 -114
- data/lib/autoproj/python.rb +297 -0
- data/lib/autoproj/query_base.rb +20 -14
- data/lib/autoproj/reporter.rb +19 -19
- data/lib/autoproj/repository_managers/apt.rb +102 -68
- data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
- data/lib/autoproj/ros_condition_parser.rb +84 -0
- data/lib/autoproj/ros_package_manifest.rb +125 -0
- 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 +143 -108
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +55 -53
- data/samples/autoproj/init.rb +1 -2
- metadata +86 -65
- data/.travis.yml +0 -22
@@ -20,14 +20,15 @@ module Autoproj
|
|
20
20
|
def <=>(b)
|
21
21
|
(0..2).inject(0) do |result, i|
|
22
22
|
return result unless result == 0
|
23
|
-
|
23
|
+
|
24
|
+
normalize(compare_fragments(split[i], b.split[i]))
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
def self.compare(a, b)
|
28
|
-
new(a)<=>new(b)
|
29
|
+
new(a) <=> new(b)
|
29
30
|
end
|
30
|
-
|
31
|
+
|
31
32
|
private
|
32
33
|
|
33
34
|
def normalize(value)
|
@@ -38,21 +39,21 @@ module Autoproj
|
|
38
39
|
|
39
40
|
# Reference: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
|
40
41
|
def parse_version
|
41
|
-
@epoch =
|
42
|
-
@debian_revision =
|
42
|
+
@epoch = "0"
|
43
|
+
@debian_revision = "0"
|
43
44
|
|
44
|
-
@upstream_version = @version.split(
|
45
|
+
@upstream_version = @version.split(":")
|
45
46
|
if @upstream_version.size > 1
|
46
47
|
@epoch = @upstream_version.first
|
47
|
-
@upstream_version = @upstream_version[1..-1].join(
|
48
|
+
@upstream_version = @upstream_version[1..-1].join(":")
|
48
49
|
else
|
49
50
|
@upstream_version = @upstream_version.first
|
50
51
|
end
|
51
52
|
|
52
|
-
@upstream_version = @upstream_version.split(
|
53
|
+
@upstream_version = @upstream_version.split("-")
|
53
54
|
if @upstream_version.size > 1
|
54
55
|
@debian_revision = @upstream_version.last
|
55
|
-
@upstream_version = @upstream_version[0..-2].join(
|
56
|
+
@upstream_version = @upstream_version[0..-2].join("-")
|
56
57
|
else
|
57
58
|
@upstream_version = @upstream_version.first
|
58
59
|
end
|
@@ -68,15 +69,15 @@ module Autoproj
|
|
68
69
|
|
69
70
|
def order(c)
|
70
71
|
if digit?(c)
|
71
|
-
|
72
|
+
0
|
72
73
|
elsif alpha?(c)
|
73
|
-
|
74
|
-
elsif c ==
|
75
|
-
|
74
|
+
c.ord
|
75
|
+
elsif c == "~"
|
76
|
+
-1
|
76
77
|
elsif c
|
77
|
-
|
78
|
+
c.ord + 256
|
78
79
|
else
|
79
|
-
|
80
|
+
0
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
@@ -89,13 +90,14 @@ module Autoproj
|
|
89
90
|
while i != a.size && j != b.size && (!digit?(a[i]) || !digit?(b[j]))
|
90
91
|
vc = order(a[i])
|
91
92
|
rc = order(b[j])
|
92
|
-
return vc-rc if vc != rc
|
93
|
+
return vc - rc if vc != rc
|
94
|
+
|
93
95
|
i += 1
|
94
96
|
j += 1
|
95
97
|
end
|
96
98
|
|
97
|
-
i += 1 while a[i] ==
|
98
|
-
j += 1 while b[j] ==
|
99
|
+
i += 1 while a[i] == "0"
|
100
|
+
j += 1 while b[j] == "0"
|
99
101
|
while digit?(a[i]) && digit?(b[j])
|
100
102
|
first_diff = a[i].ord - b[j].ord if first_diff == 0
|
101
103
|
i += 1
|
@@ -110,12 +112,14 @@ module Autoproj
|
|
110
112
|
return 0 if i == a.size && j == b.size
|
111
113
|
|
112
114
|
if i == a.size
|
113
|
-
return 1 if b[j] ==
|
115
|
+
return 1 if b[j] == "~"
|
116
|
+
|
114
117
|
return -1
|
115
118
|
end
|
116
119
|
if j == b.size
|
117
|
-
return -1 if a[i] ==
|
118
|
-
|
120
|
+
return -1 if a[i] == "~"
|
121
|
+
|
122
|
+
1
|
119
123
|
end
|
120
124
|
end
|
121
125
|
end
|
@@ -27,29 +27,29 @@ module Autoproj
|
|
27
27
|
# of GEM_PATH
|
28
28
|
def initialize_environment
|
29
29
|
env = ws.env
|
30
|
-
env.original_env[
|
31
|
-
(env[
|
30
|
+
env.original_env["GEM_PATH"] =
|
31
|
+
(env["GEM_PATH"] || "").split(File::PATH_SEPARATOR).find_all do |p|
|
32
32
|
!Autoproj.in_autoproj_installation?(p)
|
33
33
|
end.join(File::PATH_SEPARATOR)
|
34
|
-
env.inherit
|
35
|
-
env.init_from_env
|
34
|
+
env.inherit "GEM_PATH"
|
35
|
+
env.init_from_env "GEM_PATH"
|
36
36
|
|
37
|
-
orig_gem_path = env.original_env[
|
38
|
-
env.system_env[
|
39
|
-
env.original_env[
|
37
|
+
orig_gem_path = env.original_env["GEM_PATH"].split(File::PATH_SEPARATOR)
|
38
|
+
env.system_env["GEM_PATH"] = Gem.default_path
|
39
|
+
env.original_env["GEM_PATH"] = orig_gem_path.join(File::PATH_SEPARATOR)
|
40
40
|
|
41
41
|
ws.config.each_reused_autoproj_installation do |p|
|
42
|
-
p_gems = File.join(p,
|
42
|
+
p_gems = File.join(p, ".gems")
|
43
43
|
if File.directory?(p_gems)
|
44
|
-
env.push_path
|
45
|
-
env.push_path
|
44
|
+
env.push_path "GEM_PATH", p_gems
|
45
|
+
env.push_path "PATH", File.join(p_gems, "bin")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
@gem_home = (ENV[
|
50
|
-
env.push_path
|
51
|
-
env.set
|
52
|
-
env.push_path
|
49
|
+
@gem_home = (ENV["AUTOPROJ_GEM_HOME"] || File.join(ws.root_dir, ".gems"))
|
50
|
+
env.push_path "GEM_PATH", gem_home
|
51
|
+
env.set "GEM_HOME", gem_home
|
52
|
+
env.push_path "PATH", "#{gem_home}/bin"
|
53
53
|
|
54
54
|
# Now, reset the directories in our own RubyGems instance
|
55
55
|
Gem.paths = env.resolved_env
|
@@ -59,47 +59,47 @@ module Autoproj
|
|
59
59
|
|
60
60
|
# Override the gem home detected by {initialize_environment}, or set
|
61
61
|
# it in cases where calling {initialize_environment} is not possible
|
62
|
-
|
63
|
-
|
62
|
+
class << self
|
63
|
+
attr_writer :gem_home
|
64
64
|
end
|
65
65
|
|
66
66
|
# A global cache directory that should be used to avoid
|
67
67
|
# re-downloading gems
|
68
68
|
def self.cache_dir
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
return unless (dir = ENV["AUTOBUILD_CACHE_DIR"])
|
70
|
+
|
71
|
+
dir = File.join(dir, "gems")
|
72
|
+
FileUtils.mkdir_p dir
|
73
|
+
dir
|
74
74
|
end
|
75
75
|
|
76
76
|
def self.use_cache_dir
|
77
77
|
# If there is a cache directory, make sure .gems/cache points to
|
78
78
|
# it (there are no programmatic ways to override this)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
return unless (cache = cache_dir)
|
80
|
+
|
81
|
+
gem_cache_dir = File.join(gem_home, "cache")
|
82
|
+
if !File.symlink?(gem_cache_dir) || File.readlink(gem_cache_dir) != cache
|
83
|
+
FileUtils.mkdir_p gem_home
|
84
|
+
FileUtils.rm_rf gem_cache_dir
|
85
|
+
Autoproj.create_symlink(cache, gem_cache_dir)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
# Return the directory in which RubyGems package should be installed
|
90
|
-
|
91
|
-
|
90
|
+
class << self
|
91
|
+
attr_reader :gem_home
|
92
92
|
end
|
93
93
|
|
94
94
|
@gem_home = nil
|
95
|
-
|
95
|
+
|
96
96
|
# Returns the set of default options that are added to gem
|
97
97
|
#
|
98
98
|
# By default, we add --no-user-install to un-break distributions
|
99
99
|
# like Arch that set --user-install by default (thus disabling the
|
100
100
|
# role of GEM_HOME)
|
101
101
|
def self.default_install_options
|
102
|
-
@default_install_options ||= [
|
102
|
+
@default_install_options ||= ["--no-user-install", "--no-format-executable"]
|
103
103
|
end
|
104
104
|
|
105
105
|
def initialize(ws)
|
@@ -115,7 +115,7 @@ module Autoproj
|
|
115
115
|
attr_reader :installed_gems
|
116
116
|
|
117
117
|
def gem_fetcher
|
118
|
-
|
118
|
+
unless @gem_fetcher
|
119
119
|
Autoproj.message " looking for RubyGems updates"
|
120
120
|
@gem_fetcher = Gem::SpecFetcher.fetcher
|
121
121
|
end
|
@@ -123,35 +123,29 @@ module Autoproj
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def guess_gem_program
|
126
|
-
if Autobuild.programs[
|
127
|
-
return Autobuild.programs['gem']
|
128
|
-
end
|
126
|
+
return Autobuild.programs["gem"] if Autobuild.programs["gem"]
|
129
127
|
|
130
|
-
ruby_bin = RbConfig::CONFIG[
|
131
|
-
ruby_bindir = RbConfig::CONFIG[
|
128
|
+
ruby_bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"]
|
129
|
+
ruby_bindir = RbConfig::CONFIG["bindir"]
|
132
130
|
|
133
|
-
candidates = [
|
134
|
-
if ruby_bin =~ /^ruby(.+)$/
|
135
|
-
candidates << "gem#{$1}"
|
136
|
-
end
|
131
|
+
candidates = ["gem"]
|
132
|
+
candidates << "gem#{$1}" if ruby_bin =~ /^ruby(.+)$/
|
137
133
|
|
138
134
|
candidates.each do |gem_name|
|
139
135
|
if File.file?(gem_full_path = File.join(ruby_bindir, gem_name))
|
140
|
-
Autobuild.programs[
|
136
|
+
Autobuild.programs["gem"] = gem_full_path
|
141
137
|
return
|
142
138
|
end
|
143
139
|
end
|
144
140
|
|
145
|
-
raise ArgumentError, "cannot find a gem program (tried #{candidates.sort.join(
|
141
|
+
raise ArgumentError, "cannot find a gem program (tried #{candidates.sort.join(', ')} in #{ruby_bindir})"
|
146
142
|
end
|
147
143
|
|
148
144
|
def build_gem_cmdlines(gems)
|
149
145
|
with_version, without_version = gems.partition { |name, v| v }
|
150
146
|
|
151
147
|
cmdlines = []
|
152
|
-
|
153
|
-
cmdlines << without_version.flatten
|
154
|
-
end
|
148
|
+
cmdlines << without_version.flatten unless without_version.empty?
|
155
149
|
with_version.each do |name, v|
|
156
150
|
cmdlines << [name, "-v", v]
|
157
151
|
end
|
@@ -160,17 +154,17 @@ module Autoproj
|
|
160
154
|
|
161
155
|
def pristine(gems)
|
162
156
|
guess_gem_program
|
163
|
-
base_cmdline = [Autobuild.tool_in_path(
|
157
|
+
base_cmdline = [Autobuild.tool_in_path("ruby", env: ws.env), "-S", Autobuild.tool("gem")]
|
164
158
|
cmdlines = [
|
165
|
-
[*base_cmdline,
|
159
|
+
[*base_cmdline, "clean"]
|
166
160
|
]
|
167
161
|
cmdlines += build_gem_cmdlines(gems).map do |line|
|
168
162
|
base_cmdline + ["pristine", "--extensions"] + line
|
169
163
|
end
|
170
164
|
if gems_interaction(gems, cmdlines)
|
171
|
-
Autoproj.message " restoring RubyGems: #{gems.map { |g| g.join(
|
165
|
+
Autoproj.message " restoring RubyGems: #{gems.map { |g| g.join(' ') }.sort.join(', ')}"
|
172
166
|
cmdlines.each do |c|
|
173
|
-
Autobuild::Subprocess.run
|
167
|
+
Autobuild::Subprocess.run "autoproj", "osdeps", *c
|
174
168
|
end
|
175
169
|
end
|
176
170
|
end
|
@@ -178,25 +172,21 @@ module Autoproj
|
|
178
172
|
def install(gems)
|
179
173
|
guess_gem_program
|
180
174
|
|
181
|
-
base_cmdline = [Autobuild.tool_in_path(
|
182
|
-
|
183
|
-
base_cmdline << '--no-rdoc' << '--no-ri'
|
184
|
-
end
|
175
|
+
base_cmdline = [Autobuild.tool_in_path("ruby", env: ws.env), "-S", Autobuild.tool("gem"), "install", *GemManager.default_install_options]
|
176
|
+
base_cmdline << "--no-rdoc" << "--no-ri" unless GemManager.with_doc
|
185
177
|
|
186
|
-
if GemManager.with_prerelease
|
187
|
-
base_cmdline << "--prerelease"
|
188
|
-
end
|
178
|
+
base_cmdline << "--prerelease" if GemManager.with_prerelease
|
189
179
|
|
190
180
|
cmdlines = build_gem_cmdlines(gems).map do |line|
|
191
181
|
base_cmdline + line
|
192
182
|
end
|
193
183
|
if gems_interaction(gems, cmdlines)
|
194
|
-
Autoproj.message " installing/updating RubyGems dependencies: #{gems.map { |g| g.join(
|
184
|
+
Autoproj.message " installing/updating RubyGems dependencies: #{gems.map { |g| g.join(' ') }.sort.join(', ')}"
|
195
185
|
|
196
186
|
cmdlines.each do |c|
|
197
|
-
Autobuild::Subprocess.run
|
198
|
-
|
199
|
-
|
187
|
+
Autobuild::Subprocess.run "autoproj", "osdeps", *c,
|
188
|
+
env: Hash["GEM_HOME" => Gem.paths.home,
|
189
|
+
"GEM_PATH" => Gem.paths.path.join(":")]
|
200
190
|
end
|
201
191
|
gems.each do |name, v|
|
202
192
|
installed_gems << name
|
@@ -209,14 +199,14 @@ module Autoproj
|
|
209
199
|
# installed, or that can be upgraded
|
210
200
|
def filter_uptodate_packages(gems, options = Hash.new)
|
211
201
|
options = validate_options options,
|
212
|
-
|
202
|
+
install_only: !Autobuild.do_update
|
213
203
|
|
214
204
|
# Don't install gems that are already there ...
|
215
205
|
gems = gems.dup
|
216
206
|
gems.delete_if do |name, version|
|
217
207
|
next(true) if installed_gems.include?(name)
|
218
208
|
|
219
|
-
version_requirements = Gem::Requirement.new(version ||
|
209
|
+
version_requirements = Gem::Requirement.new(version || ">= 0")
|
220
210
|
installed =
|
221
211
|
if Gem::Specification.respond_to?(:find_by_name)
|
222
212
|
begin
|
@@ -236,14 +226,16 @@ module Autoproj
|
|
236
226
|
non_prerelease = gem_fetcher.find_matching(dep, true, true).map(&:first)
|
237
227
|
if GemManager.with_prerelease
|
238
228
|
prerelease = gem_fetcher.find_matching(dep, false, true, true).map(&:first)
|
239
|
-
else
|
229
|
+
else
|
230
|
+
prerelease = Array.new
|
240
231
|
end
|
241
|
-
(non_prerelease + prerelease)
|
242
|
-
map { |n, v, _| [n, v] }
|
232
|
+
(non_prerelease + prerelease)
|
233
|
+
.map { |n, v, _| [n, v] }
|
243
234
|
|
244
235
|
else # Post RubyGems-2.0
|
245
236
|
type = if GemManager.with_prerelease then :complete
|
246
|
-
else
|
237
|
+
else
|
238
|
+
:released
|
247
239
|
end
|
248
240
|
|
249
241
|
gem_fetcher.detect(type) do |tuple|
|
@@ -252,7 +244,7 @@ module Autoproj
|
|
252
244
|
end
|
253
245
|
installed_version = installed.map(&:version).max
|
254
246
|
available_version = available.map { |_, v| v }.max
|
255
|
-
|
247
|
+
unless available_version
|
256
248
|
if version
|
257
249
|
raise ConfigError.new, "cannot find any gem with the name '#{name}' and version #{version}"
|
258
250
|
else
|
@@ -288,22 +280,22 @@ module Autoproj
|
|
288
280
|
# We're not supposed to install rubygem packages but silent is not
|
289
281
|
# set, so display information about them anyway
|
290
282
|
puts <<-EOMSG
|
291
|
-
#{Autoproj.color(
|
292
|
-
#{Autoproj.color(
|
283
|
+
#{Autoproj.color('The build process and/or the packages require some Ruby Gems to be installed', :bold)}
|
284
|
+
#{Autoproj.color('and you required autoproj to not do it itself', :bold)}
|
293
285
|
You can use the --all or --ruby options to autoproj osdeps to install these
|
294
286
|
packages anyway, and/or change to the osdeps handling mode by running an
|
295
287
|
autoproj operation with the --reconfigure option as for instance
|
296
288
|
autoproj build --reconfigure
|
297
|
-
|
289
|
+
#{' '}
|
298
290
|
The following command line can be used to install them manually
|
299
|
-
|
300
|
-
#{cmdlines.map { |c| c.join(
|
301
|
-
|
291
|
+
#{' '}
|
292
|
+
#{cmdlines.map { |c| c.join(' ') }.join("\n ")}
|
293
|
+
#{' '}
|
302
294
|
Autoproj expects these Gems to be installed in #{GemManager.gem_home} This can
|
303
295
|
be overridden by setting the AUTOPROJ_GEM_HOME environment variable manually
|
304
296
|
|
305
297
|
EOMSG
|
306
|
-
print " #{Autoproj.color(
|
298
|
+
print " #{Autoproj.color('Press ENTER to continue ', :bold)}"
|
307
299
|
|
308
300
|
STDOUT.flush
|
309
301
|
STDIN.readline
|
@@ -313,4 +305,3 @@ module Autoproj
|
|
313
305
|
end
|
314
306
|
end
|
315
307
|
end
|
316
|
-
|
@@ -5,8 +5,8 @@ module Autoproj
|
|
5
5
|
class HomebrewManager < ShellScriptManager
|
6
6
|
def initialize(ws)
|
7
7
|
super(ws, true,
|
8
|
-
%w
|
9
|
-
%w
|
8
|
+
%w[brew install],
|
9
|
+
%w[brew install],
|
10
10
|
false)
|
11
11
|
end
|
12
12
|
|
@@ -16,7 +16,7 @@ module Autoproj
|
|
16
16
|
packages = packages.uniq
|
17
17
|
command_line = "brew info --json=v1 #{packages.join(' ')}"
|
18
18
|
result = Autoproj.bundler_with_unbundled_env do
|
19
|
-
(Autobuild::Subprocess.run
|
19
|
+
(Autobuild::Subprocess.run "autoproj", "osdeps", command_line).first
|
20
20
|
end
|
21
21
|
|
22
22
|
begin
|
@@ -53,4 +53,3 @@ module Autoproj
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
@@ -11,10 +11,16 @@ module Autoproj
|
|
11
11
|
attr_reader :ws
|
12
12
|
|
13
13
|
attr_writer :enabled
|
14
|
-
|
14
|
+
|
15
|
+
def enabled?
|
16
|
+
!!@enabled
|
17
|
+
end
|
15
18
|
|
16
19
|
attr_writer :silent
|
17
|
-
|
20
|
+
|
21
|
+
def silent?
|
22
|
+
!!@silent
|
23
|
+
end
|
18
24
|
|
19
25
|
# Whether this package manager should be called even if no packages
|
20
26
|
# should be installed
|
@@ -68,4 +74,3 @@ module Autoproj
|
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
71
|
-
|
@@ -5,10 +5,9 @@ module Autoproj
|
|
5
5
|
class PacmanManager < ShellScriptManager
|
6
6
|
def initialize(ws)
|
7
7
|
super(ws, true,
|
8
|
-
%w
|
9
|
-
%w
|
8
|
+
%w[pacman -Sy --needed],
|
9
|
+
%w[pacman -Sy --needed --noconfirm])
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "autoproj/python"
|
2
|
+
|
1
3
|
module Autoproj
|
2
4
|
module PackageManagers
|
3
5
|
# Using pip to install python packages
|
@@ -5,14 +7,14 @@ module Autoproj
|
|
5
7
|
attr_reader :installed_pips
|
6
8
|
|
7
9
|
def initialize_environment
|
8
|
-
ws.env.set
|
9
|
-
ws.env.add_path
|
10
|
+
ws.env.set "PYTHONUSERBASE", pip_home
|
11
|
+
ws.env.add_path "PATH", File.join(pip_home, "bin")
|
10
12
|
end
|
11
13
|
|
12
14
|
# Return the directory where python packages are installed to.
|
13
15
|
# The actual path is pip_home/lib/pythonx.y/site-packages.
|
14
16
|
def pip_home
|
15
|
-
ws.env[
|
17
|
+
ws.env["AUTOPROJ_PYTHONUSERBASE"] || File.join(ws.prefix_dir, "pip")
|
16
18
|
end
|
17
19
|
|
18
20
|
def initialize(ws)
|
@@ -21,34 +23,35 @@ module Autoproj
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def os_dependencies
|
24
|
-
super + [
|
26
|
+
super + ["pip"]
|
25
27
|
end
|
26
28
|
|
27
29
|
def guess_pip_program
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
activate_python
|
31
|
+
Autobuild.programs["pip"] = "pip" unless Autobuild.programs["pip"]
|
32
|
+
Autobuild.programs["pip"]
|
33
|
+
end
|
31
34
|
|
32
|
-
|
35
|
+
def activate_python
|
36
|
+
Autoproj::Python.setup_python_configuration_options(ws: ws)
|
37
|
+
Autoproj::Python.assert_python_activated(ws: ws)
|
33
38
|
end
|
34
39
|
|
35
40
|
def install(pips, filter_uptodate_packages: false, install_only: false)
|
36
41
|
guess_pip_program
|
37
|
-
if pips.is_a?(String)
|
38
|
-
pips = [pips]
|
39
|
-
end
|
42
|
+
pips = [pips] if pips.is_a?(String)
|
40
43
|
|
41
|
-
base_cmdline = [Autobuild.tool(
|
44
|
+
base_cmdline = [Autobuild.tool("pip"), "install", "--user"]
|
42
45
|
|
43
46
|
cmdlines = [base_cmdline + pips]
|
44
47
|
|
45
|
-
if pips_interaction(
|
46
|
-
Autoproj.message " installing/updating Python dependencies:
|
47
|
-
|
48
|
+
if pips_interaction(cmdlines)
|
49
|
+
Autoproj.message " installing/updating Python dependencies:" \
|
50
|
+
" #{pips.sort.join(', ')}"
|
48
51
|
|
49
52
|
cmdlines.each do |c|
|
50
|
-
Autobuild::Subprocess.run
|
51
|
-
|
53
|
+
Autobuild::Subprocess.run "autoproj", "osdeps", *c,
|
54
|
+
env: ws.env.resolved_env
|
52
55
|
end
|
53
56
|
|
54
57
|
pips.each do |p|
|
@@ -56,8 +59,8 @@ module Autoproj
|
|
56
59
|
end
|
57
60
|
end
|
58
61
|
end
|
59
|
-
|
60
|
-
def pips_interaction(
|
62
|
+
|
63
|
+
def pips_interaction(cmdlines)
|
61
64
|
if OSPackageInstaller.force_osdeps
|
62
65
|
return true
|
63
66
|
elsif enabled?
|
@@ -69,24 +72,23 @@ module Autoproj
|
|
69
72
|
# We're not supposed to install rubygem packages but silent is not
|
70
73
|
# set, so display information about them anyway
|
71
74
|
puts <<-EOMSG
|
72
|
-
#{Autoproj.color(
|
73
|
-
#{Autoproj.color(
|
75
|
+
#{Autoproj.color('The build process and/or the packages require some Python packages to be installed', :bold)}
|
76
|
+
#{Autoproj.color('and you required autoproj to not do it itself', :bold)}
|
74
77
|
The following command line can be used to install them manually
|
75
|
-
|
76
|
-
#{cmdlines.map { |c| c.join(
|
77
|
-
|
78
|
+
#{' '}
|
79
|
+
#{cmdlines.map { |c| c.join(' ') }.join("\n ")}
|
80
|
+
#{' '}
|
78
81
|
Autoproj expects these Python packages to be installed in #{pip_home} This can
|
79
82
|
be overridden by setting the AUTOPROJ_PYTHONUSERBASE environment variable manually
|
80
83
|
|
81
84
|
EOMSG
|
82
|
-
print " #{Autoproj.color(
|
85
|
+
print " #{Autoproj.color('Press ENTER to continue ', :bold)}"
|
83
86
|
|
84
|
-
|
85
|
-
|
87
|
+
$stdout.flush
|
88
|
+
$stdin.readline
|
86
89
|
puts
|
87
90
|
false
|
88
91
|
end
|
89
92
|
end
|
90
93
|
end
|
91
94
|
end
|
92
|
-
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module Autoproj
|
2
2
|
module PackageManagers
|
3
|
-
|
3
|
+
# Package manager interface for systems that use pkg (i.e. FreeBSD) as
|
4
4
|
# their package manager
|
5
5
|
class PkgManager < ShellScriptManager
|
6
6
|
def initialize(ws)
|
7
7
|
super(ws, true,
|
8
|
-
%w
|
9
|
-
%w
|
8
|
+
%w[pkg install -y],
|
9
|
+
%w[pkg install -y])
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|