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       This is just a bit smarted wrapper of
172
173       "rlCheckRequirements $(rlGetYAMLdeps 'require|recommend') ||
174       rlCheckRequirements $(rlGetMakefileRequires)"
175
176       Example
177
178           rlRun "rlCheckMakefileRequires"
179
180       Return 255 if requirements could not be retrieved, 0 if all
181       requirements are satisfied or number of unsatisfied requirements.
182
183       rlAssertRequired
184
185       Ensures that all requires and recommends specified in the metadata.yaml
186       are installed.  If no metadata.yaml is present a fallback to Makefile
187       is done to check Requires specified in beakerlib-style beaker-wizard
188       layout Makefile, are installed.
189
190           rlAssertRequired
191
192       Prints out a verbose list of installed/missing packages during
193       operation.
194
195       Returns 0 if all required packages are installed, 1 if one or more
196       packages are missing or if no Makefile is present.
197
198   Getting RPMs
199       Download methods
200
201       Functions handling rpm downloading/installing can use more methods for
202       actual download of the rpm.
203
204       Currently there are two download methonds available:
205
206       direct
207           Use use dirct download from build system (brew).
208
209       yum Use yumdownloader or dnf download.
210
211       The methods and their order are defined by
212       BEAKERLIB_RPM_DOWNLOAD_METHODS variable as space separated list. By
213       default it is 'direct yum'. This can be overridden by user.  There may
214       be done also additions  or changes to the original value, e.g.
215       BEAKERLIB_RPM_DOWNLOAD_METHODS='yum
216       ${BEAKERLIB_RPM_DOWNLOAD_METHODS/yum/}'
217
218
219
220       Beakerlib is prepared for more Koji-based sources of packages while
221       usigng direct download method. By default packages are fetched from
222       Koji, particularly from https://kojipkgs.fedoraproject.org/packages.
223
224       rlRpmInstall
225
226       Try to install specified package from local Red Hat sources.
227
228           rlRpmInstall [--quiet] package version release arch
229
230       --quiet
231           Make the download and the install process be quiet.
232
233       package
234           Package name like "kernel"
235
236       version
237           Package version like 2.6.25.6
238
239       release
240           Package release like "55.fc9"
241
242       arch
243           Package arch like "i386"
244
245       Returns 0 if specified package was installed successfully.
246
247       rlRpmDownload
248
249       Try to download specified package.
250
251           rlRpmDownload [--quiet] {package version release arch|N-V-R.A}
252           rlRpmDownload [--quiet] --source {package version release|N-V-R}
253
254       --quiet
255           Make the download process be quiet.
256
257       package
258           Package name like "kernel"
259
260       version
261           Package version like 2.6.25.6
262
263       release
264           Package release like "55.fc9"
265
266       arch
267           Package arch like "i386"
268
269       Returns 0 if specified package was downloaded successfully.
270
271       rlFetchSrcForInstalled
272
273       Tries various ways to download source rpm for specified installed rpm.
274
275           rlFetchSrcForInstalled [--quiet] package
276
277       --quiet
278           Make the download process be quiet.
279
280       package
281           Installed package name like "kernel". It accepts in-direct names.
282           E.g. for the package name "krb5-libs" the function will download
283           the "krb5" source rpm.
284
285       Returns 0 if the source package was successfully downloaded.
286

AUTHORS

288       ·   Petr Muller <pmuller@redhat.com>
289
290       ·   Jan Hutar <jhutar@redhat.com>
291
292       ·   Petr Splichal <psplicha@redhat.com>
293
294       ·   Ales Zelinka <azelinka@redhat.com>
295
296       ·   Dalibor Pospisil <dapospis@redhat.com>
297
298
299
300perl v5.32.1                      2021-03-25                        RPMS.SH(1)
Impressum