Class: Autoproj::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/autoproj/manifest.rb

Overview

The Manifest class represents the information included in the main manifest file, and allows to manipulate it

Defined Under Namespace

Classes: NoPackageXML

Constant Summary collapse

PackageSelection =
Autoproj::PackageSelection

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ws, os_package_resolver: OSPackageResolver.new) ⇒ Manifest

Returns a new instance of Manifest.



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/autoproj/manifest.rb', line 188

def initialize(ws, os_package_resolver: OSPackageResolver.new)
    @ws = ws
    @vcs = VCSDefinition.none
    @file = nil
    @data = Hash.new
    @has_layout = false
    @normalized_layout = Hash.new
    @packages = Hash.new
    @package_sets = []
    @os_package_resolver = os_package_resolver
    # Cache for #ignored?
    @ignored_package_names = nil

    @automatic_exclusions = Hash.new
    @constants_definitions = Hash.new
    @moved_packages = Hash.new
    @osdeps_overrides = Hash.new
    @metapackages = Hash.new
    @ignored_os_packages = Set.new
    @reused_installations = Array.new
    @ignored_packages = Set.new
    @manifest_exclusions = Set.new
    @accept_unavailable_osdeps = false

    @constant_definitions = Hash.new
    @package_sets << LocalPackageSet.new(ws)
end

Instance Attribute Details

#accept_unavailable_osdeps=(value) ⇒ Object (writeonly)



168
169
170
# File 'lib/autoproj/manifest.rb', line 168

def accept_unavailable_osdeps=(value)
  @accept_unavailable_osdeps = value
end

#automatic_exclusionsObject (readonly)

A package_name => reason map of the exclusions added with #exclude_package Exclusions listed in the manifest file are returned by #manifest_exclusions



356
357
358
# File 'lib/autoproj/manifest.rb', line 356

def automatic_exclusions
  @automatic_exclusions
end

#constant_definitionsObject (readonly)

Returns the value of attribute constant_definitions.



170
171
172
# File 'lib/autoproj/manifest.rb', line 170

def constant_definitions
  @constant_definitions
end

#dataObject (readonly)

The manifest data as a Hash



144
145
146
# File 'lib/autoproj/manifest.rb', line 144

def data
  @data
end

#fileObject (readonly)

The path to the manifest file that has been loaded



151
152
153
# File 'lib/autoproj/manifest.rb', line 151

def file
  @file
end

#ignored_packagesObject (readonly)

The set of package names for packages that should be ignored



154
155
156
# File 'lib/autoproj/manifest.rb', line 154

def ignored_packages
  @ignored_packages
end

#manifest_exclusionsObject (readonly)

The set of package names that are listed in the excluded_packages section of the manifest



352
353
354
# File 'lib/autoproj/manifest.rb', line 352

def manifest_exclusions
  @manifest_exclusions
end

#metapackagesObject (readonly)

Returns the value of attribute metapackages.



172
173
174
# File 'lib/autoproj/manifest.rb', line 172

def metapackages
  @metapackages
end

#moved_packagesObject (readonly)

Returns the value of attribute moved_packages.



1178
1179
1180
# File 'lib/autoproj/manifest.rb', line 1178

def moved_packages
  @moved_packages
end

#normalized_layoutHash (readonly)

A normalized version of the layout as represented in the manifest file

It is a mapping from a selection name into the layout level it is defined in. For instance:

layout:
- subdir:
  - pkg/in/subdir
- pkg/in/root

Would be normalized as

'pkg/in/subdir' => '/subdir/',
'pkg/in/root' => '/'

Note that these are only strings. There is no normalization against package names or metapackages.

This is computed by #compute_normalized_layout

Returns:

  • (Hash)


51
52
53
# File 'lib/autoproj/manifest.rb', line 51

def normalized_layout
  @normalized_layout
end

#os_package_resolverObject (readonly)

The definition of all OS packages available on this installation



180
181
182
# File 'lib/autoproj/manifest.rb', line 180

def os_package_resolver
  @os_package_resolver
end

#osdeps_overridesObject (readonly)

The set of overrides added with #add_osdeps_overrides



1067
1068
1069
# File 'lib/autoproj/manifest.rb', line 1067

def osdeps_overrides
  @osdeps_overrides
end

#package_sets=(value) ⇒ Array<PackageSet> (writeonly)

Set the package sets that are available on this manifest

This is set externally at loading time. load_and_update_package_sets can do it as well

Returns:



20
21
22
# File 'lib/autoproj/manifest.rb', line 20

def package_sets=(value)
  @package_sets = value
end

#packagesObject (readonly)

The set of packages defined so far as a mapping from package name to

Autobuild::Package, package_set, file

tuple



148
149
150
# File 'lib/autoproj/manifest.rb', line 148

def packages
  @packages
end

#reused_installationsObject (readonly)

A set of other autoproj installations that are being reused



157
158
159
# File 'lib/autoproj/manifest.rb', line 157

def reused_installations
  @reused_installations
end

#vcsVCSDefinition

The VCS object for the main configuration itself

Returns:



177
178
179
# File 'lib/autoproj/manifest.rb', line 177

def vcs
  @vcs
end

Class Method Details

.load(file) ⇒ Object

Loads the manifest file located at file and returns the Manifest instance that represents it



24
25
26
27
28
# File 'lib/autoproj/manifest.rb', line 24

def self.load(file)
    manifest = Manifest.new
    manifest.load(file)
    manifest
end

Instance Method Details

#accept_unavailable_osdeps?Boolean

Whether #resolve_package_name should raise if an osdep is found that is not available on the current operating system, or simply return it

Returns:

  • (Boolean)


163
164
165
# File 'lib/autoproj/manifest.rb', line 163

def accept_unavailable_osdeps?
    !!@accept_unavailable_osdeps
end

#add_constant_definition(key, value) ⇒ Object

Add a constant definition, used when resolving $CONSTANT in loaded files



