RPMS.SH(1)

πŸ’– RPMS.SH(1) β€” BeakerLib rpms: package manipulation helpers πŸ’…

Okay bestie, this is RPMS.SH(1) from the User Contributed Perl Documentation crew, and it's literally the BeakerLib page for RPM stuff. No cap.

🌸 NAME 🌸

BeakerLib β€” rpms β€” Package manipulation helpers πŸŽ€

✨ DESCRIPTION ✨

The functions in this BeakerLib script are used for RPM manipulation. It's giving β€œpackage-handling corner of the group chat,” and it's here to help. Periodt.

πŸ”₯ FUNCTIONS πŸ”₯

πŸ’… Rpm Handling

rlCheckRpm

Check whether a package is installed. Lowkey the vibe check for packages.

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 architecture like i386

Returns 0 if the specified package is installed. ✨

rlAssertRpm

An assertion making sure that a package is installed. This one asserts PASS, so it's main character energy in your prepare phase.

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 architecture 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 the 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 architecture 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 a given binary is owned by (one of) the given package(s). It's the β€œwho's your package parent?” check, fr fr.

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 a 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 a space separated list of requirements defined in Makefile using the 'Requires' attribute.

Return 0 if success.

rlGetYAMLdeps

Prints a space separated list of requirements defined in metadata.yaml using the 'require' and / or 'recommend' attribute.

Full fmf ids and library references are to be ignored.

rlGetYAMLdeps DEP_TYPE [array_var_name]
  • DEP_TYPE β€” dependency type defined as a regexp. Expected values are 'require', 'recommend', or 'require|recommend'. The matching attribute values are then processed. Defaults to 'require'.
  • array_var_name β€” name of the variable to put the output to in a form of an array. This can hold also dependencies with specific version. If used, the output to stdout is suppressed.

Return 0 if success.

rlCheckRequirements

Check that all given requirements are covered either by an installed package or by a binary available in PATHs or by some package's provides. It's the requirement vibe check, bestie.

rlRun "rlCheckRequirements REQ..."
  • REQ β€” requirement to be checked. It can be package name, provides string or binary name. Moreover, the requirement can be written the same way as the Require in the spec file, including the version specification, e.g. bash >= 4.4. The comparison operator may be any of supported by rlTestVersion(), see its manual.

Returns number of unsatisfied requirements.

rlCheckMakefileRequires

Check presence of required packages / binaries defined in metadata.yaml provided by tmt or Makefile of the test.

Also check presence of recommended packages / binaries defined in metadata.yaml provided by tmt. These however do not participate on the return code, these are just informative.

🌟 Example 🌟

rlRun "rlCheckMakefileRequires"

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

πŸ¦‹ rlGetRequired =head3 rlGetRecommended

Get a list of required or recommended packages / binaries defined in metadata.yaml provided by tmt or in a Makefile of the test.

rlGetRequired [ARRAY_VAR_NAME]
rlGetRecommended [ARRAY_VAR_NAME]
  • ARRAY_VAR_NAME β€” if provided the variable is populated as an array with the respective dependencies. Otherwise the dependencies are printed out to the STDOUT.

Return 255 if requirements could not be retrieved, 0 otherwise.

🌈 rlCheckRequired =head3 rlCheckRecommended =head3 rlCheckDependencies

Check presence of required, recommended or both packages / binaries defined in metadata.yaml provided by tmt or in a Makefile of the test.

🌟 Example 🌟

rlRun "rlCheckRequired"
rlRun "rlCheckRecommended"
rlRun "rlCheckDependencies"

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

rlAssertRequired

Ensures that all required packages provided in either metadata.yaml or Makefile are installed.

rlAssertRequired

Prints out a verbose list of installed/missing packages during operation.

Returns 0 if all required packages are installed, 1 if one or more packages are missing or if no Makefile is present. πŸ‘‘

πŸ›Έ Getting RPMs

Download methods

Functions handling rpm downloading/installing can use more methods for actual download of the rpm.

Currently there are two download methods available (the page says β€œmethonds” β€” iconic 😭):

  • direct β€” use direct download from build system (brew).
  • yum β€” use yumdownloader or dnf download.

The methods and their order are defined by the BEAKERLIB_RPM_DOWNLOAD_METHODS variable as a space separated list. By default it is 'direct yum'. This can be overridden by the user. There may also be additions or changes done to the original value, e.g. BEAKERLIB_RPM_DOWNLOAD_METHODS='yum ${BEAKERLIB_RPM_DOWNLOAD_METHODS/yum/}'.

Beakerlib is prepared for more Koji-based sources of packages while using the direct download method. By default packages are fetched from Koji, specifically from https://kojipkgs.fedoraproject.org/packages.

rlRpmInstall

Try to install the specified package from local Red Hat sources.

rlRpmInstall [--quiet] package version release arch
  • --quiet β€” make the download and the install process be quiet.
  • package β€” package name like kernel
  • version β€” package version like 2.6.25.6
  • release β€” package release like 55.fc9
  • arch β€” package arch like i386

Returns 0 if the specified package was installed successfully. πŸ”₯

rlRpmDownload

Try to download the specified package.

rlRpmDownload [--quiet] {package version release arch|N-V-R.A}
rlRpmDownload [--quiet] --source {package version release|N-V-R}
  • --quiet β€” make the download process be quiet.
  • package β€” package name like kernel
  • version β€” package version like 2.6.25.6
  • release β€” package release like 55.fc9
  • arch β€” package arch like i386

Returns 0 if the specified package was downloaded successfully. ✨

rlFetchSrcForInstalled

Tries various ways to download source rpm for the specified installed rpm.

rlFetchSrcForInstalled [--quiet] package
  • --quiet β€” make the download process be quiet.
  • package β€” installed package name like kernel. It accepts in-direct names. E.g. for the package name krb5-libs the function will download the krb5 source rpm.

Returns 0 if the source package was successfully downloaded. πŸ’–

πŸ‘‘ 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

πŸ’– That's the whole RPMS.SH(1) situation. This page is from perl v5.32.1, dated 2026-04-07, and it's the RPMS.SH(1) manual β€” go manipulate some RPMs, bestie. Slay! 🫢
πŸ“¦ where this page comes from