1RPMS.SH(1)            User Contributed Perl Documentation           RPMS.SH(1)
2
3
4

NAME

6       BeakerLib - rpms - Package manipulation helpers
7

DESCRIPTION

9       Functions in this BeakerLib script are used for RPM manipulation.
10

FUNCTIONS

12   Rpm Handling
13       rlCheckRpm
14
15       Check whether a package is installed.
16
17           rlCheckRpm name [version] [release] [arch]
18
19       name
20           Package name like "kernel"
21
22       version
23           Package version like 2.6.25.6
24
25       release
26           Package release like "55.fc9"
27
28       arch
29           Package architucture like "i386"
30
31       Returns 0 if the specified package is installed.
32
33       rlAssertRpm
34
35       Assertion making sure that a package is installed.
36
37           rlAssertRpm name [version] [release] [arch]>
38           rlAssertRpm --all
39
40       name
41           Package name like "kernel"
42
43       version
44           Package version like 2.6.25.6
45
46       release
47           Package release like "55.fc9"
48
49       arch
50           Package architucture like "i386"
51
52       --all
53           Assert all packages listed in the $PACKAGES $REQUIRES and
54           $COLLECTIONS environment variables.
55
56       Returns 0 and asserts PASS if the specified package is installed.
57
58       rlAssertNotRpm
59
60       Assertion making sure that a package is not installed. This is just
61       inverse of "rlAssertRpm".
62
63           rlAssertNotRpm name [version] [release] [arch]>
64
65       name
66           Package name like "kernel"
67
68       version
69           Package version like 2.6.25.6
70
71       release
72           Package release like "55.fc9"
73
74       arch
75           Package architucture like "i386"
76
77       Returns 0 and asserts PASS if the specified package is not installed.
78
79       Example
80
81       Function "rlAssertRpm" is useful especially in prepare phase where it
82       causes abort if a package is missing, while "rlCheckRpm" is handy when
83       doing something like:
84
85           if ! rlCheckRpm package; then
86                yum install package
87                rlAssertRpm package
88           fi
89
90       rlAssertBinaryOrigin
91
92       Assertion making sure that given binary is owned by (one of) the given
93       package(s).
94
95           rlAssertBinaryOrigin binary package [package2 [...]]
96           PACKAGES=... rlAssertBinaryOrigin binary
97
98       binary
99           Binary name like "ksh" or "/bin/ksh"
100
101       package
102           List of packages like "ksh mksh". The parameter is optional. If
103           missing, contents of environment variable $PACKAGES are taken into
104           account.
105
106       Returns 0 and asserts PASS if the specified binary belongs to (one of)
107       the given package(s).  Returns 1 and asserts FAIL if the specified
108       binary does not belong to (any of) the given package(s).  Returns 2 and
109       asserts FAIL if the specified binary is not found.  Returns 3 and
110       asserts FAIL if no packages are given.  Returns 100 and asserts FAIL if
111       invoked with no parameters.
112
113       Example
114
115       Function "rlAssertBinaryOrigin" is useful especially in prepare phase
116       where it causes abort if a binary is missing or is owned by different
117       package:
118
119           PACKAGES=mksh rlAssertBinaryOrigin ksh
120           or
121           rlAssertBinaryOrigin ksh mksh
122
123       Returns true if ksh is owned by the mksh package (in this case:
124       /bin/ksh is a symlink pointing to /bin/mksh).
125
126       rlGetMakefileRequires
127
128       Prints space separated list of requirements defined in Makefile using
129       'Requires' attribute.
130
131       Return 0 if success.
132
133       rlGetYAMLdeps
134
135       Prints space separated list of requirements defined in metadata.yaml
136       using 'require' and / or 'recommend' attribute.
137
138       Full fmf ids and library references are to be ignored.
139
140           rlGetYAMLdeps DEP_TYPE [array_var_name]
141
142       DEP_TYPE
143           Dependency type defined as a regexp. Expected values are 'require',
144           'recommend', or 'require|recommend'. The matching attribute values
145           are then processed.  Defaults to 'require'.
146
147       array_var_name
148           Name of the variable to put the output to in a form of an array.
149           This can hold also dependencies with specific version.  If used,
150           the output to stdout is suppressed.
151
152       Return 0 if success.
153
154       rlCheckRequirements
155
156       Check that all given requirements are covered eigther by installed
157       package or by binary available in PATHs or by some package's provides.
158
159           rlRun "rlCheckRequirements REQ..."
160
161       REQ Requirement to be checked. It can be package name, provides string
162           or binary name. Moreover, the requirement can be written the same
163           way as the Require in the spec file, including the version
164           specification, e.g. "bash >= 4.4".  The comparsion operator may be
165           any of supported by rlTestVersion(), see its manual.
166
167       Returns number of unsatisfied requirements.
168
169       rlCheckMakefileRequires
170
171       Check presence of required packages / binaries defined in metadata.yaml
172       provided by "tmt" or Makefile of the test.
173
174       Also check presence of recommended packages / binaries defined in
175       metadata.yaml provided by "tmt". These however do not participate on
176       the return code, these are just informative.
177
178       Example
179
180           rlRun "rlCheckMakefileRequires"
181
182       Return 255 if requirements could not be retrieved, 0 if all
183       requirements are satisfied or number of unsatisfied requirements.
184
185       rlGetRequired =head3 rlGetRecommended
186
187       Get a list of required or recommended packages / binaries defined in
188       metadata.yaml provided by "tmt" or in a Makefile of the test.
189
190           rlGetRequired [ARRAY_VAR_NAME]
191           rlGetRecommended [ARRAY_VAR_NAME]
192
193       ARRAY_VAR_NAME
194           If provided the variable is populated as an array with the
195           respective dependencies. Otherwise the dependencies are printed out
196           to the STDOUT.
197
198       Return 255 if requirements could not be retrieved, 0 otherwise.
199
200       rlCheckRequired =head3 rlCheckRecommended =head3 rlCheckDependencies
201
202       Check presence of required, recommended or both packages / binaries
203       defined in metadata.yaml provided by "tmt" or in a Makefile of the
204       test.
205
206       Example
207
208           rlRun "rlCheckRequired"
209           rlRun "rlCheckRecommended"
210           rlRun "rlCheckDependencies"
211
212       Return 255 if requirements could not be retrieved, 0 if all
213       requirements are satisfied or number of unsatisfied requirements.
214
215       rlAssertRequired
216
217       Ensures that all required packages provided in either metadata.yaml or
218       Makefile are installed.
219
220           rlAssertRequired
221
222       Prints out a verbose list of installed/missing packages during
223       operation.
224
225       Returns 0 if all required packages are installed, 1 if one or more
226       packages are missing or if no Makefile is present.
227
228   Getting RPMs
229       Download methods
230
231       Functions handling rpm downloading/installing can use more methods for
232       actual download of the rpm.
233
234       Currently there are two download methonds available:
235
236       direct
237           Use use dirct download from build system (brew).
238
239       yum Use yumdownloader or dnf download.
240
241       The methods and their order are defined by
242       BEAKERLIB_RPM_DOWNLOAD_METHODS variable as space separated list. By
243       default it is 'direct yum'. This can be overridden by user.  There may
244       be done also additions  or changes to the original value, e.g.
245       BEAKERLIB_RPM_DOWNLOAD_METHODS='yum
246       ${BEAKERLIB_RPM_DOWNLOAD_METHODS/yum/}'
247
248
249
250       Beakerlib is prepared for more Koji-based sources of packages while
251       usigng direct download method. By default packages are fetched from
252       Koji, particularly from https://kojipkgs.fedoraproject.org/packages.
253
254       rlRpmInstall
255
256       Try to install specified package from local Red Hat sources.
257
258           rlRpmInstall [--quiet] package version release arch
259
260       --quiet
261           Make the download and the install process be quiet.
262
263       package
264           Package name like "kernel"
265
266       version
267           Package version like 2.6.25.6
268
269       release
270           Package release like "55.fc9"
271
272       arch
273           Package arch like "i386"
274
275       Returns 0 if specified package was installed successfully.
276
277       rlRpmDownload
278
279       Try to download specified package.
280
281           rlRpmDownload [--quiet] {package version release arch|N-V-R.A}
282           rlRpmDownload [--quiet] --source {package version release|N-V-R}
283
284       --quiet
285           Make the download process be quiet.
286
287       package
288           Package name like "kernel"
289
290       version
291           Package version like 2.6.25.6
292
293       release
294           Package release like "55.fc9"
295
296       arch
297           Package arch like "i386"
298
299       Returns 0 if specified package was downloaded successfully.
300
301       rlFetchSrcForInstalled
302
303       Tries various ways to download source rpm for specified installed rpm.
304
305           rlFetchSrcForInstalled [--quiet] package
306
307       --quiet
308           Make the download process be quiet.
309
310       package
311           Installed package name like "kernel". It accepts in-direct names.
312           E.g. for the package name "krb5-libs" the function will download
313           the "krb5" source rpm.
314
315       Returns 0 if the source package was successfully downloaded.
316

AUTHORS

318       •   Petr Muller <pmuller@redhat.com>
319
320       •   Jan Hutar <jhutar@redhat.com>
321
322       •   Petr Splichal <psplicha@redhat.com>
323
324       •   Ales Zelinka <azelinka@redhat.com>
325
326       •   Dalibor Pospisil <dapospis@redhat.com>
327
328
329
330perl v5.38.0                      2023-07-19                        RPMS.SH(1)
Impressum