139
140
141
# File 'lib/autoproj/manifest.rb', line 139

def add_constant_definition(key, value)
    constant_definitions[key] = value
end

#add_exclusion(package_name, reason) ⇒ Object

Deprecated.

use #exclude_package instead



359
360
361
362
# File 'lib/autoproj/manifest.rb', line 359

def add_exclusion(package_name, reason)
    Autoproj.warn_deprecated __method__, "use #exclude_package instead"
    exclude_package(package_name, reason)
end

#add_metapackage_to_layout(metapackage) ⇒ Object

Add a metapackage into the layout



131
132
133
134
135
# File 'lib/autoproj/manifest.rb', line 131

def add_metapackage_to_layout(metapackage)
    validate_metapackage_in_self(metapackage)
    @has_layout = true
    normalized_layout[metapackage.name] = "/"
end

#add_osdeps_overrides(osdeps_name, package: osdeps_name, packages: [], force: false) ⇒ Object

Declares that autoproj should use normal package(s) to provide the osdeps_name OS package in cases osdeps_name does not exist.

The full syntax is

Autoproj.add_osdeps_overrides 'opencv', :package => 'external/opencv'

If more than one packages should be built, use the :packages option with an array:

Autoproj.add_osdeps_overrides 'opencv', :packages => ['external/opencv', 'external/test']

The :force option allows to force the usage of the source package(s), regardless of the availability of the osdeps package.



1083
1084
1085
1086
1087
# File 'lib/autoproj/manifest.rb', line 1083

def add_osdeps_overrides(osdeps_name, package: osdeps_name, packages: [], force: false)
    packages << package if package
    packages.each { |pkg_name| resolve_package_name(pkg_name) }
    @osdeps_overrides[osdeps_name.to_s] = Hash[packages: packages, force: force]
end

#add_package_set_to_layout(package_set) ⇒ Object

Add a package into the layout



125
126
127
128
# File 'lib/autoproj/manifest.rb', line 125

def add_package_set_to_layout(package_set)
    validate_package_set_in_self(package_set)
    add_metapackage_to_layout(package_set.metapackage)
end

#add_package_to_layout(package) ⇒ Object

Add a package into the layout



118
119
120
121
122
# File 'lib/autoproj/manifest.rb', line 118

def add_package_to_layout(package)
    package_name = validate_package_name_argument(package)
    @has_layout = true
    normalized_layout[package_name] = "/"
end

#all_layout_packages(validate = true) ⇒ Object

Returns the set of package names that are explicitely listed in the layout, minus the excluded and ignored ones



870
871
872
# File 'lib/autoproj/manifest.rb', line 870

def all_layout_packages(validate = true)
    default_packages(validate)
end

#all_package_namesObject

Returns all defined package names



875
876
877
# File 'lib/autoproj/manifest.rb', line 875

def all_package_names
    each_autobuild_package.map(&:name)
end

#all_selected_osdep_packages(validate = true) ⇒ Array<String>

Returns the set of osdep packages that are selected by the layout

Returns:

  • (Array<String>)


914
915
916
# File 'lib/autoproj/manifest.rb', line 914

def all_selected_osdep_packages(validate = true)
    default_packages(validate).all_selected_osdep_packages(self)
end

#all_selected_packages(validate = true) ⇒ Array<String>

Returns the set of packages that are selected by the layout

Unless #default_packages, it returns both the selected packages and the dependencies (resolved recursively)

Returns:

  • (Array<String>)

    a list of source and osdep package names



924
925
926
927
928
929
930
931
932
933
# File 'lib/autoproj/manifest.rb', line 924

def all_selected_packages(validate = true)
    result = Set.new
    selection = default_packages(validate)

    root_sources = selection.each_source_package_name.to_set
    root_sources.each do |pkg_name|
        find_autobuild_package(pkg_name).all_dependencies_with_osdeps(result)
    end
    result | root_sources | selection.each_osdep_package_name.to_set
end

#all_selected_source_packages(validate = true) ⇒ Array<PackageDefinition>

Returns the set of source packages that are selected by the layout

Returns:



907
908
909
# File 'lib/autoproj/manifest.rb', line 907

def all_selected_source_packages(validate = true)
    default_packages(validate).all_selected_source_packages(self)
end

#cache_ignored_package_namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The list of packages that are ignored

Do not use directly, use #ignored? instead



283
284
285
286
287
288
289
290
291
292
# File 'lib/autoproj/manifest.rb', line 283

def cache_ignored_package_names
    return @ignored_package_names if @ignored_package_names

    @ignored_package_names = each_package_definition.find_all do |pkg|
        ignored_packages.any? do |l|
            (pkg.name == l) ||
                ((pkg_set = metapackages[l]) && pkg_set.include?(pkg))
        end
    end.map(&:name).to_set
end

#clear_exclusionsObject

Removes all registered exclusions



345
346
347
348
# File 'lib/autoproj/manifest.rb', line 345

def clear_exclusions
    automatic_exclusions.clear
    manifest_exclusions.clear
end

#clear_ignoredObject

Removes all registered ignored packages



313
314
315
316
# File 'lib/autoproj/manifest.rb', line 313

def clear_ignored
    invalidate_ignored_package_names
    ignored_packages.clear
end

#clear_layoutObject

Make an empty layout

