RPM::VersionCompare(3)User Contributed Perl DocumentatioRPM::VersionCompare(3)NAMERPM::VersionCompare - Compare RPM version strings
SYNOPSIS
use RPM::VersionCompare;
RPM::VersionCompare::rpmvercmp('1.0', '0.9');
RPM::VersionCompare::labelSplit('4:5.12.0-140');
RPM::VersionCompare::labelCompare('4:5.12.0-140', '5.14.1');
DESCRIPTION
This module provides functions to compare RPM version strings. No
function is exported by default. If possible, calls are passed to
native librpm library. Otherwise Python extension provided with RPM
sources is re-implemented.
labelCompare(LABEL1, LABEL2)
Compares two version strings including epoch and release.
Return 1 if LABEL1 is bigger, return 0 if LABEL1 equals to
LABEL2, return -1 otherwise.
labelSplit(LABEL)
Splits a version LABEL (e.g. "4:5.12.0-140") into epoch,
version and release. The epoch and release parts are optional.
If they miss, the separator (collon for epoch, hyphen for
release) should miss too and their implicit value is 0. See
<http://www.rpm.org/wiki/PackagerDocs/Dependencies#RequiringPackages>
for specification.
If LABEL is in correct format, array (EPOCH, VERSION, RELEASE)
will be returned. Otherwise undef is returned.
rpmvercmp(VERSION1, VERSION2)
Compares two RPM version strings by calling librpm function
rpmvercmp(). It does not support strings with RPM epoch or
release. (Use labelCompare() if you need to support epoch or
release.) It will return 1 if VERSION1 string is bigger, 0 if
strings are equal, and -1 if VERSION1 is lesser.
AUTHOR
Petr PisaX <ppisar@redhat.com>
COPYING
Copyright (C) 2011 Petr PisaX <ppisar@redhat.com>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
perl v5.14.1 2011-07-28 RPM::VersionCompare(3)