Personal tools
     DOCUMENTATION

Conary:Contexts

From rPath Wiki

(Redirected from Conary:Context)
Jump to: navigation, search
Conary --> Packaging --> Build Environment --> Contexts

Contents

In Conary, a configuration context, or just context, is an association between the build environment and a Conary repository. A single context consists of:

Create Context Entries

Developers can create the text file .conaryrc in the user home directory to establish configuration contexts. The following directives can be added to apply globally to anything in the user's home directory. These are useful when working on several projects with the same repository (rBuilder) user, and would otherwise be specified separately in each context entry:

contact             <email_address_or_url>
name                <user_preferred_name>
user                *.<rBuilder_domain> <rBuilder_username> <rBuilder_password>
  • Use an email address or URL which can be used to contact you in place of <email_address_or_url>.
  • Use a preferred name, such as your first and last name, in place of <user_preferred name>.
  • Use one user line for each rBuilder domain:
    • Replace <rBuilder_domain> with the domain associated with your rBuilder system or group of systems (such as rpath.com for rBuilder Online).
    • Replace <rBuilder_username> with your rBuilder username.
    • Replace <rBuilder_password> with your rBA password.

A context entry in a configuration file comes after these global directives and starts with a context name in brackets: [example]. The lines following that line and prior to the next context entry are part of that context entry. At a minimum, a context entry in a configuration file can direct Conary to a default build label to which to commit packages and groups (buildLabel entries). Additional directives can be added as needed, such as repositoryMap and installLabelPath entries particular to the context.

The following is an example context entry for the project example:

[example]
buildLabel         example.rpath.org@corp:devel
installLabelPath   example.rpath.org@corp:devel

If projects are further organized by branches, each branch should use its own context entry (such as example-1-devel and example-1-test). Conary will use the argument provided to the context command to associate a project directory with a context entry.

Image:Bulbgraph.png   Any directives in the context entry that duplicate directives at the top of the configuration file will override those global directives for commands executed within the context (directory).

Set Up Each Context

With context entries in place, change to each corresponding project directory and use cvc context to associate the directory with its context entry. For the example context, the commands would be as follows:

$> cd ~/conary/example
$> cvc context example

Use Context Entries Beyond the Context

The following are the ways you might refer to the configuration context entries:

  • Use cvc context <context_name> in a directory so that context is used for all Conary operations in the directory.
  • Use the --context option with a Conary command to name the context in which to run the command, such as in:
    $> conary rq sample --context example
    This option overrides the current context, no matter what the current working directory.
  • Set an environment variable, CONARY_CONTEXT, naming the context you wish to use.
  • Use the context directive at the top of the Conary configuration file to specify a default context to be used.
Image:Bulbgraph.png   If the environment variable is specified, and the --context option used, the option takes precedence.

Identify the Current Context

View the context currently available in the cumulative Conary configuration using conary config with the --show-contexts option:

$> conary config --show-contexts

Use the cvc context without an argument to determine information about the current context:

$> cvc context
[example]
buildLabel                example.rpath.org@corp:devel
installLabelPath          example.rpath.org@corp:devel


From here you may wish to:

Participate in the rPath Community | Contribute to rPath Wiki | Report an issue to rPath