Package Dependencies

Introduction

Package dependencies are a convenient way to provide a way for the end user to check his/her deployment without having to deal with extensive system tests and/or obscure runtime errors. However encoding these depedencies requires some forethought. To aid with this GPT comes with a set of typed dependencies. These dependency types make it easier for developers to define package relationships. The dependencies are detailed as part of the source code of the package. GPT automatically translates these dependencies and transfers them to the resulting binary packages. The types are as follows

Table 10.2. Source Dependency Types

Dependency TypeXML Element or AttributeDescription
Compilecompile

This is when the package requires a header, precompile definitions or other compilation information from another package.

Library Link lib_link

This is when a package contains a library that has libraries from another package that it depends on. Only direct dependencies are needed since GPT builds the entire dependency tree when doing its check.

Program Link pgm_link

This is when a package contains a program that links with libraries from another package. Only direct dependencies are needed since GPT builds the entire dependency tree when doing its check.

Runtime data_runtime, doc_runtime, pgm_runtime, or lib_runtime

Package needs something from another package in order to work in a runtime environment. The dependency needs to be expressed as a binary to binary package dependency. Can be anything from an executable to a hyperlinked document. Library dependencies should not be included here since they are already handled by dependency types mentioned above.

Setup Source_Setup_Dependency

This is when a package needs configuration files or scripts from another package. This dependency is used to seperate applications from configuration data so that these don't have to be re-configured every time the application packages are upgraded.

GPT manages these dependencies by setting up various deployment environments such as Build and Runtime to determine which dependencies should be checked. The following sections provide more detail into these environments and the dependencies they honor.

Components of a Dependency.

A typical GPT dependency has three common components. Setup and Runtime dependencies have two additional components. The components are as follows:

Dependency Type

This component dictates to GPT what deployment environment is valid for the dependency and also determines some rules when the dependency is converted from source to binary.

Package Name

This is the name of the dependent package. It is used by all of the dependency types except setup.

Version Requirements

This expresses the version compatiblity requirements of the dependent package. This is used by all of the dependency types.

Binary Package Type

This allows the dependency to be more specific about a dependent package by specifying the package type. This component is only used by runtime and setup dependencies. The other dependency types have standard package types that are automatically encoded by GPT.

Setup Package Name

This is an alternative name used by setup dependencies.

Build Dependency Types

The build dependencies are in affect when packages are being used to compile and link other software. This situation does not only occur during package building. Many packages are software development kits that allow end users to build software using packages. In this situation build dependencies are also applicable.

The compile dependency and the two linking dependencies make up the build dependency set. These dependencies are checked when building the package using gpt-build. They are also also transferred to the binary packages packages that are create from this package. The transfer is described by the following tables. This table shows how the dependency types are converted. This table shows what package types the binary dependencies are pointing and transferred to. Regeneration dependencies currently do not show up in any binary packages.

Table 10.3. Build Dependency Types

Source Build Dependency TypeResulting Binary Dependency Type
With Dynamic LinkingWith Static Linking
compileCompileCompile
lib_linkRuntime_Link and Build_LinkRegeneration and Build_Link
pgm_linkRuntime_Link and Build_LinkRegeneration and Build_Link

Table 10.4. Binary Dependency Types and Their Package Types

Binary Dependency TypeBinary Package Type That Gets The DependencyBinary Package Type Which The Dependency Points To
With Dynamic LinkingWith Static LinkingWith Dynamic LinkingWith Static Linking
Compiledevdevdevdev
Build_Linkdevdevdevdev
Runtime_Link for LibrariesrtlNONErtlNONE
Runtime_Link for ProgramspgmNONErtlNONE

Runtime Dependencies

Runtime dependencies are also expressed as source dependencies but in reality the dependencies are relationships between specific binary packages. For this reason the dependency has two pkgtype components as well as the package name and version requirements. The first package type specification is embedded in the dependency type. This package type indicates which to binary package the dependency is transfered to. The second package type further specifies the dependent package.

Setup Dependencies

Setup dependencies are used to to relate software packages to their dependent setup packages. This is a one-to-many relationship in that GPT allows for the possiblity to have multiple setup packages fulfill the same setup dependency. A setup dependency use the Setup_Name and Setup_Version to identify the dependent package rather than Package_Name and Version. Different setup packages (each with a different Package_Name and Version) can have the same Setup_Name and Version

Dependency Examples

Here are some examples that show how GPT dependencies are implemented

Table 10.5. Dependency Examples

Dependency DescriptionDependency ComponentsXML Expression
Package FOO uses headers from package FEE version 3
  1. Dependency Type=compile

  2. Package Name=FEE

  3. Version Requirement=Simple 3



<Source_Dependencies Type="compile" >
    <Dependency Name="FEE" > 
        <Version > 
            <Simple_Version Major="3" /> 
        </Version> 
    </Dependency>
</Source_Dependencies>


A library in package FOO depends on symbols from a library in package FEE version 3
  1. Dependency Type=lib_link

  2. Package Name=FEE

  3. Version Requirement=Simple 3



<Source_Dependencies Type="lib_link" >
    <Dependency Name="FEE" > 
        <Version > 
            <Simple_Version Major="3" /> 
        </Version> 
    </Dependency>
</Source_Dependencies>


Library in package FOO executes scripts from package FEE version 3
  1. Dependency Type=lib_runtime

  2. Package Name=FEE

  3. Package Type=pgm

  4. Version Requirement=Simple 3



<Source_Dependencies Type="lib_runtime" >
    <Dependency Name="FEE" Package="pgm"> 
        <Version > 
            <Simple_Version Major="3" /> 
        </Version> 
    </Dependency>
</Source_Dependencies>


Documents in package FOO hyperlink to documents in package FEE version 3
  1. Dependency Type=doc_runtime

  2. Package Name=FEE

  3. Package Type=doc

  4. Version Requirement=Simple 3



<Source_Dependencies Type="doc_runtime" >
    <Dependency Name="FEE" Package="doc"> 
        <Version > 
            <Simple_Version Major="3" /> 
        </Version> 
    </Dependency>
</Source_Dependencies>


Programs in package FOO read configuration files created by setup package with a setup name and version FOO_Setup version 3
  1. Dependency Type=Setup

  2. Setup Name=FOO_Setup

  3. Package Type=pgm

  4. Setup Version Requirement=Simple 3


<Source_Setup_Dependency PkgType="pgm">
   <Setup_Dependency Name="FOO_Setup">
       <Version>
            <Simple_Version Major="3"/>
       </Version>
   </Setup_Dependency>
</Source_Setup_Dependency>