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 likekernelversionβ package version like2.6.25.6releaseβ package release like55.fc9archβ package architecture likei386
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 likekernelversionβ package version like2.6.25.6releaseβ package release like55.fc9archβ package architecture likei386--allβ assert all packages listed in the$PACKAGES,$REQUIRESand$COLLECTIONSenvironment 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 likekernelversionβ package version like2.6.25.6releaseβ package release like55.fc9archβ package architecture likei386
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 likekshor/bin/kshpackageβ list of packages likeksh mksh. The parameter is optional. If missing, contents of environment variable$PACKAGESare 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 byrlTestVersion(), 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β useyumdownloaderordnf 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 likekernelversionβ package version like2.6.25.6releaseβ package release like55.fc9archβ package arch likei386
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 likekernelversionβ package version like2.6.25.6releaseβ package release like55.fc9archβ package arch likei386
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 likekernel. It accepts in-direct names. E.g. for the package namekrb5-libsthe function will download thekrb5source 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 wholeRPMS.SH(1)situation. This page is fromperl v5.32.1, dated2026-04-07, and it's theRPMS.SH(1)manual β go manipulate some RPMs, bestie. Slay! π«Ά
π¦ where this page comes from
- epel 9: beakerlib 1.33.3-1.el9 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms