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
@@ -2,9 +2,9 @@ module Autoproj
|
|
2
2
|
module Ops
|
3
3
|
# Shamelessly stolen from ActiveSupport
|
4
4
|
def self.atomic_write(file_name, temp_dir = Dir.tmpdir)
|
5
|
-
require
|
6
|
-
require
|
7
|
-
|
5
|
+
require "tempfile" unless defined?(Tempfile)
|
6
|
+
require "fileutils" unless defined?(FileUtils)
|
7
|
+
|
8
8
|
temp_file = Tempfile.new(File.basename(file_name), temp_dir)
|
9
9
|
yield temp_file
|
10
10
|
temp_file.flush
|
@@ -12,15 +12,16 @@ module Autoproj
|
|
12
12
|
rescue NotImplementedError
|
13
13
|
end
|
14
14
|
temp_file.close
|
15
|
-
|
15
|
+
|
16
16
|
begin
|
17
17
|
# Get original file permissions
|
18
18
|
old_stat = File.stat(file_name)
|
19
19
|
rescue Errno::ENOENT
|
20
20
|
# No old permissions, write a temp file to determine the defaults
|
21
21
|
check_name = File.join(
|
22
|
-
File.dirname(file_name), ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}"
|
23
|
-
|
22
|
+
File.dirname(file_name), ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}"
|
23
|
+
)
|
24
|
+
File.open(check_name, "w") {}
|
24
25
|
old_stat = File.stat(check_name)
|
25
26
|
File.unlink(check_name)
|
26
27
|
end
|
data/lib/autoproj/ops/build.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "erb"
|
2
2
|
module Autoproj
|
3
3
|
module Ops
|
4
4
|
# Operations related to building packages
|
@@ -77,7 +77,6 @@ module Autoproj
|
|
77
77
|
build_packages(all_enabled_packages)
|
78
78
|
end
|
79
79
|
|
80
|
-
|
81
80
|
# Builds the listed packages
|
82
81
|
#
|
83
82
|
# Only build steps that are actually needed will be performed. See
|
@@ -89,7 +88,7 @@ module Autoproj
|
|
89
88
|
def build_packages(all_enabled_packages, options = Hash.new)
|
90
89
|
if @report_path
|
91
90
|
reporting = Ops::PhaseReporting.new(
|
92
|
-
|
91
|
+
"build", @report_path, method(:package_metadata)
|
93
92
|
)
|
94
93
|
end
|
95
94
|
|
@@ -99,11 +98,10 @@ module Autoproj
|
|
99
98
|
begin
|
100
99
|
Autobuild.apply(
|
101
100
|
all_enabled_packages,
|
102
|
-
"autoproj-build", [
|
101
|
+
"autoproj-build", ["build"], options
|
103
102
|
) do |pkg, phase|
|
104
|
-
reporting&.report_incremental(pkg) if phase ==
|
103
|
+
reporting&.report_incremental(pkg) if phase == "build"
|
105
104
|
end
|
106
|
-
|
107
105
|
ensure
|
108
106
|
packages = all_enabled_packages.map do |name|
|
109
107
|
@manifest.find_autobuild_package(name)
|
data/lib/autoproj/ops/cache.rb
CHANGED
@@ -12,20 +12,18 @@ module Autoproj
|
|
12
12
|
|
13
13
|
def with_retry(count)
|
14
14
|
(count + 1).times do |i|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
Autobuild.message " failed, retrying (#{i}/#{count})"
|
22
|
-
end
|
15
|
+
break yield
|
16
|
+
rescue Autobuild::SubcommandFailed
|
17
|
+
if i == count
|
18
|
+
raise
|
19
|
+
else
|
20
|
+
Autobuild.message " failed, retrying (#{i}/#{count})"
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
27
25
|
def git_cache_dir
|
28
|
-
File.join(cache_dir,
|
26
|
+
File.join(cache_dir, "git")
|
29
27
|
end
|
30
28
|
|
31
29
|
def cache_git(pkg, checkout_only: false)
|
@@ -34,37 +32,37 @@ module Autoproj
|
|
34
32
|
|
35
33
|
pkg.importer.local_branch = nil
|
36
34
|
pkg.importer.remote_branch = nil
|
37
|
-
pkg.importer.remote_name =
|
35
|
+
pkg.importer.remote_name = "autobuild"
|
38
36
|
|
39
37
|
unless File.directory?(pkg.importdir)
|
40
38
|
FileUtils.mkdir_p File.dirname(pkg.importdir)
|
41
39
|
Autobuild::Subprocess.run(
|
42
40
|
"autoproj-cache", "import", Autobuild.tool(:git),
|
43
|
-
"--git-dir", pkg.importdir,
|
41
|
+
"--git-dir", pkg.importdir, "init", "--bare"
|
44
42
|
)
|
45
43
|
end
|
46
|
-
pkg.importer.update_remotes_configuration(pkg)
|
44
|
+
pkg.importer.update_remotes_configuration(pkg, only_local: false)
|
47
45
|
|
48
46
|
with_retry(10) do
|
49
47
|
Autobuild::Subprocess.run(
|
50
|
-
|
51
|
-
|
48
|
+
"autoproj-cache", :import, Autobuild.tool("git"),
|
49
|
+
"--git-dir", pkg.importdir, "remote", "update", "autobuild"
|
52
50
|
)
|
53
51
|
end
|
54
52
|
with_retry(10) do
|
55
53
|
Autobuild::Subprocess.run(
|
56
|
-
|
57
|
-
|
54
|
+
"autoproj-cache", :import, Autobuild.tool("git"),
|
55
|
+
"--git-dir", pkg.importdir, "fetch", "autobuild", "--tags"
|
58
56
|
)
|
59
57
|
end
|
60
58
|
Autobuild::Subprocess.run(
|
61
|
-
|
62
|
-
|
59
|
+
"autoproj-cache", :import, Autobuild.tool("git"),
|
60
|
+
"--git-dir", pkg.importdir, "gc", "--prune=all"
|
63
61
|
)
|
64
62
|
end
|
65
63
|
|
66
64
|
def archive_cache_dir
|
67
|
-
File.join(cache_dir,
|
65
|
+
File.join(cache_dir, "archives")
|
68
66
|
end
|
69
67
|
|
70
68
|
def cache_archive(pkg)
|
@@ -75,25 +73,25 @@ module Autoproj
|
|
75
73
|
end
|
76
74
|
|
77
75
|
def create_or_update(*package_names, all: true, keep_going: false,
|
78
|
-
|
76
|
+
checkout_only: false)
|
79
77
|
FileUtils.mkdir_p cache_dir
|
80
78
|
|
81
|
-
|
82
|
-
|
79
|
+
packages =
|
80
|
+
if package_names.empty?
|
83
81
|
if all
|
84
82
|
manifest.each_autobuild_package
|
85
83
|
else
|
86
84
|
manifest.all_selected_source_packages.map(&:autobuild)
|
87
85
|
end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
86
|
+
else
|
87
|
+
package_names.map do |name|
|
88
|
+
if (pkg = manifest.find_autobuild_package(name))
|
89
|
+
pkg
|
90
|
+
else
|
91
|
+
raise PackageNotFound, "no package named #{name}"
|
92
|
+
end
|
94
93
|
end
|
95
94
|
end
|
96
|
-
end
|
97
95
|
|
98
96
|
packages = packages.sort_by(&:name)
|
99
97
|
|
@@ -128,10 +126,10 @@ module Autoproj
|
|
128
126
|
raise unless keep_going
|
129
127
|
|
130
128
|
pkg.error " failed to cache #{pkg.name}, "\
|
131
|
-
|
129
|
+
"but going on as requested"
|
132
130
|
lines = e.to_s.split('\n')
|
133
131
|
lines = e.message.split('\n') if lines.empty?
|
134
|
-
lines = [
|
132
|
+
lines = ["unknown error"] if lines.empty?
|
135
133
|
pkg.message(lines.shift, :red, :bold)
|
136
134
|
lines.each do |line|
|
137
135
|
pkg.message(line)
|
@@ -142,15 +140,15 @@ module Autoproj
|
|
142
140
|
end
|
143
141
|
|
144
142
|
def gems_cache_dir
|
145
|
-
File.join(cache_dir,
|
143
|
+
File.join(cache_dir, "package_managers", "gem")
|
146
144
|
end
|
147
145
|
|
148
146
|
def create_or_update_gems(keep_going: true, compile_force: false, compile: [])
|
149
147
|
# Note: this might directly copy into the cache directoy, and
|
150
148
|
# we support it later
|
151
|
-
cache_dir = File.join(@ws.prefix_dir,
|
149
|
+
cache_dir = File.join(@ws.prefix_dir, "gems", "vendor", "cache")
|
152
150
|
PackageManagers::BundlerManager.run_bundler(
|
153
|
-
@ws,
|
151
|
+
@ws, "cache"
|
154
152
|
)
|
155
153
|
|
156
154
|
FileUtils.mkdir_p(gems_cache_dir) unless File.exist?(gems_cache_dir)
|
@@ -209,23 +207,23 @@ module Autoproj
|
|
209
207
|
end
|
210
208
|
|
211
209
|
def guess_gem_program
|
212
|
-
return Autobuild.programs[
|
210
|
+
return Autobuild.programs["gem"] if Autobuild.programs["gem"]
|
213
211
|
|
214
|
-
ruby_bin = RbConfig::CONFIG[
|
215
|
-
ruby_bindir = RbConfig::CONFIG[
|
212
|
+
ruby_bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"]
|
213
|
+
ruby_bindir = RbConfig::CONFIG["bindir"]
|
216
214
|
|
217
|
-
candidates = [
|
215
|
+
candidates = ["gem"]
|
218
216
|
candidates << "gem#{$1}" if ruby_bin =~ /^ruby(.+)$/
|
219
217
|
|
220
218
|
candidates.each do |gem_name|
|
221
219
|
if File.file?(gem_full_path = File.join(ruby_bindir, gem_name))
|
222
|
-
Autobuild.programs[
|
223
|
-
return Autobuild.programs[
|
220
|
+
Autobuild.programs["gem"] = gem_full_path
|
221
|
+
return Autobuild.programs["gem"]
|
224
222
|
end
|
225
223
|
end
|
226
224
|
|
227
225
|
raise ArgumentError,
|
228
|
-
|
226
|
+
"cannot find a gem program (tried "\
|
229
227
|
"#{candidates.sort.join(', ')} in #{ruby_bindir})"
|
230
228
|
end
|
231
229
|
|
@@ -237,8 +235,8 @@ module Autoproj
|
|
237
235
|
["--exclude", n]
|
238
236
|
end
|
239
237
|
end
|
240
|
-
unless system(Autobuild.tool(
|
241
|
-
|
238
|
+
unless system(Autobuild.tool("ruby"), "-S", guess_gem_program,
|
239
|
+
"compile", "--output", output, *artifacts, gem_path)
|
242
240
|
raise CompilationFailed, "#{gem_path} failed to compile"
|
243
241
|
end
|
244
242
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require "autobuild/environment"
|
2
2
|
|
3
3
|
module Autoproj
|
4
4
|
module Ops
|
5
5
|
def self.cached_env_path(root_dir)
|
6
|
-
File.join(root_dir,
|
6
|
+
File.join(root_dir, ".autoproj", "env.yml")
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.load_cached_env(root_dir)
|
@@ -11,7 +11,8 @@ module Autoproj
|
|
11
11
|
if File.file?(path)
|
12
12
|
env = YAML.safe_load(File.read(path))
|
13
13
|
Autobuild::Environment::ExportedEnvironment.new(
|
14
|
-
env[
|
14
|
+
env["set"], env["unset"], env["update"]
|
15
|
+
)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -24,7 +25,7 @@ module Autoproj
|
|
24
25
|
rescue Exception
|
25
26
|
end
|
26
27
|
|
27
|
-
env = Hash[
|
28
|
+
env = Hash["set" => env.set, "unset" => env.unset, "update" => env.update]
|
28
29
|
if env != existing
|
29
30
|
Ops.atomic_write(path) do |io|
|
30
31
|
io.write YAML.dump(env)
|