]> git.deb.at Git - deb/packages.git/blobdiff - lib/Deb/Versions.pm
Merge branch 'master' into archive-master
[deb/packages.git] / lib / Deb / Versions.pm
index eb83819b7e4794ab4efa0c40357dbbb304b9a9f9..9c50a4c36407205d916480da8cbaebff3c2914a9 100644 (file)
@@ -70,11 +70,12 @@ our @EXPORT = qw( version_cmp version_sort suites_cmp suites_sort );
 
 our $VERSION = v1.0.0;
 
-sub version_cmp {
+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;
@@ -102,6 +103,18 @@ sub version_cmp {
     return $res;
 }
 
+*version_cmp = \&version_cmp_pp;
+eval {
+    require AptPkg::Config;
+    require AptPkg::System;
+    require AptPkg::Version;
+    
+    $AptPkg::Config::_config->init;
+    $AptPkg::System::_system = $AptPkg::Config::_config->system;
+    my $apt_ver = $AptPkg::System::_system->versioning;
+    *version_cmp = sub { return $apt_ver->compare(@_) };
+};
+
 sub version_sort {
     return sort { version_cmp( $b, $a ) } @_;
 }
@@ -152,11 +165,16 @@ sub _lcmp {
     return length( $v1 ) <=> length( $v2 );
 }
 
-our @SUITES_SORT = qw( bo hamm slink potato woody
-                      oldstable sarge stable stable-proposed-updates
-                      etch etch-m68k testing testing-proposed-updates lenny
-                      sid unstable experimental
-                      warty hoary breezy dapper edgy feisty gutsy intrepid jaunty);
+our @SUITES_SORT = qw(  bo hamm slink potato woody
+                       sarge
+                       oldstable
+                       etch etch-m68k
+                       stable stable-proposed-updates
+                       lenny
+                       testing testing-proposed-updates
+                       squeeze
+                       sid unstable experimental
+                       warty hoary breezy dapper edgy feisty gutsy hardy intrepid jaunty);
 our @ARCHIVE_SORT = qw( non-US security updates volatile backports );
 our @PRIORITY_SORT = qw( required important standard optional extra );
 my $i = 1000;