ups-utils

UPS Utilities


License
GPL-2.0
Install
pip install ups-utils==0.3

Documentation

python-ups-utils - Python modules and CLI utilities for working with UPS

Installation

Optional, pre-install for virtualenv-based installation:

$ virtualenv venv
$ source venv/bin/activate

This provides a self-contained installation and run-time area with some Python features (such as setuptools) that your OS may not have.

The actual installation is then done:

$ python setup.py install [--user]

You may include --user to install into your home area instead into the system area.

Alternatively, to set up for development so that any edits to the source are immediately available:

$ python setup.py develop

Glossary

The UPS ecosystem and this package makes use of some specific terms.

flavor
a platform description
qualifiers
a list of tags indicating build variant
version
a string representing a release of a software package, usually in the form vXX_YY_ZZ
product
a build of a package of a given version, flavor and qualifiers
suite
a cohesive set of products
repository
a directory on disk holding installed products
manifest
a text file listing the products in a suite
mirror
a server holding manifests and products packaged as tar files

CLI

There are a number of command line interfaces to the ups modules.

urman
UPS repository manager

urman

The urman program is divided into a number of commands. It has some general command line help as well as per-command help:

$ urman 
Usage: urman [OPTIONS] COMMAND [ARGS]...
...
$ urman init --help
Usage: urman init [OPTIONS]
...

Additional examples are given below with details omitted. See the per-command help for these details.

Query a UPS repository

You can make queries on an existing UPS repository. For example to see what products are available (similar to ups list -aK+) or which products are considered “top level” (have no other products which depend on them.

$ urman -z /products avail
$ urman -z /products top

You can also produce a tree of dependencies in “dot” format and render that into a graphic if you have the GraphViz package installed:

$ urman -z /products depend <package> <version> -f <flavor> -q <quals> -F dot -o depend.dot [--full]
$ dot -Tpng -odepend.png depend.dot
$ display depend.png

Initialize a UPS repository:

To initialize a directory as a UPS repository run:

$ urman -z /path/to/products init

Install a suite of products

You can install a suite of products based on a suite name, its version and probably a list of qualifiers:

$ urman -z /path/to/products install lbne v02_05_01 -q e5:prof [--dryrun]

Purge products based on a top product

Purging a UPS repository is done based no a given product. Only this product and any product on which it depends are subject to purging. If any candidate for purging is still needed by any remaining product it is not purged.

$ urman -z /products top
...
larsoft v02_05_01 -f Linux64bit+2.6-2.12 -z /data4/lbne/bv/pp-v02_05_01/products-urman -q e5:noifdh:prof
larsoft v02_05_01 -f Linux64bit+2.6-2.12 -z /data4/lbne/bv/pp-v02_05_01/products-urman -q e5:prof
...
$ urman -z /products purge larsoft v02_05_01 [--dryrun]

updev

Watch this space.

Configuration

TBD. A configuration file mechanism will be added to allow setting command line options defaults and other parameters.

Python

The bulk of the functionality of this package is in the form of Python modules in the ups. namespace. There is fairly good unit test coverage of these modules in the ./tests/ sub-directory. These tests can be exercised by first “installing” for development as above and adding the “nose” package and running its nosetests command

$ pip install nose
$ nosetests [-s]

Note, ./tests/test_ups_commands.py downloads the source for UPS and builds it into ./products/.

Caching

Many UPS operations are slow on any reasonably sized repository. The packages combats that with by retaining a cache of per-repository information. By default this cache resides in ~/.ups-util/cache/.

More documentation

If you are lucky there is even more documentation under ./doc/.