Tags:
create new tag
view all tags

Package Specifications

Entries in an LCFG package list must conform to a standard syntax. The complete specification looks like this:

prefix:arch2/name-version-release/arch1:flags[context]

Due to the Redhat heritage of our systems the concatenatation of the name-version-release elements using a hyphen is modelled on the Redhat package specification. To wrap other parts of the syntax around this string in a way which is easily parseable we have added a few extra limitations on the permitted characters for some elements (e.g. see the release element).

There are 8 possible elements for a package specification, 3 of which are required.

Required Elements

Name

This is a string of at least 1 character in length.

Version

This is a string of at least 1 character in length which MUST NOT contain a hyphen/minus sign (-).

If the string is an asterisk (*) this is interpreted as a wild-card value and the package tool will consider this to mean "use the greatest version available".

Note that we do NOT support the RPM epoch field correctly. If one is specified it will become part of the version string. This can subsequently cause problems when you try to build an RPM package file name from the available information as two RPM which are identical except for the epoch do not have different package names.

Release

This is a string of at least 1 character in length which MUST NOT contain any of hyphen/minus sign (-), forward-slash (/), colon (:) or left-square-bracket ([). These character limitations go beyond what is required for RPMs but we don't expect this to cause any problems.

If the string is an asterisk (*) this is interpreted as a wild-card value and the package tool will consider this to mean "use the greatest release available for the specified version". Not all platforms use the release field to identify package versions (e.g. OS X) in which case the recommended practice is to always use an asterisk.

Optional Elements

Architecture

This is a string of at least 1 character in length which can be formed from the characters 0-9, a-z, A-Z and underscore (_).

This is the architecture of the platform for which the package was built (e.g. x86_64 or i686).

Note that the package specification syntax allows this to be expressed in two ways, this was done to support platforms which permit multiple architecture versions of the same package (e.g. i386 on x86_64). If you use both then the second will override the first.

On Linux, if the architecture is not specified for a package then the default for the current platform will be selected, as of updaterpms version 3.5.0 this will typically match what you expect.

Note that not all platforms use the architecture (e.g. OS X).

Prefix

This is a string of exactly one character in length. It can be one of question-mark (?), plus (+) or minus (-).

These are operators used by LCFG when processing package lists to apply overrides. Basically:

  • plus (+) : Add the package to the list or replace any package of the same name if it is already there.
  • minus (-) : Remove the package from the list if it is already there.
  • question-mark (?) : Replace any package of the same name if it is already there.

Flags

This is a string of at least 1 character in length which can be formed from the characters 0-9, a-z, A-Z.

These are used to control the per-package behaviour of the package management tool. See updaterpms (8) manual page for details of the supported flags.

Context

This is a string of at least 1 character in length which MUST NOT contain a right-square-bracket (]).

The context is used to specify when the package should be installed (e.g. install!=true which is "not at system-install time")

Perl Reference Regular Expression

my $pkgspec_re = qr{^
                    ([?+-])?               # prefix   (optional)
                    (?:([0-9a-zA-Z_]+)/)?  # arch 2   (optional)
                    (.+?)                  # name     (required)
                    -
                    ([^-]+)                # version  (required)
                    -
                    ([^-/:[]+)             # release  (required)
                    (?:/([0-9a-zA-Z_]+))?  # arch 1   (optional)
                    (?::([0-9a-zA-Z]+))?   # flags    (optional)
                    (?:\[([^\]]+)\])?      # context  (optional)
                    $}x;

Testing a Package Specification

If you want to check a package specification to see how it will be parsed you can use the parse_pkgspec tool which is provided as part of the lcfg-pkgtools package:

% /usr/bin/parse_pkgspec '+i386/foo-bar-baz-1:5-8/noarch:br[!install]'
Name: foo-bar-baz
Version: 1:5
Release: 8
Arch: i386
Flags: br
Prefix: +
Context: !install

-- Main.squinney - 2014-11-28

Topic revision: r4 - 2014-11-28 - squinney
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback