autoproj 2.13.0 → 2.15.2
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 +5 -7
- data/bin/amake +4 -4
- data/bin/aup +4 -4
- data/bin/autoproj +3 -3
- data/bin/autoproj_bootstrap +224 -199
- data/bin/autoproj_bootstrap.in +7 -8
- data/bin/autoproj_install +223 -198
- 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 +64 -34
- 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 +213 -204
- 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 +45 -39
- 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 +35 -37
- data/lib/autoproj/cli/utility.rb +11 -10
- 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 +77 -85
- data/lib/autoproj/default.osdeps +18 -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 +137 -130
- 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 +525 -507
- data/lib/autoproj/ops/import.rb +76 -64
- data/lib/autoproj/ops/install.rb +217 -191
- 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 +144 -113
- 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 +127 -104
- data/lib/autoproj/variable_expansion.rb +7 -9
- data/lib/autoproj/vcs_definition.rb +35 -32
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +142 -108
- data/lib/autoproj/zsh_completion.rb +8 -9
- data/lib/autoproj.rb +55 -55
- data/samples/autoproj/init.rb +1 -2
- metadata +80 -46
- data/.travis.yml +0 -24
@@ -29,18 +29,18 @@ module Autoproj
|
|
29
29
|
#
|
30
30
|
class SourcePackageQuery < QueryBase
|
31
31
|
ALLOWED_FIELDS = [
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
"autobuild.name",
|
33
|
+
"autobuild.srcdir",
|
34
|
+
"autobuild.class.name",
|
35
|
+
"vcs.type",
|
36
|
+
"vcs.url",
|
37
|
+
"package_set.name"
|
38
38
|
]
|
39
39
|
DEFAULT_FIELDS = {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
"name" => "autobuild.name",
|
41
|
+
"class" => "autobuild.class.name",
|
42
|
+
"vcs" => "vcs.url",
|
43
|
+
"package_set" => "package_set.name"
|
44
44
|
}
|
45
45
|
|
46
46
|
# Match priorities
|
@@ -52,18 +52,18 @@ module Autoproj
|
|
52
52
|
def initialize(fields, value, partial)
|
53
53
|
super(fields, value, partial)
|
54
54
|
|
55
|
-
directories = value.split(
|
56
|
-
|
55
|
+
directories = value.split("/")
|
56
|
+
unless directories.empty?
|
57
57
|
@use_dir_prefix = true
|
58
|
-
rx = directories
|
59
|
-
|
60
|
-
|
58
|
+
rx = directories
|
59
|
+
.map { |d| "#{Regexp.quote(d)}\\w*" }
|
60
|
+
.join("/")
|
61
61
|
rx = Regexp.new(rx, true)
|
62
62
|
@dir_prefix_weak_rx = rx
|
63
63
|
|
64
|
-
rx_strict = directories[0..-2]
|
65
|
-
|
66
|
-
|
64
|
+
rx_strict = directories[0..-2]
|
65
|
+
.map { |d| "#{Regexp.quote(d)}\\w*" }
|
66
|
+
.join("/")
|
67
67
|
rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$", true)
|
68
68
|
@dir_prefix_strong_rx = rx_strict
|
69
69
|
end
|
@@ -95,38 +95,32 @@ module Autoproj
|
|
95
95
|
pkg_value = fields.inject(pkg) { |v, field_name| v.send(field_name) }
|
96
96
|
pkg_value = pkg_value.to_s
|
97
97
|
|
98
|
-
if pkg_value == value
|
99
|
-
return EXACT
|
100
|
-
end
|
98
|
+
return EXACT if pkg_value == value
|
101
99
|
|
102
|
-
|
103
|
-
return
|
104
|
-
end
|
100
|
+
return unless partial?
|
105
101
|
|
106
|
-
if @value_rx === pkg_value
|
107
|
-
return PARTIAL
|
108
|
-
end
|
102
|
+
return PARTIAL if @value_rx === pkg_value
|
109
103
|
|
110
104
|
# Special match for directories: match directory prefixes
|
111
105
|
if use_dir_prefix?
|
112
106
|
if @dir_prefix_strong_rx === pkg_value
|
113
|
-
|
107
|
+
DIR_PREFIX_STRONG
|
114
108
|
elsif @dir_prefix_weak_rx === pkg_value
|
115
|
-
|
109
|
+
DIR_PREFIX_WEAK
|
116
110
|
end
|
117
111
|
end
|
118
112
|
end
|
119
113
|
|
120
114
|
# Parse a single field in a query (i.e. a FIELD[=~]VALUE string)
|
121
115
|
def self.parse(str)
|
122
|
-
if str
|
123
|
-
match_name = parse("autobuild.name~#{str}")
|
124
|
-
match_dir = parse("autobuild.srcdir~#{str}")
|
125
|
-
return Or.new([match_name, match_dir])
|
126
|
-
else
|
116
|
+
if str =~ /[=~]/
|
127
117
|
fields, value, partial =
|
128
118
|
super(str, default_fields: DEFAULT_FIELDS, allowed_fields: ALLOWED_FIELDS)
|
129
|
-
|
119
|
+
new(fields, value, partial)
|
120
|
+
else
|
121
|
+
match_name = parse("autobuild.name~#{str}")
|
122
|
+
match_dir = parse("autobuild.srcdir~#{str}")
|
123
|
+
Or.new([match_name, match_dir])
|
130
124
|
end
|
131
125
|
end
|
132
126
|
end
|
@@ -134,4 +128,3 @@ module Autoproj
|
|
134
128
|
# For backward compatibility
|
135
129
|
Query = SourcePackageQuery
|
136
130
|
end
|
137
|
-
|
data/lib/autoproj/system.rb
CHANGED
@@ -11,7 +11,7 @@ module Autoproj
|
|
11
11
|
|
12
12
|
# Returns true if +path+ is part of an autoproj installation
|
13
13
|
def self.in_autoproj_installation?(path)
|
14
|
-
!!find_workspace_dir(path,
|
14
|
+
!!find_workspace_dir(path, "workspace")
|
15
15
|
end
|
16
16
|
|
17
17
|
# Forcefully sets the root directory
|
@@ -22,6 +22,7 @@ module Autoproj
|
|
22
22
|
if @workspace && dir != @workspace.root_dir
|
23
23
|
raise WorkspaceAlreadyCreated, "cannot switch global root directory after a workspace object got created"
|
24
24
|
end
|
25
|
+
|
25
26
|
@root_dir = dir
|
26
27
|
end
|
27
28
|
|
@@ -36,10 +37,10 @@ module Autoproj
|
|
36
37
|
@root_dir = ni
|
37
38
|
return
|
38
39
|
end
|
40
|
+
|
39
41
|
path = Autoproj.find_workspace_dir(dir)
|
40
|
-
|
41
|
-
|
42
|
-
end
|
42
|
+
raise UserError, "not in a Autoproj installation" unless path
|
43
|
+
|
43
44
|
path
|
44
45
|
end
|
45
46
|
|
@@ -49,12 +50,14 @@ module Autoproj
|
|
49
50
|
caller.each { |l| Autoproj.warn " #{l}" }
|
50
51
|
workspace.config_dir
|
51
52
|
end
|
53
|
+
|
52
54
|
# @deprecated use workspace.overrides_dir instead
|
53
55
|
def self.overrides_dir
|
54
56
|
Autoproj.warn "#{__method__} is deprecated, use workspace.overrides_dir instead"
|
55
57
|
caller.each { |l| Autoproj.warn " #{l}" }
|
56
58
|
workspace.overrides_dir
|
57
59
|
end
|
60
|
+
|
58
61
|
# @deprecated use Autobuild.find_in_path instead
|
59
62
|
#
|
60
63
|
# Warning: the autobuild method returns nil (instead of raising) if the
|
@@ -62,62 +65,71 @@ module Autoproj
|
|
62
65
|
def self.find_in_path(name)
|
63
66
|
Autoproj.warn "#{__method__} is deprecated, use Autobuild.find_in_path instead"
|
64
67
|
caller.each { |l| Autoproj.warn " #{l}" }
|
65
|
-
|
66
|
-
|
67
|
-
else raise ArgumentError, "cannot find #{name} in PATH (#{ENV['PATH']})"
|
68
|
+
unless (path = Autobuild.find_in_path(name))
|
69
|
+
raise ArgumentError, "cannot find #{name} in PATH (#{ENV['PATH']})"
|
68
70
|
end
|
71
|
+
|
72
|
+
path
|
69
73
|
end
|
74
|
+
|
70
75
|
# @deprecated use workspace.prefix_dir instead
|
71
76
|
def self.prefix
|
72
|
-
Autoproj.warn_deprecated(__method__,
|
77
|
+
Autoproj.warn_deprecated(__method__, "workspace.prefix_dir")
|
73
78
|
workspace.prefix_dir
|
74
79
|
end
|
80
|
+
|
75
81
|
# @deprecated use workspace.prefix_dir= instead
|
76
82
|
def self.prefix=(path)
|
77
|
-
Autoproj.warn_deprecated(__method__,
|
83
|
+
Autoproj.warn_deprecated(__method__, "workspace.prefix_dir=")
|
78
84
|
workspace.prefix_dir = path
|
79
85
|
end
|
86
|
+
|
80
87
|
# @deprecated use workspace.prefix_dir instead
|
81
88
|
def self.build_dir
|
82
|
-
Autoproj.warn_deprecated(__method__,
|
89
|
+
Autoproj.warn_deprecated(__method__, "workspace.prefix_dir")
|
83
90
|
workspace.prefix_dir
|
84
91
|
end
|
92
|
+
|
85
93
|
# @deprecated compute the full path with File.join(config_dir, file)
|
86
94
|
# directly instead
|
87
95
|
def self.config_file(file)
|
88
|
-
Autoproj.warn_deprecated(__method__,
|
96
|
+
Autoproj.warn_deprecated(__method__, "compute the full path with File.join(config_dir, ...) instead")
|
89
97
|
File.join(config_dir, file)
|
90
98
|
end
|
99
|
+
|
91
100
|
# @deprecated use workspace.remotes_dir instead
|
92
101
|
def self.remotes_dir
|
93
|
-
Autoproj.warn_deprecated(__method__,
|
102
|
+
Autoproj.warn_deprecated(__method__, "use workspace.remotes_dir instead")
|
94
103
|
workspace.remotes_dir
|
95
104
|
end
|
105
|
+
|
96
106
|
# @deprecated use workspace.load or add a separate Loader object to your class
|
97
107
|
def self.load(package_set, *path)
|
98
108
|
Autoproj.warn_deprecated(
|
99
109
|
__method__,
|
100
|
-
|
110
|
+
"use workspace.load or add a separate Loader object to your class"
|
111
|
+
)
|
101
112
|
workspace.load(package_set, *path)
|
102
113
|
end
|
114
|
+
|
103
115
|
# @deprecated use workspace.load_if_present or add a separate Loader object to your class
|
104
116
|
def self.load_if_present(package_set, *path)
|
105
117
|
Autoproj.warn_deprecated(
|
106
118
|
__method__,
|
107
|
-
|
119
|
+
"use workspace.load_if_present or add a separate Loader object to your class"
|
120
|
+
)
|
108
121
|
workspace.load_if_present(package_set, *path)
|
109
122
|
end
|
110
123
|
|
111
124
|
# Run the provided command as user
|
112
125
|
def self.run_as_user(*args)
|
113
|
-
|
114
|
-
raise "failed to run #{args.join(" ")}"
|
115
|
-
end
|
126
|
+
raise "failed to run #{args.join(' ')}" unless system(*args)
|
116
127
|
end
|
128
|
+
|
117
129
|
# Run the provided command as root, using sudo to gain root access
|
118
|
-
def self.run_as_root(*args, env:
|
119
|
-
|
120
|
-
raise "failed to run #{args.join(
|
130
|
+
def self.run_as_root(*args, env: workspace.env)
|
131
|
+
unless system(Autobuild.tool_in_path("sudo", env: env), *args)
|
132
|
+
raise "failed to run #{args.join(' ')} as root"
|
121
133
|
end
|
122
134
|
end
|
123
135
|
|
@@ -135,4 +147,3 @@ module Autoproj
|
|
135
147
|
end
|
136
148
|
end
|
137
149
|
end
|
138
|
-
|