Admin Stuff

This is much harder than it should be. There is dpkg --compare-versions to compare two Version numbers but that doesn not help to sort a list of debian archives. There is a little perl module which implements debian version sorting as part of the devscripts package.

I have written a tiny script to utilize this module to sort debian filenames (the script assumes the files all belong to the same package as only the version numbers are sorted. The package name and architecture are ignored). This script is just a quick hack and only works with packages with architecture in their name:

#!/usr/bin/perl -l -I/usr/share/devscripts

use Devscripts::Versort;

$,="\n"; $"="_";
print map { "@{$_}[1,0,2]" } Devscripts::Versort::deb_versort(map { [@{[split("_",$_)]}[1,0,2]] } @ARGV)

Usage is simple:

$ debsort *.deb