1RPM::VersionCompare(3)User Contributed Perl DocumentationRPM::VersionCompare(3)
2
3
4
6 RPM::VersionCompare - Compare RPM version strings
7
9 use RPM::VersionCompare;
10 RPM::VersionCompare::rpmvercmp('1.0', '0.9');
11 RPM::VersionCompare::labelSplit('4:5.12.0-140');
12 RPM::VersionCompare::labelCompare('4:5.12.0-140', '5.14.1');
13
15 This module provides functions to compare RPM version strings. No
16 function is exported by default. If possible, calls are passed to
17 native librpm library. Otherwise Python extension provided with RPM
18 sources is re-implemented.
19
20 labelCompare(LABEL1, LABEL2)
21 Compares two version strings including epoch and release.
22 Return 1 if LABEL1 is bigger, return 0 if LABEL1 equals to
23 LABEL2, return -1 otherwise.
24
25 labelSplit(LABEL)
26 Splits a version LABEL (e.g. "4:5.12.0-140") into epoch,
27 version and release. The epoch and release parts are optional.
28 If they miss, the separator (collon for epoch, hyphen for
29 release) should miss too and their implicit value is 0. See
30 <http://www.rpm.org/wiki/PackagerDocs/Dependencies#RequiringPackages>
31 for specification.
32
33 If LABEL is in correct format, array (EPOCH, VERSION, RELEASE)
34 will be returned. Otherwise undef is returned.
35
36 rpmvercmp(VERSION1, VERSION2)
37 Compares two RPM version strings by calling librpm function
38 rpmvercmp(). It does not support strings with RPM epoch or
39 release. (Use labelCompare() if you need to support epoch or
40 release.) It will return 1 if VERSION1 string is bigger, 0 if
41 strings are equal, and -1 if VERSION1 is lesser.
42
44 Petr Písař <ppisar@redhat.com>
45
47 Copyright (C) 2011 Petr Písař <ppisar@redhat.com>
48
49 This program is free software: you can redistribute it and/or modify it
50 under the terms of the GNU General Public License as published by the
51 Free Software Foundation, either version 3 of the License, or (at your
52 option) any later version.
53
54 This program is distributed in the hope that it will be useful, but
55 WITHOUT ANY WARRANTY; without even the implied warranty of
56 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
57 General Public License for more details.
58
59 You should have received a copy of the GNU General Public License along
60 with this program. If not, see <http://www.gnu.org/licenses/>.
61
62
63
64perl v5.32.1 2021-01-27 RPM::VersionCompare(3)