Header Ads Widget

[MAN] Lintian::Relation::Version

Content-type: text/html; charset=UTF-8 Man page of Lintian::Relation::Version

Lintian::Relation::Version

Section: Debian Package Checker (3)
Updated: 2018-04-08
Index Return to Main Contents
 

NAME

Lintian::Relation::Version - Comparison operators on Debian versions  

SYNOPSIS

    print "yes\n" if versions_equal('1.0', '1.00');
    print "yes\n" if versions_gte('1.1', '1.0');
    print "no\n" if versions_lte('1.1', '1.0');
    print "yes\n" if versions_gt('1.1', '1.0');
    print "no\n" if versions_lt('1.1', '1.1');
    print "yes\n" if versions_compare('1.1', '<=', '1.1');

 

DESCRIPTION

This module provides five functions for comparing version numbers. The underlying implementation uses "libapt-pkg-perl" to ensure that the results match what dpkg will expect.  

FUNCTIONS

versions_equal(A, B)
Returns true if A is equal to B ("=") and false otherwise.
versions_lte(A, B)
Returns true if A is less than or equal ("<=") to B and false otherwise.
versions_gte(A, B)
Returns true if A is greater than or equal (">=") to B and false otherwise.
versions_lt(A, B)
Returns true if A is less than ("<<") B and false otherwise.
versions_gt(A, B)
Returns true if A is greater than (">>") B and false otherwise.
versions_compare(A, OP, B)
Returns true if A OP B, where OP is one of "=", "<=", ">=", "<<", or ">>", and false otherwise.
versions_comparator (A, B)
Returns -1, 0 or 1 if the version A is (respectively) less than, equal to or greater than B. This is useful for (e.g.) sorting a list of versions:

 foreach my $version (sort versions_comparator @versions) {
    ...
 }

 

AUTHOR

Originally written by Russ Allbery <rra@debian.org> for Lintian and adapted to use libapt-pkg-perl by Adam D. Barratt <adam@adam-barratt-org.uk>.  

SEE ALSO

lintian(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
FUNCTIONS
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 04:45:37 GMT, September 16, 2022

댓글 쓰기

0 댓글