.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Lintian::Relation::Version 3" .TH Lintian::Relation::Version 3 2024-02-05 "Lintian v2.117.0" "Debian Package Checker" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Lintian::Relation::Version \- Comparison operators on Debian versions .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 6 \& print encode_utf8("yes\en") if versions_equal(\*(Aq1.0\*(Aq, \*(Aq1.00\*(Aq); \& print encode_utf8("yes\en") if versions_gte(\*(Aq1.1\*(Aq, \*(Aq1.0\*(Aq); \& print encode_utf8("no\en") if versions_lte(\*(Aq1.1\*(Aq, \*(Aq1.0\*(Aq); \& print encode_utf8("yes\en") if versions_gt(\*(Aq1.1\*(Aq, \*(Aq1.0\*(Aq); \& print encode_utf8("no\en") if versions_lt(\*(Aq1.1\*(Aq, \*(Aq1.1\*(Aq); \& print encode_utf8("yes\en") if versions_compare(\*(Aq1.1\*(Aq, \*(Aq<=\*(Aq, \*(Aq1.1\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides five functions for comparing version numbers. The underlying implementation uses \f(CW\*(C`libapt\-pkg\-perl\*(C'\fR to ensure that the results match what dpkg will expect. .SH FUNCTIONS .IX Header "FUNCTIONS" .IP "versions_equal(A, B)" 4 .IX Item "versions_equal(A, B)" Returns true if A is equal to B (\f(CW\*(C`=\*(C'\fR) and false otherwise. .IP "versions_lte(A, B)" 4 .IX Item "versions_lte(A, B)" Returns true if A is less than or equal (\f(CW\*(C`<=\*(C'\fR) to B and false otherwise. .IP "versions_gte(A, B)" 4 .IX Item "versions_gte(A, B)" Returns true if A is greater than or equal (\f(CW\*(C`>=\*(C'\fR) to B and false otherwise. .IP "versions_lt(A, B)" 4 .IX Item "versions_lt(A, B)" Returns true if A is less than (\f(CW\*(C`<<\*(C'\fR) B and false otherwise. .IP "versions_gt(A, B)" 4 .IX Item "versions_gt(A, B)" Returns true if A is greater than (\f(CW\*(C`>>\*(C'\fR) B and false otherwise. .IP "versions_compare(A, OP, B)" 4 .IX Item "versions_compare(A, OP, B)" Returns true if A OP B, where OP is one of \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`<=\*(C'\fR, \f(CW\*(C`>=\*(C'\fR, \&\f(CW\*(C`<<\*(C'\fR, or \f(CW\*(C`>>\*(C'\fR, and false otherwise. .IP "versions_comparator (A, B)" 4 .IX Item "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: .Sp .Vb 3 \& foreach my $version (sort versions_comparator @versions) { \& ... \& } .Ve .SH AUTHOR .IX Header "AUTHOR" Originally written by Russ Allbery for Lintian and adapted to use libapt-pkg-perl by Adam D. Barratt . .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBlintian\fR\|(1)