autoproj 2.0.0.rc3 → 2.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,14 @@
|
|
1
|
+
#! /usr/bin/ruby
|
2
|
+
|
3
|
+
if RUBY_VERSION < "1.9.2"
|
4
|
+
STDERR.puts "autoproj requires Ruby >= 1.9.2"
|
5
|
+
exit 1
|
6
|
+
end
|
7
|
+
|
8
|
+
AUTOPROJ_OPS_INSTALL
|
9
|
+
|
10
|
+
ENV.delete('BUNDLE_GEMFILE')
|
11
|
+
ENV.delete('RUBYLIB')
|
12
|
+
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
13
|
+
ops.parse_options(ARGV)
|
14
|
+
ops.run
|
data/lib/autoproj.rb
CHANGED
@@ -16,7 +16,8 @@
|
|
16
16
|
require 'autoproj/manifest'
|
17
17
|
require 'autoproj/package_manifest'
|
18
18
|
require 'autoproj/installation_manifest'
|
19
|
-
require 'autoproj/
|
19
|
+
require 'autoproj/os_package_installer'
|
20
|
+
require 'autoproj/os_package_resolver'
|
20
21
|
require 'autoproj/system'
|
21
22
|
require 'autoproj/build_option'
|
22
23
|
require 'autoproj/configuration'
|
data/lib/autoproj/autobuild.rb
CHANGED
@@ -469,7 +469,7 @@ def only_on(*architectures)
|
|
469
469
|
end
|
470
470
|
end
|
471
471
|
|
472
|
-
os_names, os_versions = Autoproj::
|
472
|
+
os_names, os_versions = Autoproj::OSPackageResolver.operating_system
|
473
473
|
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
474
474
|
if matching_archs.empty?
|
475
475
|
return
|
@@ -494,7 +494,7 @@ def not_on(*architectures)
|
|
494
494
|
end
|
495
495
|
end
|
496
496
|
|
497
|
-
os_names, os_versions = Autoproj::
|
497
|
+
os_names, os_versions = Autoproj::OSPackageResolver.operating_system
|
498
498
|
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
499
499
|
if matching_archs.empty?
|
500
500
|
return yield
|
@@ -33,48 +33,9 @@ def validate_options(args, options)
|
|
33
33
|
return args, options
|
34
34
|
end
|
35
35
|
|
36
|
-
def restart_if_needed(ws)
|
37
|
-
# Check if the .autoprojrc changed the PATH and therefore which autoproj script
|
38
|
-
# should be executed ... and restart if it did
|
39
|
-
autoproj_path = Autobuild.find_in_path('autoproj')
|
40
|
-
if $0 != autoproj_path
|
41
|
-
puts "your .autoprojrc file changed PATH in a way that requires the restart of autoproj"
|
42
|
-
|
43
|
-
if ENV['AUTOPROJ_RESTARTING']
|
44
|
-
puts "infinite loop detected, will not restart this time"
|
45
|
-
else
|
46
|
-
require 'rbconfig'
|
47
|
-
ws.config.save
|
48
|
-
exec(ws.config.ruby_executable, autoproj_path, *ARGV)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def install_autoproj_gem_in_new_root(ws)
|
54
|
-
# Install the autoproj/autobuild gem explicitely in the new
|
55
|
-
# root.
|
56
|
-
original_env =
|
57
|
-
Hash['GEM_HOME' => Gem.paths.home,
|
58
|
-
'GEM_PATH' => Gem.paths.path]
|
59
|
-
|
60
|
-
begin
|
61
|
-
Gem.paths =
|
62
|
-
Hash['GEM_HOME' => File.join(root_dir, '.gems'),
|
63
|
-
'GEM_PATH' => []]
|
64
|
-
PackageManagers::GemManager.with_prerelease(ws.config.use_prerelease?) do
|
65
|
-
ws.osdeps.install(%w{autobuild autoproj})
|
66
|
-
end
|
67
|
-
ensure
|
68
|
-
Gem.paths = original_env
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
36
|
def run(buildconf_info, options)
|
73
37
|
ws = Workspace.new(root_dir)
|
74
|
-
|
75
38
|
ws.setup
|
76
|
-
install_autoproj_gem_in_new_root(ws)
|
77
|
-
restart_if_needed(ws)
|
78
39
|
|
79
40
|
seed_config = options.delete(:seed_config)
|
80
41
|
|
data/lib/autoproj/cli/build.rb
CHANGED
data/lib/autoproj/cli/main.rb
CHANGED
@@ -29,7 +29,7 @@ class Main < Thor
|
|
29
29
|
no_commands do
|
30
30
|
def run_autoproj_cli(filename, classname, report_options, *args)
|
31
31
|
require "autoproj/cli/#{filename}"
|
32
|
-
Autoproj.report(Hash[silent:
|
32
|
+
Autoproj.report(Hash[silent: !options[:debug], debug: options[:debug]].merge(report_options)) do
|
33
33
|
cli = CLI.const_get(classname).new
|
34
34
|
run_args = cli.validate_options(args, self.options)
|
35
35
|
cli.run(*run_args)
|
@@ -45,6 +45,13 @@ def run_autoproj_cli(filename, classname, report_options, *args)
|
|
45
45
|
banner: 'SEED_CONFIG',
|
46
46
|
desc: "a configuration file used to seed the bootstrap's configuration"
|
47
47
|
def bootstrap(*args)
|
48
|
+
if !File.directory?(File.join(Dir.pwd, '.autoproj'))
|
49
|
+
require 'autoproj/ops/install'
|
50
|
+
ops = Autoproj::Ops::Install.new(Dir.pwd)
|
51
|
+
remaining = ops.parse_options(args)
|
52
|
+
ops.run
|
53
|
+
exec Gem.ruby, $0, 'bootstrap', *args
|
54
|
+
end
|
48
55
|
run_autoproj_cli(:bootstrap, :Bootstrap, Hash[], *args)
|
49
56
|
end
|
50
57
|
|
@@ -304,6 +311,11 @@ def switch_config(*args)
|
|
304
311
|
def query(query_string = nil)
|
305
312
|
run_autoproj_cli(:query, :Query, Hash[], *Array(query_string))
|
306
313
|
end
|
314
|
+
|
315
|
+
desc "upgrade autoproj itself"
|
316
|
+
def upgrade
|
317
|
+
run_autoproj_cli(:upgrade, :Upgrade, Hash[])
|
318
|
+
end
|
307
319
|
end
|
308
320
|
end
|
309
321
|
end
|
data/lib/autoproj/cli/osdeps.rb
CHANGED
data/lib/autoproj/cli/show.rb
CHANGED
@@ -81,7 +81,7 @@ def display_source_package(pkg_name, default_packages, revdeps)
|
|
81
81
|
|
82
82
|
def display_osdep_package(pkg_name, default_packages, revdeps)
|
83
83
|
puts Autoproj.color("the osdep '#{pkg_name}'", :bold)
|
84
|
-
ws.
|
84
|
+
ws.os_package_resolver.resolve_os_packages([pkg_name]).each do |manager, packages|
|
85
85
|
puts " #{manager.names.first}: #{packages.map { |*subnames| subnames.join(" ") }.join(", ")}"
|
86
86
|
end
|
87
87
|
|
data/lib/autoproj/cli/update.rb
CHANGED
@@ -15,7 +15,7 @@ def validate_options(packages, options)
|
|
15
15
|
if from = options[:from]
|
16
16
|
options[:from] = Autoproj::InstallationManifest.from_root(options[:from])
|
17
17
|
end
|
18
|
-
ws.
|
18
|
+
ws.os_package_installer.filter_uptodate_packages = options[:osdeps_filter_uptodate]
|
19
19
|
|
20
20
|
if options[:aup] && !options[:all] && packages.empty?
|
21
21
|
packages = ['.']
|
@@ -54,7 +54,7 @@ def run(selected_packages, options)
|
|
54
54
|
if options[:osdeps]
|
55
55
|
ws.config.set(
|
56
56
|
'operating_system',
|
57
|
-
Autoproj::
|
57
|
+
Autoproj::OSPackageResolver.operating_system(:force => true),
|
58
58
|
true)
|
59
59
|
end
|
60
60
|
|
@@ -112,7 +112,7 @@ def run(selected_packages, options)
|
|
112
112
|
raise "cannot find package #{pkg_name}"
|
113
113
|
end
|
114
114
|
end
|
115
|
-
ws.
|
115
|
+
ws.install_os_packages(vcs_to_install, osdeps_options)
|
116
116
|
end
|
117
117
|
|
118
118
|
ops = Autoproj::Ops::Import.new(ws)
|
@@ -130,7 +130,7 @@ def run(selected_packages, options)
|
|
130
130
|
ws.export_installation_manifest
|
131
131
|
|
132
132
|
if options[:osdeps] && !osdep_packages.empty?
|
133
|
-
ws.
|
133
|
+
ws.install_os_packages(osdep_packages, osdeps_options)
|
134
134
|
end
|
135
135
|
|
136
136
|
ws.export_env_sh(source_packages)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Autoproj
|
2
|
+
module CLI
|
3
|
+
class Upgrade
|
4
|
+
def initialize(root_dir)
|
5
|
+
@root_dir = root_dir
|
6
|
+
end
|
7
|
+
|
8
|
+
def upgrade_from_v2
|
9
|
+
require 'autoproj/ops/install'
|
10
|
+
installer = Autoproj::Ops::Install.new(root_dir)
|
11
|
+
installer.install
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_v1_root_dir(base_dir = ENV['AUTOPROJ_CURRENT_ROOT'] || Dir.pwd)
|
15
|
+
path = Pathname.new(base_dir)
|
16
|
+
while !path.root?
|
17
|
+
if (path + "autoproj").exist?
|
18
|
+
break
|
19
|
+
end
|
20
|
+
path = path.parent
|
21
|
+
end
|
22
|
+
|
23
|
+
if path.root?
|
24
|
+
return
|
25
|
+
end
|
26
|
+
|
27
|
+
# I don't know if this is still useful or not ... but it does not hurt
|
28
|
+
#
|
29
|
+
# Preventing backslashed in path, that might be confusing on some path compares
|
30
|
+
if Autobuild.windows?
|
31
|
+
result = result.gsub(/\\/,'/')
|
32
|
+
end
|
33
|
+
result
|
34
|
+
end
|
35
|
+
|
36
|
+
def upgrade_from_v1
|
37
|
+
# Do an install
|
38
|
+
require 'autoproj/ops/install'
|
39
|
+
installer = Autoproj::Ops::Install.new(root_dir)
|
40
|
+
installer.run
|
41
|
+
# Copy the current configuration
|
42
|
+
current_config = File.open(File.join(root_dir, 'autoproj', 'config.yml')) do |io|
|
43
|
+
YAML.load(io)
|
44
|
+
end
|
45
|
+
new_config = File.open(config_file_path) do |io|
|
46
|
+
YAML.load(io)
|
47
|
+
end
|
48
|
+
File.open(config_file_path, 'w') do |io|
|
49
|
+
io.write YAML.dump(current_config.merge(new_config))
|
50
|
+
end
|
51
|
+
|
52
|
+
Autoproj.message "now, open a new console, source env.sh and run"
|
53
|
+
Autoproj.message " autoproj osdeps"
|
54
|
+
Autoproj.message " autoproj envsh"
|
55
|
+
end
|
56
|
+
|
57
|
+
def run(*args)
|
58
|
+
root_dir = Workspace.find_root_dir
|
59
|
+
if root_dir && File.directory?(File.join(root_dir, '.autoproj'))
|
60
|
+
return upgrade_from_v2
|
61
|
+
end
|
62
|
+
|
63
|
+
root_dir = find_v1_root_dir
|
64
|
+
if root_dir && File.directory?(root_dir, '.gems')
|
65
|
+
return upgrade_from_v1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -206,11 +206,23 @@ def parallel_import_level=(level)
|
|
206
206
|
set('parallel_import_level', level)
|
207
207
|
end
|
208
208
|
|
209
|
+
def private_bundler?
|
210
|
+
get('private_bundler', false)
|
211
|
+
end
|
212
|
+
|
213
|
+
def private_autoproj?
|
214
|
+
get('private_autoproj', false)
|
215
|
+
end
|
216
|
+
|
217
|
+
def private_gems?
|
218
|
+
get('private_gems', false)
|
219
|
+
end
|
220
|
+
|
209
221
|
def ruby_executable
|
210
222
|
if path = get('ruby_executable', nil)
|
211
223
|
path
|
212
224
|
else
|
213
|
-
path =
|
225
|
+
path = OSPackageResolver.autodetect_ruby_program
|
214
226
|
set('ruby_executable', path, true)
|
215
227
|
path
|
216
228
|
end
|
@@ -261,6 +273,11 @@ def importer_cache_dir
|
|
261
273
|
get('importer_cache_dir', nil)
|
262
274
|
end
|
263
275
|
|
276
|
+
# Sets the directory in which packages will be installed
|
277
|
+
def prefix_dir=(path)
|
278
|
+
set('prefix', path, true)
|
279
|
+
end
|
280
|
+
|
264
281
|
# The directory in which packages will be installed.
|
265
282
|
#
|
266
283
|
# If it is a relative path, it is relative to the root dir of the
|
data/lib/autoproj/exceptions.rb
CHANGED
@@ -45,6 +45,13 @@ def initialize(selection)
|
|
45
45
|
class UserError < RuntimeError; end
|
46
46
|
|
47
47
|
class WorkspaceAlreadyCreated < RuntimeError; end
|
48
|
+
|
49
|
+
# Exception raised when looking for a workspace and it cannot be found
|
50
|
+
class NotWorkspace < RuntimeError; end
|
51
|
+
|
52
|
+
# Exception raised when initializing on a workspace that is not the current
|
53
|
+
# one
|
54
|
+
class MismatchingWorkspace < RuntimeError; end
|
48
55
|
end
|
49
56
|
|
50
57
|
|
@@ -3,8 +3,6 @@ module Autoproj
|
|
3
3
|
class InstallationManifest
|
4
4
|
Package = Struct.new :name, :srcdir, :prefix, :builddir, :dependencies
|
5
5
|
|
6
|
-
DEFAULT_MANIFEST_NAME = ".autoproj-installation-manifest"
|
7
|
-
|
8
6
|
attr_reader :path
|
9
7
|
attr_reader :packages
|
10
8
|
def initialize(path)
|
@@ -12,12 +10,8 @@ def initialize(path)
|
|
12
10
|
@packages = Hash.new
|
13
11
|
end
|
14
12
|
|
15
|
-
def default_manifest_path
|
16
|
-
File.join(path, DEFAULT_MANIFEST_NAME)
|
17
|
-
end
|
18
|
-
|
19
13
|
def exist?
|
20
|
-
File.exist?(
|
14
|
+
File.exist?(path)
|
21
15
|
end
|
22
16
|
|
23
17
|
def [](name)
|
@@ -32,7 +26,7 @@ def delete_if
|
|
32
26
|
packages.delete_if { |_, pkg| yield(pkg) }
|
33
27
|
end
|
34
28
|
|
35
|
-
def load
|
29
|
+
def load
|
36
30
|
@packages = Hash.new
|
37
31
|
raw = YAML.load(File.open(path))
|
38
32
|
if raw.respond_to?(:to_str) # old CSV-based format
|
@@ -52,7 +46,8 @@ def load(path = default_manifest_path)
|
|
52
46
|
end
|
53
47
|
end
|
54
48
|
|
55
|
-
|
49
|
+
# Save the installation manifest
|
50
|
+
def save(path = self.path)
|
56
51
|
File.open(path, 'w') do |io|
|
57
52
|
marshalled_packages = packages.values.map do |v|
|
58
53
|
Hash['name' => v.name,
|
@@ -65,18 +60,34 @@ def save(path = default_manifest_path)
|
|
65
60
|
end
|
66
61
|
end
|
67
62
|
|
63
|
+
# Enumerate the packages from this manifest
|
64
|
+
#
|
65
|
+
# @yieldparam [Package]
|
68
66
|
def each(&block)
|
69
67
|
packages.each_value(&block)
|
70
68
|
end
|
71
69
|
|
70
|
+
# Returns information about a given package
|
71
|
+
#
|
72
|
+
# @return [Package]
|
72
73
|
def [](name)
|
73
|
-
packages
|
74
|
+
packages[name]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns the default Autoproj installation manifest path for a given
|
78
|
+
# autoproj workspace root
|
79
|
+
#
|
80
|
+
# @param [String] root_dir
|
81
|
+
# @return [String]
|
82
|
+
def self.path_for_root(root_dir)
|
83
|
+
File.join(root_dir, '.autoproj', 'installation-manifest')
|
74
84
|
end
|
75
85
|
|
76
86
|
def self.from_root(root_dir)
|
77
|
-
|
87
|
+
path = path_for_root(root_dir)
|
88
|
+
manifest = InstallationManifest.new(path)
|
78
89
|
if !manifest.exist?
|
79
|
-
raise ConfigError.new, "no #{
|
90
|
+
raise ConfigError.new, "no #{path} file found. You should probably rerun autoproj envsh in that folder first"
|
80
91
|
end
|
81
92
|
manifest.load
|
82
93
|
manifest
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -88,7 +88,7 @@ def auto_osdeps?
|
|
88
88
|
attr_accessor :vcs
|
89
89
|
|
90
90
|
# The definition of all OS packages available on this installation
|
91
|
-
attr_reader :
|
91
|
+
attr_reader :os_package_resolver
|
92
92
|
|
93
93
|
def initialize
|
94
94
|
@file = nil
|
@@ -96,7 +96,7 @@ def initialize
|
|
96
96
|
@packages = Hash.new
|
97
97
|
@package_manifests = Hash.new
|
98
98
|
@package_sets = []
|
99
|
-
@
|
99
|
+
@os_package_resolver = OSPackageResolver.new
|
100
100
|
|
101
101
|
@automatic_exclusions = Hash.new
|
102
102
|
@constants_definitions = Hash.new
|
@@ -104,7 +104,7 @@ def initialize
|
|
104
104
|
@moved_packages = Hash.new
|
105
105
|
@osdeps_overrides = Hash.new
|
106
106
|
@metapackages = Hash.new
|
107
|
-
@
|
107
|
+
@ignored_os_packages = Set.new
|
108
108
|
@reused_installations = Array.new
|
109
109
|
@ignored_packages = Set.new
|
110
110
|
@manifest_exclusions = Set.new
|
@@ -621,16 +621,16 @@ def resolve_package_name_as_source_package(name)
|
|
621
621
|
# (type, package_name) pairs where type is either :package or :osdep and
|
622
622
|
# package_name the corresponding package name
|
623
623
|
def resolve_package_name_as_osdep(name)
|
624
|
-
osdeps_availability =
|
625
|
-
if osdeps_availability ==
|
624
|
+
osdeps_availability = os_package_resolver.availability_of(name)
|
625
|
+
if osdeps_availability == OSPackageResolver::NO_PACKAGE
|
626
626
|
raise PackageNotFound, "cannot resolve #{name}: it is not an osdep"
|
627
627
|
end
|
628
628
|
|
629
629
|
# There is an osdep definition for this package, check the
|
630
630
|
# overrides
|
631
631
|
osdeps_available =
|
632
|
-
(osdeps_availability ==
|
633
|
-
(osdeps_availability ==
|
632
|
+
(osdeps_availability == OSPackageResolver::AVAILABLE) ||
|
633
|
+
(osdeps_availability == OSPackageResolver::IGNORE)
|
634
634
|
osdeps_overrides = self.osdeps_overrides[name]
|
635
635
|
if osdeps_overrides && (!osdeps_available || osdeps_overrides[:force])
|
636
636
|
source_packages = osdeps_overrides[:packages].inject([]) do |result, src_pkg_name|
|
@@ -640,11 +640,11 @@ def resolve_package_name_as_osdep(name)
|
|
640
640
|
return [[:package, pkg.name]]
|
641
641
|
elsif osdeps_available
|
642
642
|
return [[:osdeps, name]]
|
643
|
-
elsif osdeps_availability ==
|
643
|
+
elsif osdeps_availability == OSPackageResolver::WRONG_OS
|
644
644
|
raise PackageNotFound, "#{name} is an osdep, but it is not available for this operating system"
|
645
|
-
elsif osdeps_availability ==
|
645
|
+
elsif osdeps_availability == OSPackageResolver::UNKNOWN_OS
|
646
646
|
raise PackageNotFound, "#{name} is an osdep, but the local operating system is unavailable"
|
647
|
-
elsif osdeps_availability ==
|
647
|
+
elsif osdeps_availability == OSPackageResolver::NONEXISTENT
|
648
648
|
raise PackageNotFound, "#{name} is an osdep, but it is explicitely marked as 'nonexistent' for this operating system"
|
649
649
|
end
|
650
650
|
end
|
@@ -662,7 +662,7 @@ def resolve_package_set(name)
|
|
662
662
|
end
|
663
663
|
pkg_set.each_package.
|
664
664
|
map(&:name).
|
665
|
-
find_all { |pkg_name| !
|
665
|
+
find_all { |pkg_name| !os_package_resolver.has?(pkg_name) }
|
666
666
|
end
|
667
667
|
end
|
668
668
|
|
@@ -762,7 +762,7 @@ def all_packages
|
|
762
762
|
result |= metapackage(pkg_set.name).packages.map(&:name).to_set
|
763
763
|
end
|
764
764
|
result.to_a.
|
765
|
-
find_all { |pkg_name| !
|
765
|
+
find_all { |pkg_name| !os_package_resolver.has?(pkg_name) }
|
766
766
|
end
|
767
767
|
|
768
768
|
# Returns true if +name+ is a valid package and is included in the build
|
@@ -773,7 +773,7 @@ def all_packages
|
|
773
773
|
# If it is false, the method will simply return false on non-defined
|
774
774
|
# packages
|
775
775
|
def package_enabled?(name, validate = true)
|
776
|
-
if !find_autobuild_package(name) && !
|
776
|
+
if !find_autobuild_package(name) && !os_package_resolver.has?(name)
|
777
777
|
if validate
|
778
778
|
raise ArgumentError, "package #{name} does not exist"
|
779
779
|
end
|
@@ -925,14 +925,14 @@ def disable_imports_from(pkg_set_name)
|
|
925
925
|
end
|
926
926
|
|
927
927
|
# call-seq:
|
928
|
-
#
|
928
|
+
# list_os_packages(packages) => required_packages, ospkg_to_pkg
|
929
929
|
#
|
930
930
|
# Returns the set of dependencies required by the listed packages.
|
931
931
|
#
|
932
932
|
# +required_packages+ is the set of osdeps names that are required for
|
933
933
|
# +packages+ and +ospkg_to_pkg+ a mapping from the osdeps name to the
|
934
934
|
# set of packages that require this OS package.
|
935
|
-
def
|
935
|
+
def list_os_packages(packages)
|
936
936
|
required_os_packages = Set.new
|
937
937
|
package_os_deps = Hash.new { |h, k| h[k] = Array.new }
|
938
938
|
packages.each do |pkg_name|
|
@@ -950,7 +950,7 @@ def list_os_dependencies(packages)
|
|
950
950
|
return required_os_packages, package_os_deps
|
951
951
|
end
|
952
952
|
|
953
|
-
def
|
953
|
+
def filter_os_packages(required_os_packages, package_os_deps)
|
954
954
|
required_os_packages.find_all do |pkg|
|
955
955
|
if excluded?(pkg)
|
956
956
|
raise ConfigError.new, "the osdeps package #{pkg} is excluded from the build in #{file}. It is required by #{package_os_deps[pkg].join(", ")}"
|
@@ -965,26 +965,6 @@ def filter_os_dependencies(required_os_packages, package_os_deps)
|
|
965
965
|
end
|
966
966
|
end
|
967
967
|
|
968
|
-
# Restores the OS dependencies required by the given packages to
|
969
|
-
# pristine conditions
|
970
|
-
#
|
971
|
-
# This is usually called as a rebuild step to make sure that all these
|
972
|
-
# packages are updated to whatever required the rebuild
|
973
|
-
def pristine_os_dependencies(packages)
|
974
|
-
required_os_packages, package_os_deps = list_os_dependencies(packages)
|
975
|
-
required_os_packages =
|
976
|
-
filter_os_dependencies(required_os_packages, package_os_deps)
|
977
|
-
osdeps.pristine(required_os_packages)
|
978
|
-
end
|
979
|
-
|
980
|
-
# Installs the OS dependencies that are required by the given packages
|
981
|
-
def install_os_dependencies(packages, options = Hash.new)
|
982
|
-
required_os_packages, package_os_deps = list_os_dependencies(packages)
|
983
|
-
required_os_packages =
|
984
|
-
filter_os_dependencies(required_os_packages, package_os_deps)
|
985
|
-
osdeps.install(required_os_packages, options)
|
986
|
-
end
|
987
|
-
|
988
968
|
# The set of overrides added with #add_osdeps_overrides
|
989
969
|
attr_reader :osdeps_overrides
|
990
970
|
|
@@ -1069,7 +1049,7 @@ def expand_package_selection(selection, options = Hash.new)
|
|
1069
1049
|
|
1070
1050
|
# Finally, check for partial matches
|
1071
1051
|
all_source_package_names = self.all_package_names
|
1072
|
-
all_osdeps_package_names =
|
1052
|
+
all_osdeps_package_names = os_package_resolver.all_package_names
|
1073
1053
|
selection.each do |sel|
|
1074
1054
|
match_pkg_name = Regexp.new(Regexp.quote(sel))
|
1075
1055
|
all_matches = Array.new
|
@@ -1180,11 +1160,11 @@ def reuse(*dir)
|
|
1180
1160
|
# Load OS dependency information contained in our registered package
|
1181
1161
|
# sets into the provided osdep object
|
1182
1162
|
#
|
1183
|
-
# @param [
|
1163
|
+
# @param [OSPackageResolver] osdeps the osdep handling object
|
1184
1164
|
# @return [void]
|
1185
1165
|
def load_osdeps_from_package_sets(osdeps)
|
1186
|
-
|
1187
|
-
osdeps.merge(
|
1166
|
+
each_package_set do |pkg_set, file|
|
1167
|
+
osdeps.merge(pkg_set.load_osdeps(file))
|
1188
1168
|
end
|
1189
1169
|
end
|
1190
1170
|
end
|
@@ -1198,9 +1178,9 @@ def self.manifest
|
|
1198
1178
|
|
1199
1179
|
def self.osdeps
|
1200
1180
|
Autoproj.warn_deprecated(
|
1201
|
-
__method__, "use workspace.
|
1181
|
+
__method__, "use workspace.os_package_resolver or workspace.os_package_installer instead")
|
1202
1182
|
|
1203
|
-
workspace.
|
1183
|
+
workspace.os_package_resolver
|
1204
1184
|
end
|
1205
1185
|
|
1206
1186
|
def self.config
|
@@ -1210,12 +1190,6 @@ def self.config
|
|
1210
1190
|
workspace.config
|
1211
1191
|
end
|
1212
1192
|
|
1213
|
-
# Load the osdeps files contained in {manifest} into {osdeps}
|
1214
|
-
def self.load_osdeps_from_package_sets
|
1215
|
-
workspace.load_osdeps_from_package_sets(osdeps)
|
1216
|
-
workspace.osdeps
|
1217
|
-
end
|
1218
|
-
|
1219
1193
|
def self.add_osdeps_overrides(*args, &block)
|
1220
1194
|
manifest.add_osdeps_overrides(*args, &block)
|
1221
1195
|
end
|