Tags:
create new tag
view all tags

Package Specifications

Entries in an LCFG package list must conform to a standard syntax.

The modern specification style (requires lcfg-core 1.54.3, perl-LCFG-Core 0.26.0, LCFG-Compiler 3.7.1) looks like this:

prefix:name=version-release/arch:flags[context]

Note the '=' (equals) separator between name and version. In this form the version may contain colons (for the epoch) and hyphens (seen in some Debian packages).

The legacy specification style looks like this:

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

Due to the Redhat heritage of our systems the concatenation 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 7 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 and the first character MUST be in [a-zA-Z0-9_]. All subsequent characters must match [A-Za-z0-9_-.+]

Note that some package managers may have additional limitations on package name (e.g. Debian does not permit use of the '_' (underscore) character.

Version

This is a string of at least 1 character in length. All characters MUST be in the set [A-Za-z0-9:.~+-_*?].

Note that some package managers may have additional limitations on package version (e.g. Redhat does not permit use of the '-' (hyphen) character.

With the legacy style of specification this MUST NOT contain a hyphen/minus sign (-) and MUST NOT contain a colon (:).

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 file names.

Release

This is a string of at least 1 character in length. All characters MUST be in the set [A-Za-z0-9.~+-_*?] (similar to the version string except : (colon) is not permitted).

Note that some package managers may have additional limitations on package version (e.g. Redhat does not permit use of the '-' (hyphen) character.

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. Debian native packages) 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 legacy specification style 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

Legacy style specifications:

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:

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

or with the legacy specification:

% /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: r7 - 2020-05-05 - squinney
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback