The following commit has been merged in the master branch:
commit c185991379b2754822262d4fcc6559481cef430c
Author: Frank Lichtenheld <[email protected]>
Date:   Thu Mar 5 00:04:02 2009 +0100

    Use AptPkg::Version if available

diff --git a/lib/Deb/Versions.pm b/lib/Deb/Versions.pm
index 53da030..35f0cb5 100644
--- a/lib/Deb/Versions.pm
+++ b/lib/Deb/Versions.pm
@@ -70,11 +70,28 @@ our @EXPORT = qw( version_cmp version_sort suites_cmp 
suites_sort );
 
 our $VERSION = v1.0.0;
 
-sub version_cmp {
+BEGIN {
+    eval {
+       use AptPkg::Config '$_config';
+       use AptPkg::System '$_system';
+       use AptPkg::Version;
+
+       $_config->init;
+       $_system = $_config->system;
+       my $apt_ver = $_system->versioning;
+       *version_cmp = sub { return $apt_ver->compare(@_) };
+    };
+    unless( *version_cmp ){
+       *version_cmp = \&version_cmp_pp;
+    }
+}
+
+my $re = qr/^(?:(\d+):)?([\w.+:~-]+?)(?:-([\w+.~]+))?$/;
+sub version_cmp_pp {
+    return 0 if $_[0] eq $_[1];
     my ( $ver1, $ver2 ) = @_;
 
     my ( $e1, $e2, $u1, $u2, $d1, $d2 );
-    my $re = qr/^(?:(\d+):)?([\w.+:~-]+?)(?:-([\w+.~]+))?$/;
     if ( $ver1 =~ $re ) {
        ( $e1, $u1, $d1 ) = ( $1, $2, $3 );
        $e1 ||= 0;

-- 
APT Archive Web-Frontend (Alioth repository)


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to