Unix/GNU Windows

   
By Alexis Wilke
Started in Dec. 2006
   Home       Documentation       Download       Bugs   

Current
wpkg
Version:
0.5



Change Log
  

debversion

Testing that a version string is a valid Debian version string can be done with this tool: debversion

There are two possible command lines. One to test the validity of a version and one to compare two versions against each others.

Verify a version string with the first form:

debversion <Debian version>

In this case, debversion returns 0 if the version string is a valid Debian version and 1 if not.

One command line option can be used with the first form:

  • --canonicalize (or -c) to transform the input into the shortest possible form (i.e. 1.0.0 becomes 1.0; 0:3.5.9 becomes 3.5.9; etc.)
  • --print (or -p) to print the version string as is.

Compare two versions using the second form of the command line:

debversion <v1> -op <v2>

In this case the debversion tool compares v1 against v2 and returns one of:

  • 0 when v1 -op v2 is true;
  • 1 when v1 -op v2 is false;
  • 2 when one of v1 or v2 or both are not valid Debian versions;
  • 3 when -op is not a valid operator.

The valid operators are -lt (less than), -le (less or equal), -eq (equal), -ne (not equal), -ge (greater or equal) and -gt (greater.) These are the same as the test command line tool.

With --help/-h or no options/version, the tool prints out a usage screen in stderr and exit with 1.

Examples:

  debversion 0:1.2.0-1 -eq 1.2   is true
  debversion 0:1.2.0-1 -ge 1.2   is true
  debversion 0:1.2.0-1 -lt 1.2   is false
  debversion 1:1.2.0-1 -ne 1.2   is true
  debversion -c 0:1.2.0-1        prints 1.2
  debversion -c 3:1.2.5-2        prints 3:1.2.5-2