Using Tags
Tags are user-defined labels that may be assigned to packages and are used as an
additional means of classification or sorting. For example, a 'beta' tag may be applied
to beta packages and a 'stable' tag applied to stable packages. A particular node may
then be configured to install the stable or beta packages.
Assigning tags to packages:
Tags are assigned by using Stork Trusted Packages File (tpfile) and they are assigned at
the time you add a package to your tpfile. For example, the following command adds
package1.tar.gz to your trusted packages file and applies the "beta" tag to it.
./storkutil.py --tags "beta" addfile package1.tar.gz
You can apply multiple tags to a package by separating them with a comma. For example:
./storkutil.py --tags "untested,experimental,beta" addfile package1.tar.gz
The default trusted packages files provided by stork for Planet Lab packages are already
tagged with the PlanetLabV3 and PlanetLabV4 tags as appropriate.
Requiring tags when installing packages:
Unless you specifically ask Stork to apply preferential treatment to tagged packages,
Stork will ignore your tags and install packages in the default order specified by your
trusted packages file. There are several ways to influence package installation. We'll
use the stork client (stork.py) for these examples.
'#tag' syntax
By appending a '#' and the tag name, you can tell stork that you want a
package with that specific tag. The following example will install package1 using the tag
'beta':
./stork.py package1#beta
When using the '#' syntax, the tag requirement is only applied to the package you name on
the command line. Packages required for dependency resolution are not required to have
the listed tag.
'--requiretags' command line option The '--requiretags' option specifies a list of
tags that must be met by all packages, including any that you name on the command line,
plus their dependencies. For example:
./stork.py --requiretags beta package1
Tag preference rules The previous methods of using tags have focused on controlling
what packages are allowed based on their tags. Tag preference rules are a way for you to
specify which tags you prefer using a sorting mechanism. Tag preference rules use the
format "tag1<tag2" and imply that tag1 receives a higher preference than tag2. The
following example prefers PlanetLabV4 packages instead of PlanetLabV3 packages:
./stork.py --tagprefrules "PlanetLabV4<PlanetLabV3" lynx
You may specify multiple rules separated by a comma. For example:
./stork.py --tagprefrules "PlanetLabV4<PlanetLabV3,Stable<Unstable" lynx
The first rule listed is the primary sort key and the second rule is a secondary sort
key. The preceeding example first sorts the trusted packages such that PlanetLabV4
packages are preferred to PlanetLabV3, and then sorts such that Stable packages are
preferred to Unstable packages. Packages that do not match your tag preference rules are always sorted behind packages
that do match the rule. In the proceeding examples, a package that did not contain
PlanetLabV3 or PlanetLabV4 would be pushed behind all of the PlanetLabV3 and PlanetLabV4
packages.
Mandatory Tags:
The default behavior of Stork is to not require the user to specify a tag when installing
packages. For example, if a package is tagged 'beta' and you do not specify any tag
requirements when using stork.py, then the 'beta' package is still available for
installation.
However, there are times when you may wish to specify that a package can only be
installed when a user specifically requests that tag and can never be installed by
default. This is done by using a special syntax when adding the package to the trusted
packages file. For example:
./storkutil.py --tags "+beta" addfile package1.tar.gz
When a tag is preceded by a plus sign as it is in the "+beta" in the above example, it is
considered a mandatory tag. The package may only be installed when the user specifically
requests packages with that tag using either the #tag syntax or the --requiretags command
line option.
The following two examples will install the package:
./stork.py package1#beta
./stork.py --requiretags beta package1
The following command will not install the package:
./stork.py package1
Home Top
|