Unless the default layout (that you can get with #remove_layout), this means that no package is selected by default



103
104
105
106
# File 'lib/autoproj/manifest.rb', line 103

def clear_layout
    @has_layout = true
    normalized_layout.clear
end

#compute_normalized_layout(result, layout_level, layout_data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compute a layout structure that is normalized



955
956
957
958
959
960
961
962
963
964
965
966
967
# File 'lib/autoproj/manifest.rb', line 955

def compute_normalized_layout(result, layout_level, layout_data)
    layout_data.each do |value|
        if value.kind_of?(Hash)
            subname, subdef = value.find { true }
            if subdef
                compute_normalized_layout(result, "#{layout_level}#{subname}/", subdef)
            end
        else
            result[value] = layout_level
        end
    end
    result
end

#compute_revdepsObject

Compute the reverse dependencies of all the packages

The return value is a hash of the form

package_name => [list_of_packages_that_depend_on_package_name]

Where the list is given as a list of package names as well



1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
# File 'lib/autoproj/manifest.rb', line 1199

def compute_revdeps
    result = Hash.new { |h, k| h[k] = Set.new }
    each_autobuild_package do |pkg|
        pkg.dependencies.each do |pkg_name|
            result[pkg_name] << pkg.name
        end
        pkg.optional_dependencies.each do |pkg_name|
            result[pkg_name] << pkg.name
        end
        pkg.os_packages.each do |pkg_name|
            result[pkg_name] << pkg.name
        end
    end
    result
end

#default_packages(validate = true) ⇒ Object

Returns the set of packages that should be built if the user does not specify any on the command line



937
938
939
940
941
942
943
944
945
946
947
948
949
950
# File 'lib/autoproj/manifest.rb', line 937

def default_packages(validate = true)
    if has_layout?
        layout_packages(validate)
    else
        result = PackageSelection.new
        all_package_names.each do |pkg_name|
            package_type, package_name = resolve_single_package_name(pkg_name).first
            next if excluded?(package_name) || ignored?(package_name)

            result.select(package_name, package_name, osdep: (package_type == :osdeps))
        end
        result
    end
end

#definition_package_set(name) ⇒ Object

Deprecated.

use #find_package_definition(pkg_name).package_set

instead



501
502
503
504
# File 'lib/autoproj/manifest.rb', line 501

def definition_package_set(name)
    Autoproj.warn_deprecated __method__, "use #package_definition_by_name(name).package_set instead"
    package_definition_by_name(name).package_set
end

#definition_source(name) ⇒ Object

Deprecated.

use #find_package_definition(pkg_name).package_set

instead



494
495
496
497
# File 'lib/autoproj/manifest.rb', line 494

def definition_source(name)
    Autoproj.warn_deprecated __method__, "use #package_definition_by_name(name).package_set instead"
    package_definition_by_name(name).package_set
end

#each_autobuild_package {|pkg| ... } ⇒ Object

Lists the autobuild objects for all defined packages

Yield Parameters:

  • pkg (Autobuild::Package)


543
544
545
546
547
# File 'lib/autoproj/manifest.rb', line 543

def each_autobuild_package
    return enum_for(__method__) unless block_given?

    each_package_definition { |pkg| yield(pkg.autobuild) }
end

#each_excluded_packageObject

Enumerates the package names of all ignored packages



336
337
338
339
340
341
342
# File 'lib/autoproj/manifest.rb', line 336

def each_excluded_package
    return enum_for(__method__) unless block_given?

    each_autobuild_package do |pkg|
        yield(pkg) if excluded?(pkg.name)
    end
end

#each_ignored_package {|| ... } ⇒ Object

Enumerates the package names of all ignored packages

Yield Parameters:

  • (Autobuild::Package)


304
305
306
307
308
309
310
# File 'lib/autoproj/manifest.rb', line 304

def each_ignored_package
    return enum_for(__method__) unless block_given?

    cache_ignored_package_names.each do |pkg_name|
        yield(find_autobuild_package(pkg_name))
    end
end

#each_metapackage(&block) ⇒ Object

Lists all defined metapackages

Autoproj defines one metapackage per package set, which by default includes all the packages that the package set defines.



829
830
831
# File 'lib/autoproj/manifest.rb', line 829

def each_metapackage(&block)
    metapackages.each_value(&block)
end

#each_package_definition {|pkg| ... } ⇒ Object

Lists all defined packages

Yield Parameters:



534
535
536
537
538
# File 'lib/autoproj/manifest.rb', line 534

def each_package_definition(&block)
    return enum_for(__method__) unless block_given?

    packages.each_value(&block)
end

#each_package_set {|| ... } ⇒ Object

Lists all package sets defined in this manifest, including the package sets that are auto-imported

Note that this can be called only after the package sets got loaded with load_package_sets

Yield Parameters:



448
449
450
# File 'lib/autoproj/manifest.rb', line 448

def each_package_set(&block)
    @package_sets.each(&block)
end

#each_remote_package_setObject

Like #each_package_set, but filters out local package sets



433
434
435
436
437
438
439
# File 'lib/autoproj/manifest.rb', line 433

def each_remote_package_set
    return enum_for(__method__) unless block_given?

    each_package_set do |pkg_set|
        yield(pkg_set) unless pkg_set.local?
    end
end

#exclude_package(package_name, reason) ⇒ Object

Exclude package_name from the build. reason is a string describing why the package is to be excluded.



366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/autoproj/manifest.rb', line 366

def exclude_package(package_name, reason)
    package = validate_package_name_argument(
        package_name, require_existing: false
    )
    if (meta = find_metapackage(package))
        meta.each_package do |pkg|
            automatic_exclusions[pkg.name] =
                "#{meta.name} is an excluded metapackage, "\
                "and it includes #{pkg.name}: #{reason}"
        end
    else
        automatic_exclusions[package] = reason
    end
end

#excluded?(package_name) ⇒ Boolean

True if the given package should not be built and its dependencies should be considered as met.

This is useful to avoid building packages that are of no use for the user.

Returns:

  • (Boolean)


323
324
325
326
327
328
329
330
331
332
333
# File 'lib/autoproj/manifest.rb', line 323

def excluded?(package_name)
    package_name = validate_package_name_argument(package_name)

    if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)
        true
    elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }
        true
    else
        false
    end
end

#excluded_in_manifest?(package_name) ⇒ Boolean

Tests whether the given package is excluded in the manifest

Returns:

  • (Boolean)


382
383
384
385
386
387
388
389
390
391
# File 'lib/autoproj/manifest.rb', line 382

