Personal tools
     DOCUMENTATION

Tutorial:Conary Contexts

From rPath Wiki

Jump to: navigation, search
Image:Rpath-color-16x16-1bitalpha.png  rPath Tutorials

Before stepping through this tutorial, you may want to see the following resources:

Conary package management allows any user on any Conary-based system to package software for Conary. Software that is packaged for Conary can be installed and maintained in a way that takes advantage of Conary's features.

To package software for Conary, a user must set up a context in which to perform packaging activities. A context is a directory location paired with a Conary configuration that ensures that all packaging activities at that location are associated with a particular Conary repository (usually a project in rBuilder).

To set up a context, first configure the context in a configuration file, then set up the context in the desired directory. The following sections describe these two steps.

Configure the Context

The configuration for a context is maintained in a conaryrc file, often ~/.conaryrc ("dot-conary-r-c") in a user's home directory. The configuration is a combination of a global values that apply to all contexts plus some specific values in one or more context entries. In the configuration file (~/.conaryrc), the global values are in the top lines of the file, and each context entry follows a context name in brackets (such as [example-1-devel]).

The following is an example ~/.conaryrc file. Note the contact, name, and user entries that are global, applying to all contexts, and the example-1-devel and webapp-1-devel context entries that apply to specific contexts:

contact             devuser@example.com
name                Development User
user                *.rpath.org devuser devpassword
user                *.example.com devuser

[example-1-devel]
buildLabel          example.rpath.org@corp:example-1-devel
installLabelPath    example.rpath.org@corp:example-1-devel conary.rpath.com@rpl:1

[webapp-1-devel]
buildLabel          webapp.example.com@corp:webapp-1-devel
repositoryMap       webapp.example.com http://rbuilder.example.com/repos/example
installLabelPath    webapp.example.com@corp:webapp-1-devel conary.rpath.com@rpl:1

Create a .conaryrc file in your home directory your Conary-based system, and use the previous example as a guide to configure your own contexts. Note that the example-1-devel entry points to the example project in rBuilder Online and can be modified with a different project name in place of example to apply to any rBO project.

Set up the Context as Configured

The context is "set up" by running a cvc context command in a directory designated for that context. Though the directory could be any location in the user's home directory, rPath recommends the following structure to keep your work organized:

  • A conary directory where all packaging activities can occur
  • A subdirectory under conary for each rBuilder project
  • Subdirectories under each project directory for the branches of development on that project

For example, the user setting up the contexts for example-1-devel on the Example project and webapp-1-devel on the Web Application project would have the following two directory paths to the two contexts:

~/conary/example/example-1-devel
~/conary/webapp/webapp-1-devel

The "1-devel" portion of the context name implies this is a development branch for version 1 of an appliance product. This is named to match the development label as part of the product's release management plan.

Change to the directory and run the cvc context command with the context entry name as the argument. For the previous example, change to the example-1-devel directory and use the context name example-1-devel to set up that context. Conary creates a CONARY file in the directory to track context activity. Use cvc context without an argument to show the current context-specific configuration:

$> cd ~/conary/example/example-1-devel
$> cvc context example-1-devel
$> ls
CONARY
$> cvc context
[example-1-devel]
buildLabel          example.rpath.org@corp:example-1-devel
installLabelPath    example.rpath.org@corp:example-1-devel conary.rpath.com@rpl:1