Menu

Using depvault

John Sutherland

Requirements

Currently, depvault requires Python 2.7. Currently only works on Unix-based machines, including OS X.

Installation

depvault uses easy_install. To install:

sudo python setup.py install

This will install the files in the needed places. The depvault executable will be placed into /urs/local/bin.

Setup

There is no real setup for depvault, other than defining where you want your repository to be. If you want to share between multiple groups, you'll have to mount a shared filesystem.
This will most likely change in the future

Definitions

  • Dependency - A group of files that are required to complete the current project. Also known as 'dep' for short.
  • Tag - A text string that is used to differentiate between variations of a dependency.
  • Variation - A different 'version' of a dependency. For example, a version of a library that has threading enabled is a variation of the library without threading.
  • Repository - An area where dependencies are stored. Also known as 'repo' for short.

Using tags

Tags are use to differentiate between variations of a dependency. A few examples of tags are "OSX" "Linux", "arm", "ppc", "threads". Multiple tags can be used to create unique variations.

When you 'put' a dependency into the repo, you will specify the tags that make a unique variation. If you specify a collection of tags that is already in the repo for this dependency, it will overwrite it.

When using 'get' to retrieve a dependency, it must match all of the tags, exactly. In other words, you can not specify "OSX, threaded" and expect to get the "OSX" version, or the "OSX, threaded, optimized".

Creating a new project/dependency

When creating a new dependency, you'll need to create a dep file. You can use any filename you wish, but the preference is to use the .dep extension.

The dep file has at least two pieces of information.

  • name: Contains the name of the project. This name will be used to find the project again when another project uses it as a dependency.
    [project]
    name = project-name
  • version: Contains the version of the project. This is a string that labels the version of the project. It goes into the project section.
    version = version-id

Optionally, there's two other pieces of information:

  • dependencies: The list of dependencies for this project. This is a comma separated list, which will point to other sections further describing the dependencies. This goes in the project section
    dependencies = libBase 
  • tags: A comma separated list of strings of the tags for this project. These tags will be applied to all variations of the project. This entry is rarely used, as all variation of the project would have these tags.
    tags = threaded, optimized
  • The dependency sections: Each dependency listed in the dependencies field will have its own section. The name of the section matches what was specified in the dependency list. In our example, you should have:
    [libBase]
    version = 1.0

Notice that you specify the version of the dependency you want.

Creating a repository

A repository is simply a place where files and directories are kept. Currently, depvault only supports Filesystem based repositories, but more area planned, like SFTP.

You can have multiple repositories, since you specify which repo you want to use on the command line.

In summary, creating a repository is as simple as creating a directory away from your development environment.

Adding a project to the repository

Once you have a dep file and a repository, you're ready to add the project to repository.

Adding a project into the repository makes it available to be used as a dependency. When you add the project, you may also specify the tags that make this build unique. Tags are not required, but highly recommended, even if its just the platform you compiled on.

Before you add the project to the repo, you should go through the 'install' process, to a clean directory within your project. I usually use "install_files". This install should put anything that you need to share with projects that depend on this dependency. Things like library files (.so, .a), and header files.

To add the project, you can use the following command line:

    depvault --add --repofilepath <path to repo> --srcdir <path to installed files> \
    --depfile <.dep filename> --tag <tag1> --tag <tag2>

Retrieving dependencies

depvault will retrieve the dependencies specified in the .dep file. It will do so recursively. This means that if projectA requires libA, and libA requires libB, performing the 'get' will retrieve both libA and libB automatically. Both libA and libB will be installed into the destination directory specified.

Tag specified on the command line will be applied to all the dependencies, recursively. So to match libA and libB, both of those must have all the tags specified on the command line.

To retrieve the dependencies, use the following:

    depvault --get --repofilepath <path to repo> --dstdir <path to install the dependencies> \
    --depfile <.dep filename> --tag <tag1> --tag <tag2>

Related

Wiki: Home

MongoDB Logo MongoDB