beakerlib-rpms man page

BeakerLib — rpms — Package manipulation helpers

Description

Functions in this BeakerLib script are used for RPM manipulation.

Functions

Rpm Handling

rlCheckRpm

Check whether a package is installed.

    rlCheckRpm name [version] [release] [arch]
name

Package name like "kernel"

version

Package version like 2.6.25.6

release

Package release like "55.fc9"

arch

Package architucture like "i386"

Returns 0 if the specified package is installed.

rlAssertRpm

Assertion making sure that a package is installed.

    rlAssertRpm name [version] [release] [arch]>
    rlAssertRpm --all
name

Package name like "kernel"

version

Package version like 2.6.25.6

release

Package release like "55.fc9"

arch

Package architucture like "i386"

--all

Assert all packages listed in the $PACKAGES $REQUIRES and $COLLECTIONS environment variables.

Returns 0 and asserts PASS if the specified package is installed.

rlAssertNotRpm

Assertion making sure that a package is not installed. This is just inverse of "rlAssertRpm".

    rlAssertNotRpm name [version] [release] [arch]>
name

Package name like "kernel"

version

Package version like 2.6.25.6

release

Package release like "55.fc9"

arch

Package architucture like "i386"

Returns 0 and asserts PASS if the specified package is not installed.

Example

Function "rlAssertRpm" is useful especially in prepare phase where it causes abort if a package is missing, while "rlCheckRpm" is handy when doing something like:

    if ! rlCheckRpm package; then
         yum install package
         rlAssertRpm package
    fi

rlAssertBinaryOrigin

Assertion making sure that given binary is owned by (one of) the given package(s).

    rlAssertBinaryOrigin binary package [package2 [...]]
    PACKAGES=... rlAssertBinaryOrigin binary
binary

Binary name like "ksh" or "/bin/ksh"

package

List of packages like "ksh mksh". The parameter is optional. If missing, contents of environment variable $PACKAGES are taken into account.

Returns 0 and asserts PASS if the specified binary belongs to (one of) the given package(s). Returns 1 and asserts FAIL if the specified binary does not belong to (any of) the given package(s). Returns 2 and asserts FAIL if the specified binary is not found. Returns 3 and asserts FAIL if no packages are given. Returns 100 and asserts FAIL if invoked with no parameters.

Example

Function "rlAssertBinaryOrigin" is useful especially in prepare phase where it causes abort if a binary is missing or is owned by different package:

    PACKAGES=mksh rlAssertBinaryOrigin ksh
    or
    rlAssertBinaryOrigin ksh mksh

Returns true if ksh is owned by the mksh package (in this case: /bin/ksh is a symlink pointing to /bin/mksh).

rlGetMakefileRequires

Prints comma separated list of requirements defined in Makefile using 'Requires' attribute.

Return 0 if success.

rlCheckRequirements

Check that all given requirements are covered eigther by installed package or by binary available in PATHs or by some package's provides.

    rlRun "rlCheckRequirements REQ..."
REQ

Requirement to be checked. It can be package name, provides string or binary name.

Returns number of unsatisfied requirements.

rlCheckMakefileRequires

This is just a bit smarted wrapper of

"rlCheckRequirements $(rlGetMakefileRequires)"

Example

    rlRun "rlCheckMakefileRequires"

Return 255 if requirements could not be retrieved, 0 if all requirements are satisfied or number of unsatisfied requirements.

Authors

·

Petr Muller <pmuller@redhat.com>

·

Jan Hutar <jhutar@redhat.com>

·

Petr Splichal <psplicha@redhat.com>

·

Ales Zelinka <azelinka@redhat.com>

·

Dalibor Pospisil <dapospis@redhat.com>

Info

2017-01-26 perl v5.24.1 User Contributed Perl Documentation