Class: Autoproj::LocalPackageSet
Overview
Specialization of the PackageSet class to handle the “master” package set in autoproj/
Instance Attribute Summary
Attributes inherited from PackageSet
#all_osdeps, #all_osrepos, #auto_imports, #constants_definitions, #default_importer, #explicit, #imported_from, #importer_definitions_cache, #imports, #imports_vcs, #name, #os_package_resolver, #os_repository_resolver, #overrides, #raw_local_dir, #required_autoproj_version, #version_control, #ws
Instance Method Summary
collapse
Methods inherited from PackageSet
#add_constant_definition, #add_overrides_entry, #add_raw_imported_set, add_source_file, #add_version_control_entry, #auto_imports?, #autobuild, #create_autobuild_package, default_expansions, #default_packages, #each_autobuild_file, #each_imported_set, #each_osdep, #each_osdeps_file, #each_osrepo, #each_osrepos_file, #each_package, #each_raw_imported_set, #empty?, #expand, #explicit?, #importer_definition_for, #inject_constants_and_config_for_expansion, #invalidate_importer_definitions_cache, #load_osdeps, #load_osrepos, #manifest, master_source_file, #metapackage, name_of, #normalize_vcs_list, #number_to_nth, #overrides_for, #parse_source_definition, #present?, raw_description_file, raw_local_dir_of, #repository_id, resolve_definition, #resolve_overrides, #single_expansion, #snapshot, #user_local_dir, validate_and_normalize_source_file, #version_control_field
Constructor Details
#initialize(ws, local_dir: ws.config_dir) ⇒ LocalPackageSet
Returns a new instance of LocalPackageSet.
5
6
7
8
|
# File 'lib/autoproj/local_package_set.rb', line 5
def initialize(ws, local_dir: ws.config_dir)
super(ws, VCSDefinition.none, name: "main configuration", raw_local_dir: local_dir)
@local_dir = local_dir
end
|
Instance Method Details
#load_description_file ⇒ Object
42
43
44
45
|
# File 'lib/autoproj/local_package_set.rb', line 42
def load_description_file
source_definition = raw_description_file
parse_source_definition(source_definition)
end
|
#load_overrides(source_definition) ⇒ Object
Load the files in overrides.d in addition to the overrides: field in the yaml file
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/autoproj/local_package_set.rb', line 49
def load_overrides(source_definition)
files = Dir.glob(File.join(ws.overrides_dir, "*.yml")).sort
overrides = files.map do |file|
source_data = Autoproj.in_file(file, Autoproj::YAML_LOAD_ERROR) do
YAML.load(File.read(file)) || Array.new
end
source_data =
if source_data.respond_to?(:to_ary)
source_data
else
source_data["overrides"] || Hash.new
end
[file, source_data]
end
overrides + super
end
|
#local? ⇒ Boolean
18
19
20
|
# File 'lib/autoproj/local_package_set.rb', line 18
def local?
true
end
|
#local_dir ⇒ Object
22
23
24
|
# File 'lib/autoproj/local_package_set.rb', line 22
def local_dir
raw_local_dir
end
|
#main? ⇒ Boolean
14
15
16
|
# File 'lib/autoproj/local_package_set.rb', line 14
def main?
true
end
|
#manifest_path ⇒ Object
26
27
28
|
# File 'lib/autoproj/local_package_set.rb', line 26
def manifest_path
manifest.file
end
|
#overrides_file_path ⇒ Object
30
31
32
33
34
|
# File 'lib/autoproj/local_package_set.rb', line 30
def overrides_file_path
if (d = local_dir)
File.join(d, "overrides.yml")
end
end
|
#raw_description_file ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/autoproj/local_package_set.rb', line 66
def raw_description_file
description = Hash[
"imports" => Array.new,
"version_control" => Array.new,
"overrides" => Array.new]
if File.file?(overrides_file_path)
overrides_data = Autoproj.in_file(overrides_file_path, Autoproj::YAML_LOAD_ERROR) do
YAML.load(File.read(overrides_file_path)) || Hash.new
end
overrides_data = PackageSet.validate_and_normalize_source_file(
overrides_file_path, overrides_data
)
description = description.merge(overrides_data)
end
manifest_data = Autoproj.in_file(manifest_path, Autoproj::YAML_LOAD_ERROR) do
YAML.load(File.read(manifest_path)) || Hash.new
end
description["imports"] = description["imports"]
.concat(manifest_data["package_sets"] || Array.new)
description["name"] = name
description
end
|
#source_file ⇒ Object
36
37
38
|
# File 'lib/autoproj/local_package_set.rb', line 36
def source_file
overrides_file_path
end
|
#vcs ⇒ Object
10
11
12
|
# File 'lib/autoproj/local_package_set.rb', line 10
def vcs
ws.manifest.vcs
end
|