]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Versions/Dpkg.pm
switch to compatibility level 12
[debbugs.git] / Debbugs / Versions / Dpkg.pm
index e061b345504d38592eab87b1dbe9c90e0c14eac9..aa9d9376ffb3b1ff75e97ed2f848fe5986ea4655 100644 (file)
@@ -1,3 +1,13 @@
+# This module is part of debbugs, and is released
+# under the terms of the GPL version 2, or any later
+# version at your option.
+# See the file README and COPYING for more information.
+#
+# Copyright Colin Watson <cjwatson@debian.org>
+# Copyright Ian Jackson <iwj@debian.org>
+# Copyright 2007 by Don Armstrong <don@donarmstrong.com>.
+
+
 package Debbugs::Versions::Dpkg;
 
 use strict;
@@ -33,7 +43,7 @@ sub parseversion ($)
     {
        $verhash{epoch} = 0;
     }
-    if ($ver =~ /(.+)-(.+)$/)
+    if ($ver =~ /(.+)-(.*)$/)
     {
        $verhash{version} = $1;
        $verhash{revision} = $2;
@@ -64,7 +74,7 @@ sub verrevcmp($$)
          #           : (x) + 256)
          # This comparison is out of dpkg's order to avoid
          # comparing things to undef and triggering warnings.
-         if (not defined $x) {
+         if (not defined $x or not length $x) {
               return 0;
          }
          elsif ($x eq '~') {
@@ -114,7 +124,7 @@ sub verrevcmp($$)
          }
          return 1 if defined $vc and $vc =~ /^\d$/;
          return -1 if defined $rc and $rc =~ /^\d$/;
-         return $first_diff if $first_diff;
+         return (($first_diff  > 0) ? 1 : -1) if $first_diff;
      }
      return 0;
 }