1RPMS.SH(1) User Contributed Perl Documentation RPMS.SH(1)
2
3
4
6 BeakerLib - rpms - Package manipulation helpers
7
9 Functions in this BeakerLib script are used for RPM manipulation.
10
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 comma separated list of requirements defined in Makefile using
129 'Requires' attribute.
130
131 Return 0 if success.
132
133 rlCheckRequirements
134
135 Check that all given requirements are covered eigther by installed
136 package or by binary available in PATHs or by some package's provides.
137
138 rlRun "rlCheckRequirements REQ..."
139
140 REQ Requirement to be checked. It can be package name, provides string
141 or binary name.
142
143 Returns number of unsatisfied requirements.
144
145 rlCheckMakefileRequires
146
147 This is just a bit smarted wrapper of
148
149 "rlCheckRequirements $(rlGetMakefileRequires)"
150
151 Example
152
153 rlRun "rlCheckMakefileRequires"
154
155 Return 255 if requirements could not be retrieved, 0 if all
156 requirements are satisfied or number of unsatisfied requirements.
157
158 rlAssertRequired
159
160 Ensures that all Requires, specified in beakerlib-style beaker-wizard
161 layout Makefile, are installed.
162
163 rlAssertRequired
164
165 Prints out a verbose list of installed/missing packages during
166 operation.
167
168 Returns 0 if all required packages are installed, 1 if one or more
169 packages are missing or if no Makefile is present.
170
171 Getting RPMs
172 Download methods
173
174 Functions handling rpm downloading/installing can use more methods for
175 actual download of the rpm.
176
177 Currently there are two download methonds available:
178
179 direct
180 Use use dirct download from build system (brew).
181
182 yum Use yumdownloader or dnf download.
183
184 The methods and their order are defined by
185 BEAKERLIB_RPM_DOWNLOAD_METHODS variable as space separated list. By
186 default it is 'direct yum'. This can be overridden by user. There may
187 be done also additions or changes to the original value, e.g.
188 BEAKERLIB_RPM_DOWNLOAD_METHODS='yum
189 ${BEAKERLIB_RPM_DOWNLOAD_METHODS/yum/}'
190
191
192
193 Beakerlib is prepared for more Koji-based sources of packages while
194 usigng direct download method. By default packages are fetched from
195 Koji, particularly from https://kojipkgs.fedoraproject.org/packages.
196
197 rlRpmInstall
198
199 Try to install specified package from local Red Hat sources.
200
201 rlRpmInstall [--quiet] package version release arch
202
203 --quiet
204 Make the download and the install process be quiet.
205
206 package
207 Package name like "kernel"
208
209 version
210 Package version like 2.6.25.6
211
212 release
213 Package release like "55.fc9"
214
215 arch
216 Package arch like "i386"
217
218 Returns 0 if specified package was installed succesfully.
219
220 rlRpmDownload
221
222 Try to download specified package.
223
224 rlRpmDownload [--quiet] {package version release arch|N-V-R.A}
225 rlRpmDownload [--quiet] --source {package version release|N-V-R}
226
227 --quiet
228 Make the download process be quiet.
229
230 package
231 Package name like "kernel"
232
233 version
234 Package version like 2.6.25.6
235
236 release
237 Package release like "55.fc9"
238
239 arch
240 Package arch like "i386"
241
242 Returns 0 if specified package was downloaded succesfully.
243
244 rlFetchSrcForInstalled
245
246 Tries various ways to download source rpm for specified installed rpm.
247
248 rlFetchSrcForInstalled [--quiet] package
249
250 --quiet
251 Make the download process be quiet.
252
253 package
254 Installed package name like "kernel". It accepts in-direct names.
255 Eg for the package name "krb5-libs" will the function download the
256 "krb5" source rpm.
257
258 Returns 0 if the source package was succesfully downloaded.
259
261 · Petr Muller <pmuller@redhat.com>
262
263 · Jan Hutar <jhutar@redhat.com>
264
265 · Petr Splichal <psplicha@redhat.com>
266
267 · Ales Zelinka <azelinka@redhat.com>
268
269 · Dalibor Pospisil <dapospis@redhat.com>
270
271
272
273perl v5.28.1 2019-04-04 RPMS.SH(1)