def excluded_in_manifest?(package_name)
    package_name = validate_package_name_argument(package_name)
    manifest_exclusions.any? do |matcher|
        if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)
            true
        else
            Regexp.new(matcher) === package_name
        end
    end
end

#exclusion_reason(package_name) ⇒ Object

If package_name is excluded from the build, returns a string that tells why. Otherwise, returns nil

Packages can either be excluded because their name is listed in the exclude_packages section of the manifest, or because they are disabled on this particular operating system.



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/autoproj/manifest.rb', line 399

def exclusion_reason(package_name)
    package_name = validate_package_name_argument(package_name)
    if (message = automatic_exclusions[package_name])
        return message
    end

    unless explicitely_selected_in_layout?(package_name)
        manifest_exclusions.each do |matcher|
            if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)
                return "#{pkg_set.name} is a metapackage listed in the exclude_packages section of the manifest, and it includes #{package_name}"
            elsif Regexp.new(matcher) === package_name
                return "#{package_name} is listed in the exclude_packages section of the manifest"
            end
        end
    end
    nil
end

#expand_package_selection(selection, filter: true) ⇒ PackageSelection, Array<String>

Normalizes package selection strings into a PackageSelection object

Parameters:

  • selection (Array<String>)

    the package selection strings. For source packages, it can either be the package name, a package set name, or a prefix of the package’s source directory. For osdeps, it has to be the plain package name

Returns:



1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
# File 'lib/autoproj/manifest.rb', line 1125

def expand_package_selection(selection, filter: true)
    result = PackageSelection.new

    all_selected_packages = self.all_selected_packages.to_set
    all_source_package_names = all_package_names
    all_osdeps_package_names = os_package_resolver.all_package_names
    selection.each do |sel|
        match_pkg_name = Regexp.new(Regexp.quote(sel))
        all_matches = Array.new
        each_metapackage do |meta_pkg|
            if meta_pkg.name =~ match_pkg_name
                all_matches << [meta_pkg.name, meta_pkg.name == sel]
            end
        end
        all_source_package_names.each do |pkg_name|
            pkg = find_autobuild_package(pkg_name)
            if pkg.name =~ match_pkg_name
                all_matches << [pkg.name, pkg.name == sel]
            elsif "#{sel}/".start_with?("#{pkg.srcdir}/")
                all_matches << [pkg.name, true]
            elsif pkg.respond_to?(:builddir) && "#{sel}/".start_with?("#{pkg.builddir}/")
                all_matches << [pkg.name, true]
            elsif pkg.srcdir.start_with?(sel) && all_selected_packages.include?(pkg.name)
                all_matches << [pkg.name, false]
            end
        end
        all_osdeps_package_names.each do |pkg_name|
            if pkg_name =~ match_pkg_name
                all_matches << [pkg_name, pkg_name == sel]
            end
        end

        exact_matches, partial_matches =
            all_matches.partition { |_, exact_match| exact_match }
        selected_partial_matches, not_selected_partial_matches =
            partial_matches.partition { |pkg_name, _| all_selected_packages.include?(pkg_name) }
        not_selected_partial_matches.clear if result.has_match_for?(sel)

        matches =
            [exact_matches, selected_partial_matches, not_selected_partial_matches]
            .find { |m| !m.empty? }

        matches&.each do |pkg_name, _|
            update_selection(result, sel, pkg_name, true)
        end
    end

    result.filter_excluded_and_ignored_packages(self) if filter

    nonresolved = selection - result.matches.keys
    [result, nonresolved]
end

#explicitely_selected_in_layout?(package_name) ⇒ Boolean

Returns true if the given package name has been explicitely added to the layout (not indirectly)

Parameters:

  • package_name (String)

Returns:

  • (Boolean)


422
423
424
425
# File 'lib/autoproj/manifest.rb', line 422

def explicitely_selected_in_layout?(package_name)
    package_name = package_name.to_str
    normalized_layout.has_key?(package_name)
end

#find_autobuild_package(name) ⇒ Autobuild::Package?

The autobuild description of a package by its name

