autoproj 2.0.0.rc3 → 2.0.0.rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +9 -29
- data/bin/autoproj_bootstrap +159 -3150
- data/bin/autoproj_bootstrap.in +4 -256
- data/bin/autoproj_install +225 -0
- data/bin/autoproj_install.in +14 -0
- data/lib/autoproj.rb +2 -1
- data/lib/autoproj/autobuild.rb +2 -2
- data/lib/autoproj/cli/bootstrap.rb +0 -39
- data/lib/autoproj/cli/build.rb +0 -3
- data/lib/autoproj/cli/main.rb +13 -1
- data/lib/autoproj/cli/osdeps.rb +1 -1
- data/lib/autoproj/cli/show.rb +1 -1
- data/lib/autoproj/cli/update.rb +4 -4
- data/lib/autoproj/cli/upgrade.rb +71 -0
- data/lib/autoproj/configuration.rb +18 -1
- data/lib/autoproj/exceptions.rb +7 -0
- data/lib/autoproj/installation_manifest.rb +23 -12
- data/lib/autoproj/manifest.rb +22 -48
- data/lib/autoproj/ops/build.rb +2 -2
- data/lib/autoproj/ops/configuration.rb +1 -1
- data/lib/autoproj/ops/import.rb +1 -1
- data/lib/autoproj/ops/install.rb +211 -0
- data/lib/autoproj/ops/main_config_switcher.rb +1 -5
- data/lib/autoproj/os_package_installer.rb +348 -0
- data/lib/autoproj/{osdeps.rb → os_package_resolver.rb} +56 -392
- data/lib/autoproj/package_managers/apt_dpkg_manager.rb +2 -2
- data/lib/autoproj/package_managers/bundler_manager.rb +179 -0
- data/lib/autoproj/package_managers/emerge_manager.rb +2 -2
- data/lib/autoproj/package_managers/gem_manager.rb +7 -6
- data/lib/autoproj/package_managers/homebrew_manager.rb +2 -2
- data/lib/autoproj/package_managers/manager.rb +5 -6
- data/lib/autoproj/package_managers/pacman_manager.rb +2 -2
- data/lib/autoproj/package_managers/pip_manager.rb +8 -8
- data/lib/autoproj/package_managers/pkg_manager.rb +2 -2
- data/lib/autoproj/package_managers/port_manager.rb +2 -2
- data/lib/autoproj/package_managers/shell_script_manager.rb +4 -4
- data/lib/autoproj/package_managers/unknown_os_manager.rb +2 -2
- data/lib/autoproj/package_managers/yum_manager.rb +2 -2
- data/lib/autoproj/package_managers/zypper_manager.rb +2 -2
- data/lib/autoproj/package_set.rb +10 -10
- data/lib/autoproj/reporter.rb +3 -2
- data/lib/autoproj/system.rb +1 -4
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +155 -32
- metadata +9 -3
data/lib/autoproj/reporter.rb
CHANGED
@@ -55,7 +55,8 @@ def success
|
|
55
55
|
def self.report(options = Hash.new)
|
56
56
|
options = Kernel.validate_options options,
|
57
57
|
root_dir: nil,
|
58
|
-
silent: false
|
58
|
+
silent: false,
|
59
|
+
debug: Autobuild.debug
|
59
60
|
|
60
61
|
Autobuild::Reporting.report do
|
61
62
|
yield
|
@@ -82,7 +83,7 @@ def self.report(options = Hash.new)
|
|
82
83
|
STDERR.puts Autobuild.color(" in #{path}", :red, :bold)
|
83
84
|
end
|
84
85
|
end
|
85
|
-
if
|
86
|
+
if options[:debug] then raise
|
86
87
|
else exit 1
|
87
88
|
end
|
88
89
|
end
|
data/lib/autoproj/system.rb
CHANGED
@@ -11,10 +11,7 @@ def self.create_symlink(from, to)
|
|
11
11
|
|
12
12
|
# Returns true if +path+ is part of an autoproj installation
|
13
13
|
def self.in_autoproj_installation?(path)
|
14
|
-
|
15
|
-
true
|
16
|
-
rescue UserError
|
17
|
-
false
|
14
|
+
!!Workspace.find_workspace_dir(path, 'workspace')
|
18
15
|
end
|
19
16
|
|
20
17
|
# Forcefully sets the root directory
|
data/lib/autoproj/version.rb
CHANGED
data/lib/autoproj/workspace.rb
CHANGED
@@ -9,17 +9,27 @@ class Workspace < Ops::Loader
|
|
9
9
|
attr_reader :manifest
|
10
10
|
attr_reader :loader
|
11
11
|
|
12
|
+
def os_package_resolver; manifest.os_package_resolver end
|
13
|
+
attr_reader :os_package_installer
|
14
|
+
|
12
15
|
def initialize(root_dir)
|
13
16
|
@root_dir = root_dir
|
14
17
|
@loader = loader
|
15
18
|
@env = Environment.new
|
19
|
+
env.source_before(File.join(dot_autoproj_dir, 'env.sh'))
|
16
20
|
@manifest = Manifest.new
|
21
|
+
@os_package_installer = OSPackageInstaller.new(self, os_package_resolver)
|
22
|
+
|
17
23
|
Autobuild.env = nil
|
18
24
|
env.prepare(root_dir)
|
19
25
|
|
20
26
|
super(root_dir)
|
21
27
|
end
|
22
28
|
|
29
|
+
# Returns the root of the current autoproj workspace
|
30
|
+
#
|
31
|
+
# @return [String,nil] the root path, or nil if one did not yet source
|
32
|
+
# the workspace's env.sh
|
23
33
|
def self.autoproj_current_root
|
24
34
|
if env = ENV['AUTOPROJ_CURRENT_ROOT']
|
25
35
|
if !env.empty?
|
@@ -28,35 +38,63 @@ def self.autoproj_current_root
|
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
41
|
+
# Returns the workspace the current directory is part of
|
42
|
+
#
|
43
|
+
# @return [Workspace]
|
44
|
+
# @raise (see from_dir)
|
31
45
|
def self.from_pwd
|
32
46
|
from_dir(Dir.pwd)
|
33
47
|
end
|
34
48
|
|
49
|
+
# Returns the workspace a directory is part of
|
50
|
+
#
|
51
|
+
# @return [Workspace]
|
52
|
+
# @raise [MismatchingWorkspace] if the currently loaded env.sh
|
53
|
+
# and the one from +dir+ mismatch
|
54
|
+
# @raise [NotWorkspace] if dir is not within an autoproj workspace
|
35
55
|
def self.from_dir(dir)
|
36
|
-
if path =
|
56
|
+
if path = find_workspace_dir(dir)
|
37
57
|
# Make sure that the currently loaded env.sh is actually us
|
38
58
|
env = autoproj_current_root
|
39
59
|
if env && env != path
|
40
|
-
raise
|
60
|
+
raise MismatchingWorkspace, "the current environment is for #{env}, but you are in #{path}, make sure you are loading the right #{ENV_FILENAME} script !"
|
41
61
|
end
|
42
62
|
Workspace.new(path)
|
43
63
|
else
|
44
|
-
raise
|
64
|
+
raise NotWorkspace, "not in a Autoproj installation"
|
45
65
|
end
|
46
66
|
end
|
47
67
|
|
48
68
|
def self.from_environment
|
49
|
-
if path = (
|
69
|
+
if path = (find_workspace_dir || autoproj_current_root)
|
50
70
|
from_dir(path)
|
51
71
|
else
|
52
|
-
raise
|
72
|
+
raise NotWorkspace, "not in an Autoproj installation, and no env.sh has been loaded so far"
|
53
73
|
end
|
54
74
|
end
|
55
75
|
|
56
|
-
|
76
|
+
# Tests whether the given path is under a directory tree managed by
|
77
|
+
# autoproj
|
78
|
+
def self.in_autoproj_project?(path)
|
79
|
+
!!find_workspace_dir(path)
|
80
|
+
end
|
81
|
+
|
82
|
+
# @private
|
83
|
+
#
|
84
|
+
# Finds an autoproj "root directory" that contains a given directory. It
|
85
|
+
# can either be the root of a workspace or the root of an install
|
86
|
+
# directory
|
87
|
+
#
|
88
|
+
# @param [String] base_dir the start of the search
|
89
|
+
# @param [String] config_field_name the name of a field in the root's
|
90
|
+
# configuration file, that should be returned instead of the root
|
91
|
+
# itself
|
92
|
+
# @return [String,nil] the root of the workspace directory, or nil if
|
93
|
+
# there's none
|
94
|
+
def self.find_root_dir(base_dir, config_field_name)
|
57
95
|
path = Pathname.new(base_dir)
|
58
96
|
while !path.root?
|
59
|
-
if (path + "autoproj"
|
97
|
+
if (path + ".autoproj").exist?
|
60
98
|
break
|
61
99
|
end
|
62
100
|
path = path.parent
|
@@ -66,7 +104,14 @@ def self.find_root_dir(base_dir = Dir.pwd)
|
|
66
104
|
return
|
67
105
|
end
|
68
106
|
|
69
|
-
|
107
|
+
config_path = path + ".autoproj" + "config.yml"
|
108
|
+
if config_path.exist?
|
109
|
+
config = YAML.load(config_path.read) || Hash.new
|
110
|
+
result = config[config_field_name] || path.to_s
|
111
|
+
result = File.expand_path(result, path.to_s)
|
112
|
+
else
|
113
|
+
result = path.to_s
|
114
|
+
end
|
70
115
|
|
71
116
|
# I don't know if this is still useful or not ... but it does not hurt
|
72
117
|
#
|
@@ -77,8 +122,18 @@ def self.find_root_dir(base_dir = Dir.pwd)
|
|
77
122
|
result
|
78
123
|
end
|
79
124
|
|
80
|
-
|
81
|
-
|
125
|
+
# Finds the workspace root that contains a directory
|
126
|
+
#
|
127
|
+
# @return [String,nil]
|
128
|
+
def self.find_workspace_dir(base_dir = Dir.pwd)
|
129
|
+
find_root_dir(base_dir, 'workspace')
|
130
|
+
end
|
131
|
+
|
132
|
+
# Looks for the autoproj prefix that contains a given directory
|
133
|
+
#
|
134
|
+
# @return [String,nil]
|
135
|
+
def self.find_prefix_dir(base_dir = Dir.pwd)
|
136
|
+
find_root_dir(base_dir, 'prefix')
|
82
137
|
end
|
83
138
|
|
84
139
|
def load(*args)
|
@@ -96,10 +151,39 @@ def config_dir
|
|
96
151
|
File.join(root_dir, 'autoproj')
|
97
152
|
end
|
98
153
|
|
154
|
+
# The directory under which autoproj saves all its internal
|
155
|
+
# configuration and files
|
156
|
+
def dot_autoproj_dir
|
157
|
+
File.join(root_dir, '.autoproj')
|
158
|
+
end
|
159
|
+
|
160
|
+
# The installation manifest
|
161
|
+
def installation_manifest_path
|
162
|
+
InstallationManifest.path_for_root(root_dir)
|
163
|
+
end
|
164
|
+
|
165
|
+
# The path to the workspace configuration file
|
166
|
+
def config_file_path
|
167
|
+
File.join(dot_autoproj_dir, 'config.yml')
|
168
|
+
end
|
169
|
+
|
170
|
+
# The path to a workspace's manifest file given its root dir
|
171
|
+
#
|
172
|
+
# @param [String] root_dir the workspace root directory
|
173
|
+
# @return [String]
|
174
|
+
def self.manifest_file_path_for(root_dir)
|
175
|
+
File.join(root_dir, 'autoproj', 'manifest')
|
176
|
+
end
|
177
|
+
|
178
|
+
# The path to the workspace's manifest file
|
179
|
+
def manifest_file_path
|
180
|
+
self.class.manifest_file_path_for(root_dir)
|
181
|
+
end
|
182
|
+
|
99
183
|
# Return the directory in which remote package set definition should be
|
100
184
|
# checked out
|
101
185
|
def remotes_dir
|
102
|
-
File.join(
|
186
|
+
File.join(dot_autoproj_dir, "remotes")
|
103
187
|
end
|
104
188
|
|
105
189
|
# (see Configuration#prefix_dir)
|
@@ -109,7 +193,7 @@ def prefix_dir
|
|
109
193
|
|
110
194
|
# Change {prefix_dir}
|
111
195
|
def prefix_dir=(path)
|
112
|
-
config.
|
196
|
+
config.prefix_dir = path
|
113
197
|
end
|
114
198
|
|
115
199
|
# (see Configuration#build_dir)
|
@@ -136,9 +220,8 @@ def overrides_dir
|
|
136
220
|
end
|
137
221
|
|
138
222
|
def load_config(reconfigure = false)
|
139
|
-
|
140
|
-
|
141
|
-
if File.file?(config_path)
|
223
|
+
@config = Configuration.new(config_file_path)
|
224
|
+
if File.file?(config_file_path)
|
142
225
|
config.load(reconfigure: reconfigure)
|
143
226
|
if raw_vcs = config.get('manifest_source', nil)
|
144
227
|
manifest.vcs = VCSDefinition.from_raw(raw_vcs)
|
@@ -147,12 +230,12 @@ def load_config(reconfigure = false)
|
|
147
230
|
type: 'local', url: config_dir)
|
148
231
|
end
|
149
232
|
end
|
233
|
+
@config
|
150
234
|
end
|
151
235
|
|
152
236
|
def load_manifest
|
153
|
-
|
154
|
-
|
155
|
-
manifest.load(manifest_path)
|
237
|
+
if File.exists?(manifest_file_path)
|
238
|
+
manifest.load(manifest_file_path)
|
156
239
|
end
|
157
240
|
end
|
158
241
|
|
@@ -168,19 +251,24 @@ def setup
|
|
168
251
|
load_manifest
|
169
252
|
|
170
253
|
Autobuild.prefix = prefix_dir
|
254
|
+
FileUtils.mkdir_p File.join(prefix_dir, '.autoproj')
|
255
|
+
File.open(File.join(prefix_dir, '.autoproj', 'config.yml'), 'w') do |io|
|
256
|
+
io.puts "workspace: \"#{root_dir}\""
|
257
|
+
end
|
258
|
+
|
171
259
|
Autobuild.srcdir = root_dir
|
172
260
|
Autobuild.logdir = log_dir
|
173
261
|
if cache_dir = config.importer_cache_dir
|
174
262
|
Autobuild::Importer.default_cache_dirs = cache_dir
|
175
263
|
end
|
176
264
|
env.prepare(root_dir)
|
177
|
-
|
178
|
-
pkg_mng.initialize_environment
|
265
|
+
os_package_installer.each_manager do |pkg_mng|
|
266
|
+
pkg_mng.initialize_environment
|
179
267
|
end
|
180
268
|
|
181
|
-
|
182
|
-
|
183
|
-
|
269
|
+
os_package_resolver.load_default
|
270
|
+
os_package_installer.define_osdeps_mode_option
|
271
|
+
os_package_installer.osdeps_mode
|
184
272
|
|
185
273
|
install_ruby_shims
|
186
274
|
end
|
@@ -231,7 +319,7 @@ def update_autoproj(options = Hash.new)
|
|
231
319
|
begin
|
232
320
|
saved_flag = PackageManagers::GemManager.with_prerelease
|
233
321
|
PackageManagers::GemManager.with_prerelease = config.use_prerelease?
|
234
|
-
|
322
|
+
install_os_packages(%w{autobuild autoproj})
|
235
323
|
ensure
|
236
324
|
PackageManagers::GemManager.with_prerelease = saved_flag
|
237
325
|
end
|
@@ -293,11 +381,10 @@ def load_autoprojrc
|
|
293
381
|
#
|
294
382
|
# This is included in {load_package_sets}
|
295
383
|
#
|
296
|
-
# @param [OSDependencies] osdeps the osdep handling object
|
297
384
|
# @return [void]
|
298
385
|
def load_osdeps_from_package_sets
|
299
386
|
manifest.each_osdeps_file do |pkg_set, file|
|
300
|
-
|
387
|
+
os_package_resolver.merge(pkg_set.load_osdeps(file))
|
301
388
|
end
|
302
389
|
end
|
303
390
|
|
@@ -388,7 +475,7 @@ def load_package_sets(options = Hash.new)
|
|
388
475
|
end
|
389
476
|
|
390
477
|
def mark_unavailable_osdeps_as_excluded
|
391
|
-
|
478
|
+
os_package_resolver.all_package_names.each do |osdep_name|
|
392
479
|
# If the osdep can be replaced by source packages, there's
|
393
480
|
# nothing to do really. The exclusions of the source packages
|
394
481
|
# will work as expected
|
@@ -396,12 +483,12 @@ def mark_unavailable_osdeps_as_excluded
|
|
396
483
|
next
|
397
484
|
end
|
398
485
|
|
399
|
-
case availability =
|
400
|
-
when
|
486
|
+
case availability = os_package_resolver.availability_of(osdep_name)
|
487
|
+
when OSPackageResolver::UNKNOWN_OS
|
401
488
|
manifest.add_exclusion(osdep_name, "this operating system is unknown to autoproj")
|
402
|
-
when
|
489
|
+
when OSPackageResolver::WRONG_OS
|
403
490
|
manifest.add_exclusion(osdep_name, "there are definitions for it, but not for this operating system")
|
404
|
-
when
|
491
|
+
when OSPackageResolver::NONEXISTENT
|
405
492
|
manifest.add_exclusion(osdep_name, "it is marked as unavailable for this operating system")
|
406
493
|
end
|
407
494
|
end
|
@@ -528,8 +615,12 @@ def all_present_packages
|
|
528
615
|
map(&:name)
|
529
616
|
end
|
530
617
|
|
618
|
+
# Update this workspace's installation manifest
|
619
|
+
#
|
620
|
+
# @param [Array<String>] package_names the name of the packages that
|
621
|
+
# should be updated
|
531
622
|
def export_installation_manifest(package_names = all_present_packages)
|
532
|
-
install_manifest = InstallationManifest.new(
|
623
|
+
install_manifest = InstallationManifest.new(installation_manifest_path)
|
533
624
|
if install_manifest.exist?
|
534
625
|
install_manifest.load
|
535
626
|
end
|
@@ -547,6 +638,7 @@ def export_installation_manifest(package_names = all_present_packages)
|
|
547
638
|
install_manifest.save
|
548
639
|
end
|
549
640
|
|
641
|
+
# Export the workspace's env.sh file
|
550
642
|
def export_env_sh(package_names = all_present_packages, shell_helpers: true)
|
551
643
|
env = self.env.dup
|
552
644
|
manifest.all_selected_packages.each do |pkg_name|
|
@@ -555,6 +647,37 @@ def export_env_sh(package_names = all_present_packages, shell_helpers: true)
|
|
555
647
|
end
|
556
648
|
env.export_env_sh(shell_helpers: shell_helpers)
|
557
649
|
end
|
650
|
+
|
651
|
+
def pristine_os_packages(packages, options = Hash.new)
|
652
|
+
os_package_installer.pristine(packages, options)
|
653
|
+
end
|
654
|
+
|
655
|
+
# Restores the OS dependencies required by the given packages to
|
656
|
+
# pristine conditions
|
657
|
+
#
|
658
|
+
# This is usually called as a rebuild step to make sure that all these
|
659
|
+
# packages are updated to whatever required the rebuild
|
660
|
+
def pristine_os_packages_for(packages)
|
661
|
+
required_os_packages, package_os_deps =
|
662
|
+
manifest.list_os_packages(packages)
|
663
|
+
required_os_packages =
|
664
|
+
manifest.filter_os_packages(required_os_packages, package_os_deps)
|
665
|
+
pristine_os_packages(required_os_packages)
|
666
|
+
end
|
667
|
+
|
668
|
+
def install_os_packages(packages, options = Hash.new)
|
669
|
+
os_package_installer.install(packages, options)
|
670
|
+
end
|
671
|
+
|
672
|
+
# Installs the OS dependencies that are required by the given packages
|
673
|
+
def install_os_packages_for(packages, options = Hash.new)
|
674
|
+
required_os_packages, package_os_deps =
|
675
|
+
manifest.list_os_packages(packages)
|
676
|
+
required_os_packages =
|
677
|
+
manifest.filter_os_packages(required_os_packages, package_os_deps)
|
678
|
+
install_os_packages(required_os_packages, options)
|
679
|
+
end
|
680
|
+
|
558
681
|
end
|
559
682
|
|
560
683
|
def self.workspace
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autobuild
|
@@ -160,6 +160,8 @@ files:
|
|
160
160
|
- bin/autoproj
|
161
161
|
- bin/autoproj_bootstrap
|
162
162
|
- bin/autoproj_bootstrap.in
|
163
|
+
- bin/autoproj_install
|
164
|
+
- bin/autoproj_install.in
|
163
165
|
- lib/autoproj.rb
|
164
166
|
- lib/autoproj/autobuild.rb
|
165
167
|
- lib/autoproj/base.rb
|
@@ -189,6 +191,7 @@ files:
|
|
189
191
|
- lib/autoproj/cli/tag.rb
|
190
192
|
- lib/autoproj/cli/test.rb
|
191
193
|
- lib/autoproj/cli/update.rb
|
194
|
+
- lib/autoproj/cli/upgrade.rb
|
192
195
|
- lib/autoproj/cli/versions.rb
|
193
196
|
- lib/autoproj/configuration.rb
|
194
197
|
- lib/autoproj/default.osdeps
|
@@ -203,14 +206,17 @@ files:
|
|
203
206
|
- lib/autoproj/ops/cache.rb
|
204
207
|
- lib/autoproj/ops/configuration.rb
|
205
208
|
- lib/autoproj/ops/import.rb
|
209
|
+
- lib/autoproj/ops/install.rb
|
206
210
|
- lib/autoproj/ops/loader.rb
|
207
211
|
- lib/autoproj/ops/main_config_switcher.rb
|
208
212
|
- lib/autoproj/ops/snapshot.rb
|
209
213
|
- lib/autoproj/ops/tools.rb
|
210
214
|
- lib/autoproj/options.rb
|
211
|
-
- lib/autoproj/
|
215
|
+
- lib/autoproj/os_package_installer.rb
|
216
|
+
- lib/autoproj/os_package_resolver.rb
|
212
217
|
- lib/autoproj/package_definition.rb
|
213
218
|
- lib/autoproj/package_managers/apt_dpkg_manager.rb
|
219
|
+
- lib/autoproj/package_managers/bundler_manager.rb
|
214
220
|
- lib/autoproj/package_managers/emerge_manager.rb
|
215
221
|
- lib/autoproj/package_managers/gem_manager.rb
|
216
222
|
- lib/autoproj/package_managers/homebrew_manager.rb
|