class Autoproj::PackageDefinition

Autoproj-specific information about a package definition

This stores the information that goes in addition to the autobuild package definitions

Attributes

autobuild[R]

@return [Autobuild::Package] the autobuild package definitins

file[R]

@return [String] path to the file that contains this package’s

definition
package_set[R]

@return [PackageSet] the package set that defined this package

setup[W]

Sets the {setup?} flag

user_blocks[R]

@return [Array<#call>] the set of blocks that should be called to

prepare the package. These are called before any operation has been
performed on the package iself.
vcs[RW]

@return [VCSDefinition] the version control information associated

with this package

Public Class Methods

new(autobuild, package_set, file) click to toggle source
# File lib/autoproj/package_definition.rb, line 34
def initialize(autobuild, package_set, file)
    @autobuild = autobuild
    @package_set = package_set
    @file = file
    @user_blocks = []
    @modes = %w[import build]
    @setup = false
    @vcs = VCSDefinition.none
end

Public Instance Methods

add_setup_block(block) click to toggle source

Registers a setup block

The block will be called when the setup phase is finished, or immediately if it is already finished (i.e. if {setup?} returns true)

@param [#call] block the block that should be registered @yieldparam [Autobuild::Package] pkg the autobuild package object @see {user_blocks}

# File lib/autoproj/package_definition.rb, line 69
def add_setup_block(block)
    user_blocks << block
    block.call(autobuild) if setup?
end
apply_dependencies_from_manifest() click to toggle source
# File lib/autoproj/package_definition.rb, line 84
def apply_dependencies_from_manifest
    manifest = autobuild.description
    manifest.each_dependency(modes) do |name, is_optional|
        if is_optional
            autobuild.optional_dependency name
        else
            autobuild.depends_on name
        end
    rescue ConfigError => e
        raise PackageNotFound.new(manifest.path),
              "manifest #{manifest.path} of #{self.name} from "\
              "#{package_set.name} lists '#{name}' as dependency, "\
              "but it is neither a normal package nor an osdeps "\
              "package. osdeps reports: #{e.message}", e.backtrace
    end
end
checked_out?() click to toggle source

Whether this package is already checked out

# File lib/autoproj/package_definition.rb, line 75
def checked_out?
    autobuild.checked_out?
end
depends_on(pkg) click to toggle source

Add another package as a dependency of this one

# File lib/autoproj/package_definition.rb, line 80
def depends_on(pkg)
    autobuild.depends_on(pkg.autobuild)
end
modes() click to toggle source

The modes in which this package will be used

Mainly used during dependency resolution to disable unneeded dependencies

@return [Array<String>]

# File lib/autoproj/package_definition.rb, line 50
def modes
    @modes + autobuild.utilities
                      .values.find_all(&:enabled?).map(&:name)
end
name() click to toggle source

The package name @return [String]

# File lib/autoproj/package_definition.rb, line 57
def name
    autobuild.name
end
setup?() click to toggle source

Whether this package is completely setup

If the package is set up, its importer as well as all target directories are properly set, and all {user_blocks} have been called.

# File lib/autoproj/package_definition.rb, line 23
def setup?
    @setup
end