Parameters:

  • name (String, #name)

    the package name

Returns:

  • (Autobuild::Package, nil)


527
528
529
# File 'lib/autoproj/manifest.rb', line 527

def find_autobuild_package(name)
    find_package_definition(name)&.autobuild
end

#find_metapackage(name) ⇒ Object



782
783
784
# File 'lib/autoproj/manifest.rb', line 782

def find_metapackage(name)
    @metapackages[name.to_s]
end

#find_package_definition(name) ⇒ PackageDefinition?

The autoproj description of a package by its name

Parameters:

  • name (String, #name)

    the package name

Returns:



488
489
490
# File 'lib/autoproj/manifest.rb', line 488

def find_package_definition(name)
    packages[validate_package_name_argument(name, require_existing: false)]
end

#find_package_set(name) ⇒ Object

Returns a package set from its name



638
639
640
# File 'lib/autoproj/manifest.rb', line 638

def find_package_set(name)
    each_package_set.find { |set| set.name == name }
end

#has_package?(name) ⇒ Boolean

Checks if there is a package with a given name

Parameters:

  • name (String)

    the name of a source or osdep package

Returns:

  • (Boolean)


628
629
630
# File 'lib/autoproj/manifest.rb', line 628

def has_package?(name)
    packages.has_key?(name) || os_package_resolver.include?(name)
end

#has_package_set?(name) ⇒ Boolean

Checks if there is a package set with a given name

Returns:

  • (Boolean)


633
634
635
# File 'lib/autoproj/manifest.rb', line 633

def has_package_set?(name)
    !!find_package_set(name)
end

#has_remote_package_sets?Boolean

True if some of the sources are remote sources

Returns:

  • (Boolean)


428
429
430
# File 'lib/autoproj/manifest.rb', line 428

def has_remote_package_sets?
    each_remote_package_set.any? { true }
end

#ignore_package(package) ⇒ Object

Call this method to ignore a specific package. It must not be used in init.rb, as the manifest is not yet loaded then



264
265
266
267
# File 'lib/autoproj/manifest.rb', line 264

def ignore_package(package)
    invalidate_ignored_package_names
    @ignored_packages << validate_package_name_argument(package, require_existing: false)
end

#ignored?(package) ⇒ Boolean

True if the given package should not be built, with the packages that depend on him have this dependency met.

This is useful if the packages are already installed on this system.

Returns:

  • (Boolean)


273
274
275
276
# File 'lib/autoproj/manifest.rb', line 273

def ignored?(package)
    package_name = validate_package_name_argument(package)
    cache_ignored_package_names.include?(package_name)
end

#importer_definition_for(package, mainline: nil, require_existing: true, package_set: nil) ⇒ VCSDefinition

Returns the VCS definition object.

Parameters:

  • package (PackageDefinition)

    the name of the package to be resolved

  • mainline (PackageSet, nil) (defaults to: nil)

    the reference package set for which we want to compute the importer definition. Pass package.package_set if you want to avoid applying any override

Returns:



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/autoproj/manifest.rb', line 556

def importer_definition_for(package, _package_set = nil, mainline: nil, require_existing: true, package_set: nil)
    if _package_set
        Autoproj.warn_deprecated "calling #importer_definition_for with the package set as second argument is deprecated, use the package_set: keyword argument instead"
        require_existing = false
    end
    package_name = validate_package_name_argument(package, require_existing: require_existing)
    package_set = _package_set || package_set || package.package_set
    mainline = package_set if mainline == true

    # package_name is already validated, do not re-validate
    vcs = package_set.importer_definition_for(package_name, require_existing: false)

    package_sets = each_package_set.to_a.dup
    index = package_sets.find_index(package_set)
    unless index
        raise RuntimeError, "found inconsistency: package #{package_name} is not in a package set of #{self}"
    end

    return vcs if package_sets[0, index + 1].include?(mainline)

    # Then apply the overrides
    package_sets[(index + 1)..-1].inject(vcs) do |updated_vcs, pkg_set|
        updated_vcs = pkg_set.overrides_for(package_name, updated_vcs, require_existing: false)
        return updated_vcs if pkg_set == mainline

        updated_vcs
    end
end

#initialize_from_hash(data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize the manifest from a hash, as loaded from a manifest file



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/autoproj/manifest.rb', line 77

def initialize_from_hash(data)
    @data = data
    @ignored_packages |= (data["ignored_packages"] || Set.new).to_set
    @ignored_packages |= (data["ignore_packages"] || Set.new).to_set
    invalidate_ignored_package_names
    @manifest_exclusions |= (data["exclude_packages"] || Set.new).to_set

    normalized_layout = Hash.new
    compute_normalized_layout(
        normalized_layout,
        "/",
        data["layout"] || Hash.new
    )
    @normalized_layout = normalized_layout
    @has_layout = !!data["layout"]

    if data["constants"]
        @constant_definitions =
            Autoproj.resolve_constant_definitions(data["constants"])
    end
end

#invalidate_ignored_package_namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Invalidate the cache computed by #cache_ignored_package_names



297
298
299
# File 'lib/autoproj/manifest.rb', line 297

def invalidate_ignored_package_names
    @ignored_package_names = nil
end

#layout_packages(validate = true) ⇒ PackageSelection

Returns the packages selected in this manifest’s layout

Returns:



836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
# File 'lib/autoproj/manifest.rb', line 836

def layout_packages(validate = true)
    result = PackageSelection.new
    Autoproj.in_file(file) do
        normalized_layout.each_key do |pkg_or_set|
            weak =
                if (meta = metapackages[pkg_or_set])
                    meta.weak_dependencies?
                end

            resolve_package_name(pkg_or_set).each do |pkg_type, pkg_name|
                result.select(
                    pkg_or_set, pkg_name,
                    osdep: (pkg_type == :osdeps),
                    weak: weak
                )
            end
        rescue PackageNotFound => e
            raise e, "#{pkg_or_set}, which is selected in the layout, "\
                     "is unknown: #{e.message}", e.backtrace
        end
    end

    begin
        result.filter_excluded_and_ignored_packages(self)
    rescue ExcludedSelection => e
        if validate
            raise e, "#{e.selection}, which is selected in the layout, cannot be built: #{e.message}", e.backtrace
        end
    end
    result
end

#load(file) ⇒ Object

Load the manifest data contained in file



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/autoproj/manifest.rb', line 54

def load(file)
    unless File.exist?(file)
        raise ConfigError.new(File.dirname(file)),
              "expected an autoproj configuration in #{File.dirname(file)}, "\
              "but #{file} does not exist"
    end

    data = Autoproj.in_file(file, Autoproj::YAML_LOAD_ERROR) do
        YAML.safe_load(File.read(file)) || {}
    end

    if data["layout"]&.member?(nil)
        Autoproj.warn "There is an empty entry in your layout in #{file}. All empty entries are ignored."
        data["layout"] = data["layout"].compact
    end

    @file = file
    initialize_from_hash(data)
end

#load_all_available_package_manifestsObject



1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
# File 'lib/autoproj/manifest.rb', line 1050

def load_all_available_package_manifests
    # Load the manifest for packages that are already present on the
    # file system
    each_package_definition do |pkg|
        if pkg.checked_out?
            begin
                load_package_manifest(pkg)
            rescue Interrupt
                raise
            rescue Exception => e
                Autoproj.warn "cannot load package manifest for #{pkg.name}: #{e.message}"
            end
        end
    end
end

#load_importers(mainline: nil) ⇒ Object

Sets up the package importers based on the information listed in the source’s source.yml

The priority logic is that we take the package sets one by one in the order listed in the autoproj main manifest, and first come first used.

A set that defines a particular package in its autobuild file must provide the corresponding VCS line in its source.yml file. However, it is possible for a source that does not define a package to override the VCS

In other words: if package P is defined by source S1, and source S0 imports S1, then

* S1 must have a VCS line for P
* S0 can have a VCS line for P, which would override the one defined
  by S1


601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# File 'lib/autoproj/manifest.rb', line 601

def load_importers(mainline: nil)
    packages.each_value do |pkg|
        package_mainline =
            if mainline == true
                pkg.package_set
            else
                mainline
            end
        vcs = importer_definition_for(pkg, mainline: package_mainline)

        if vcs.none?
            if pkg.package_set.importer_definition_for(pkg).none?
                if (pkg.package_set != main_package_set) || !File.exist?(pkg.autobuild.srcdir)
                    raise ConfigError.new, "package set #{pkg.package_set.name} defines the package '#{pkg.name}', but does not provide a version control definition for it"
                end
            end
        end

        pkg.vcs = vcs
        pkg.autobuild.importer = vcs.create_autobuild_importer
    end
end

#load_package_manifest(pkg) ⇒ Object

Loads the package’s manifest.xml file for the current package

Right now, the absence of a manifest makes autoproj only issue a warning. This will later be changed into an error.



997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/autoproj/manifest.rb', line 997

def load_package_manifest(pkg)
    if pkg.respond_to?(:to_str)
        pkg_definition = find_package_definition(pkg)
        unless pkg_definition
            raise ArgumentError, "#{pkg} is not a known package in #{self}"
        end

        pkg = pkg_definition
    end
    package = pkg.autobuild
    package_set = pkg.package_set

    # Look for the package's manifest.xml, but fallback to a manifest in
    # the package set if present
    if package.use_package_xml? && package.checked_out?
        manifest_path = File.join(package.srcdir, "package.xml")
        raise NoPackageXML.new(package.srcdir), "#{package.name} from "\
                                                "#{package_set.name} has use_package_xml set, but the package has "\
                                                "no package.xml file" unless File.file?(manifest_path)

        manifest = PackageManifest.load(package, manifest_path,
                                        ros_manifest: true,
                                        condition_context: @ws.env)
    else
        manifest_paths = [File.join(package.srcdir, "manifest.xml")]
        if package_set.local_dir
            manifest_paths << File.join(
                package_set.local_dir, "manifests", "#{package.name}.xml"
            )
        end
        manifest_path = manifest_paths.find do |path|
            File.file?(path)
        end
        if manifest_path
            manifest = PackageManifest.load(package, manifest_path,
                                            ros_manifest: false,
                                            condition_context: @ws.config)
        end
    end

    if manifest
        pkg.autobuild.description = manifest
    else
        Autoproj.warn "#{package.name} from #{package_set.name} "\
                      "does not have a manifest"
    end

    pkg.apply_dependencies_from_manifest
    # #description is initialized with a null package manifest
    # return it even if we haven't overriden it
    pkg.autobuild.description
end

#main_package_setObject

The root package set, which represents the workspace itself



655
656
657
# File 'lib/autoproj/manifest.rb', line 655

def main_package_set
    each_package_set.find(&:main?)
end

#metapackage(name) ⇒ Metapackage #metapackage(name, *packages) ⇒ Metapackage

Add packages to a metapackage, creating the metapackage if it does not exist

Overloads:

  • #metapackage(name) ⇒ Metapackage

    Create a metapackage

    Returns:

  • #metapackage(name, *packages) ⇒ Metapackage

    Add packages to a new or existing metapackage

    Parameters:

    • name (String)

      the name of the metapackage. If it already exists, the packages will be added to it.

    • packages (String)

      list of package names to be added to the metapackage

    Returns:



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
# File 'lib/autoproj/manifest.rb', line 803

def metapackage(name, *packages, &block)
    meta = (@metapackages[name.to_s] ||= Metapackage.new(name))
    packages.each do |arg|
        if !arg.respond_to?(:to_str)
            meta.add(arg)
        elsif (pkg = find_autobuild_package(arg))
            meta.add(pkg)
        elsif (pkg_set = find_metapackage(arg))
            pkg_set.each_package do |pkg_in_set|
                meta.add(pkg_in_set)
            end
        elsif os_package_resolver.has?(arg)
            raise ArgumentError, "cannot specify the osdep #{arg} as an element of a metapackage"
        else
            raise PackageNotFound, "cannot find a package called #{arg}"
        end
    end

    meta.instance_eval(&block) if block
    meta
end

#move_package(package_name, new_dir) ⇒ Object

Moves the given package name from its current subdirectory to the provided one.

For instance, for a package called drivers/xsens_imu

move("drivers/xsens_imu", "data_acquisition")

will move the package into data_acquisition/xsens_imu



1188
1189
1190
# File 'lib/autoproj/manifest.rb', line 1188

def move_package(package_name, new_dir)
    moved_packages[package_name] = File.join(new_dir, File.basename(package_name))
end

#package(name) ⇒ Object

Deprecated.


507
508
509
510
# File 'lib/autoproj/manifest.rb', line 507

def package(name)
    Autoproj.warn_deprecated "Manifest#package is deprecated, use #package_definition_by_name instead"
    find_package_definition(name)
end

#package_definition_by_name(name) ⇒ Object

Resolve a package definition by name

Unlike #find_package_definition, raise if the package does not exist



515
516
517
518
519
520
521
# File 'lib/autoproj/manifest.rb', line 515

def package_definition_by_name(name)
    unless (pkg = find_package_definition(name))
        raise ArgumentError, "no package defined named '#{name}'"
    end

    pkg
end

#package_enabled?(name, validate = true) ⇒ Boolean

Returns true if name is a valid package and is included in the build

If validate is true, the method will raise ArgumentError if the package does not exists.

If it is false, the method will simply return false on non-defined packages

Returns:

  • (Boolean)


886
887
888
889
# File 'lib/autoproj/manifest.rb', line 886

def package_enabled?(name, validate = true)
    Autoproj.warn_deprecated "#package_enabled? and #package_selected? were broken in autoproj v1, and there are usually other ways to get the same effect (as e.g. splitting package sets). Feel free to contact the autoproj developers if you have a use case that demands this functionality. For now, this method returns true for backward compatibility reasons."
    true
end

#package_selected?(name, validate = true) ⇒ Boolean

Returns true if name is a valid package and is neither excluded from the build, nor ignored from the build

If validate is true, the method will raise ArgumentError if the package does not exists.

If it is false, the method will simply return false on non-defined packages

Returns:

  • (Boolean)


899
900
901
902
# File 'lib/autoproj/manifest.rb', line 899

def package_selected?(name, validate = true)
    Autoproj.warn_deprecated "#package_enabled? and #package_selected? were broken in autoproj v1, and there are usually other ways to get the same effect (as e.g. splitting package sets). Feel free to contact the autoproj developers if you have a use case that demands this functionality. For now, this method returns true for backward compatibility reasons."
    true
end

#package_set(name) ⇒ PackageSet

The PackageSet object for the given package set

Returns:

Raises:

  • (ArgumentError)

    if none exists with that name



646
647
648
649
650
651
652
# File 'lib/autoproj/manifest.rb', line 646

def package_set(name)
    unless (set = find_package_set(name))
        raise ArgumentError, "no package set called #{name} exists"
    end

    set
end

#register_package(package, block = nil, package_set = main_package_set, file = nil) ⇒ PackageDefinition

Register a new package

Parameters:

  • package (Autobuild::Package)
  • block (#call, nil) (defaults to: nil)

    a setup block

  • package_set (PackageSet) (defaults to: main_package_set)

    the package set that defines the package

  • file (String) (defaults to: nil)

    the file in which the package is defined

Returns:



474
475
476
477
478
479
480
481
482
# File 'lib/autoproj/manifest.rb', line 474

def register_package(package, block = nil, package_set = main_package_set, file = nil)
    invalidate_ignored_package_names
    pkg = PackageDefinition.new(package, package_set, file)
    pkg.add_setup_block(block) if block
    @packages[package.name] = pkg
    metapackage pkg.package_set.name, pkg.autobuild
    metapackage "#{pkg.package_set.name}.all", pkg.autobuild
    pkg
end

#register_package_set(pkg_set) ⇒ Object

Registers a new package set

Parameters:



460
461
462
463
464
465
# File 'lib/autoproj/manifest.rb', line 460

def register_package_set(pkg_set)
    invalidate_ignored_package_names
    metapackage(pkg_set.name)
    metapackage("#{pkg_set.name}.all")
    @package_sets << pkg_set
end

#remove_layoutObject

Remove the layout

Unlike #clear_layout, this means that all defined source packages will be selected by default



112
113
114
115
# File 'lib/autoproj/manifest.rb', line 112

def remove_layout
    @has_layout = false
    normalized_layout.clear
end

#remove_osdeps_overrides(osdep_name) ⇒ Object

Remove any OSDeps override that has previously been added with #add_osdeps_overrides



1091
1092
1093
# File 'lib/autoproj/manifest.rb', line 1091

def remove_osdeps_overrides(osdep_name)
    @osdeps_overrides.delete(osdeps_name.to_s)
end

#reset_package_setsObject

Reset the list of package sets



453
454
455
# File 'lib/autoproj/manifest.rb', line 453

def reset_package_sets
    @package_sets.clear
end

#resolve_package_name(name, include_unavailable: false) ⇒ nil, Array

Resolves a name into a set of source and osdep packages

name of a source package, an osdep package or a metapackage (e.g. package set).

Parameters:

  • name (String)

    the name to be resolved. It can either be the

Returns:

  • (nil, Array)

    either nil if there is no such osdep, or a list of (type, package_name) pairs where type is either :package or :osdeps and package_name the corresponding package name

Raises:

  • (PackageNotFound)

    if the given package name cannot be resolved into a package. If #accept_unavailable_osdeps? is false (the default), the exception will be raised if the package is known to be an osdep, but it is not available on the local operating system (as defined by #os_package_resolver), and there has been no source fallback defined with #add_osdeps_overrides. If true, it will return such a package as an osdep.



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
# File 'lib/autoproj/manifest.rb', line 675

def resolve_package_name(name, include_unavailable: false)
    pkg_names =
        if (pkg_set = find_metapackage(name))
            pkg_set.each_package.map(&:name)
        else
            [name.to_str]
        end

    result = []
    pkg_names.each do |pkg|
        result.concat(resolve_single_package_name(pkg))
    rescue PackageUnavailable => e
        if include_unavailable
            result.concat([[:osdeps, pkg]])
        else
            raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
        end
    rescue PackageNotFound => e
        raise e, "cannot resolve #{pkg}: #{e}", e.backtrace
    end
    result
end

#resolve_package_name_as_osdep(name) ⇒ nil, Array

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resolve a potential osdep name, either as the osdep itself, or as source packages that are used as osdep override

Returns:

  • (nil, Array)

    either nil if there is no such osdep, or a list of (type, package_name) pairs where type is either :package or :osdep and package_name the corresponding package name

Raises:

  • PackageNotFound if the given package name cannot be resolved into a package. If #accept_unavailable_osdeps? is false (the default), the exception will be raised if the package is known to be an osdep, but it is not available on the local operating system (as defined by #os_package_resolver), and there has been no source fallback defined with #add_osdeps_overrides. If true, it will return it as an osdep.



753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/autoproj/manifest.rb', line 753

def resolve_package_name_as_osdep(name)
    osdeps_availability = os_package_resolver.availability_of(name)
    if osdeps_availability == OSPackageResolver::NO_PACKAGE
        raise PackageNotFound, "#{name} is not an osdep"
    end

    # There is an osdep definition for this package, check the
    # overrides
    osdeps_available =
        (osdeps_availability == OSPackageResolver::AVAILABLE) ||
        (osdeps_availability == OSPackageResolver::IGNORE)
    osdeps_overrides = self.osdeps_overrides[name]
    if osdeps_overrides && (!osdeps_available || osdeps_overrides[:force])
        osdeps_overrides[:packages].inject([]) do |result, src_pkg_name|
            result.concat(resolve_package_name_as_source_package(src_pkg_name))
        end.uniq
    elsif !osdeps_available && (pkg = find_autobuild_package(name))
        [[:package, pkg.name]]
    elsif osdeps_available || accept_unavailable_osdeps?
        [[:osdeps, name]]
    elsif osdeps_availability == OSPackageResolver::WRONG_OS
        raise PackageUnavailable, "#{name} is an osdep, but it is not available for this operating system (#{os_package_resolver.operating_system})"
    elsif osdeps_availability == OSPackageResolver::UNKNOWN_OS
        raise PackageUnavailable, "#{name} is an osdep, but the local operating system is unavailable"
    elsif osdeps_availability == OSPackageResolver::NONEXISTENT
        raise PackageUnavailable, "#{name} is an osdep, but it is explicitely marked as 'nonexistent' for this operating system (#{os_package_resolver.operating_system})"
    end
end

#resolve_package_name_as_source_package(name) ⇒ nil, Array

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resolve a package name that is assumed to be a source package

Parameters:

  • name (String)

    the name to be resolved

Returns:

  • (nil, Array)

    either nil if there is no such osdep, or a list of (type, package_name) pairs where type is either :package or :osdep and package_name the corresponding package name

Raises:

  • PackageNotFound if the given package name cannot be resolved into a package



729
730
731
732
733
734
735
736
# File 'lib/autoproj/manifest.rb', line 729

def resolve_package_name_as_source_package(name)
    unless (pkg = find_autobuild_package(name))
        raise PackageNotFound,
              "cannot resolve #{name}: it is neither a package nor an osdep"
    end

    [[:package, pkg.name]]
end

#resolve_single_package_name(name) ⇒ nil, Array

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resolves a package name, where name cannot be resolved as a metapackage

This is a helper method for #resolve_package_name. Do not use directly

Returns:

  • (nil, Array)

    either nil if there is no such osdep, or a list of (type, package_name) pairs where type is either :package or :osdeps and package_name the corresponding package name



709
710
711
712
713
714
715
716
717
# File 'lib/autoproj/manifest.rb', line 709

def resolve_single_package_name(name)
    resolve_package_name_as_osdep(name)
rescue PackageNotFound => osdep_error
    begin
        resolve_package_name_as_source_package(name)
    rescue PackageNotFound
        raise osdep_error, "#{osdep_error} and it cannot be resolved as a source package"
    end
end

#reuse(workspace_root) ⇒ Object

Declare that we should reuse the autoproj installation present at the given path



1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
# File 'lib/autoproj/manifest.rb', line 1217

def reuse(workspace_root)
    return if reused_installations.any? { |mnf| mnf.path == workspace_root }

    manifest = InstallationManifest.from_workspace_root(workspace_root)
    manifest.load
    @reused_installations << manifest
    manifest.each do |pkg|
        ignore_package pkg.name
    end
end

#update_selection(selection, user_selection_string, name, weak) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Helper for #expand_package_selection



1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
# File 'lib/autoproj/manifest.rb', line 1100

def update_selection(selection, user_selection_string, name, weak)
    source_packages = Array.new
    osdeps = Array.new
    resolve_package_name(name).each do |type, resolved_name|
        if type == :package
            source_packages << resolved_name
        else
            osdeps << resolved_name
        end
    end
    unless source_packages.empty?
        selection.select(user_selection_string, source_packages, osdep: false, weak: weak)
    end
    unless osdeps.empty?
        selection.select(user_selection_string, osdeps, osdep: true, weak: weak)
    end
end

#validate_metapackage_in_self(metapackage) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validate that the given metapackage object is defined in self



219
220
221
222
223
# File 'lib/autoproj/manifest.rb', line 219

def validate_metapackage_in_self(metapackage)
    if find_metapackage(metapackage.name) != metapackage
        raise UnregisteredPackage, "#{metapackage.name} is not registered on #{self}"
    end
end

#validate_package_in_self(package) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validate that the given package object is defined in self



228
229
230
231
232
233
234
# File 'lib/autoproj/manifest.rb', line 228

def validate_package_in_self(package)
    if !package.respond_to?(:autobuild)
        raise ArgumentError, "expected a PackageDefinition object but got an Autobuild package"
    elsif find_package_definition(package.name) != package
        raise UnregisteredPackage, "#{package.name} is not registered on #{self}"
    end
end

#validate_package_name_argument(package, require_existing: true) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Massage an argument that should be interpreted as a package name



239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/autoproj/manifest.rb', line 239

def validate_package_name_argument(package, require_existing: true)
    if package.respond_to?(:name)
        validate_package_in_self(package)
        package.name
    else
        package = package.to_str
        if require_existing && !has_package?(package)
            raise PackageNotFound, "no package named #{package} in #{self}"
        end

        package
    end
end

#validate_package_set_in_self(package_set) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validate that the given package object is defined in self



256
257
258
259
260
# File 'lib/autoproj/manifest.rb', line 256

def validate_package_set_in_self(package_set)
    if find_package_set(package_set.name) != package_set
        raise UnregisteredPackageSet, "#{package_set.name} is not registered on #{self}"
    end
end

#whereis(package_name) ⇒ String

Returns the level of the layout into which of a certain package would be selected

Returns:

  • (String)


973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
# File 'lib/autoproj/manifest.rb', line 973

def whereis(package_name)
    package_name = validate_package_name_argument(package_name)

    matches = [package_name]
    if (source_package = find_package_definition(package_name))
        each_metapackage do |meta|
            matches << meta.name if meta.include?(source_package)
        end
    end

    matches.each do |name|
        if (place = normalized_layout[name])
            return place
        end
    end
    "/"
end