RPM::Ve...nCompare(3)

πŸ“¦
version 0.1.1 Β· 2 versions
, in fedora 43

πŸ’– RPM::VersionCompare β€” the manual page, bestie edition πŸ’–

okay so you found the manual page for RPM::VersionCompare, from the User Contributed Perl Documentation section, page RPM::Ve...nCompare(3) (yes the name is squished, it's just RPM::VersionCompare(3) fr fr). it's a Perl module that compares RPM version strings, and honestly? it ate. let's get into it πŸŽ€


✨ NAME ✨

RPM::VersionCompare β€” compare RPM version strings πŸ’…


🌸 SYNOPSIS 🌸

here's the whole vibe, literally copy-paste:

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 πŸ¦‹

okay so this module gives you functions to compare RPM version strings. No function is exported by default. like, you gotta call them fully qualified, bestie, there's no use RPM::VersionCompare qw(...) freebie here. πŸ™ˆ

if possible, calls are passed to the native librpm library. otherwise, the Python extension provided with RPM sources is re-implemented. so either way, you're covered. periodt. πŸ‘‘


πŸ“ labelCompare(LABEL1, LABEL2)

compares two version strings including epoch and release. the returns are:

  • returns 1 if LABEL1 is bigger
  • returns 0 if LABEL1 equals LABEL2
  • returns -1 otherwise

that's it. that's the whole function. iconic. ✨


🧚 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, bestie β€” if they miss, the separator (collon for epoch, hyphen for release) should miss too, and their implicit value is 0. no cap.

see <http://www.rpm.org/wiki/PackagerDocs/Dependencies#RequiringPackages> for the specification. iykyk πŸ“–

if LABEL is in correct format, an array (EPOCH, VERSION, RELEASE) will be returned. otherwise undef is returned. so like… vibe check your input first or you're getting undef and a sad little moment 😭


πŸ’œ rpmvercmp(VERSION1, VERSION2)

compares two RPM version strings by calling the librpm function rpmvercmp(). It does not support strings with RPM epoch or release. (use labelCompare() if you need to support epoch or release β€” that's literally what it's for.)

it will return:

  • 1 if VERSION1 string is bigger
  • 0 if strings are equal
  • -1 if VERSION1 is lesser

clean, simple, main character energy ⭐


🌈 AUTHOR 🌈

Petr PΓ­saΕ™ <ppisar@redhat.com> β€” ty for your service 🫢


πŸ‘‘ COPYING πŸ‘‘

Copyright (C) 2011 Petr PΓ­saΕ™ <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/>.


lowkey important: this is GPLv3-or-later, and there is genuinely no warranty of any kind. don't come for the author if it breaks, that's the deal. πŸ’€

and that's the page, bestie!! πŸ’– this one's from perl v5.42.0, dated 2025-07-25, and that footer is the cutest little timestamp. go compare some versions, you got this πŸŒΈβœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from