X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FVersions%2FDpkg.pm;h=aa9d9376ffb3b1ff75e97ed2f848fe5986ea4655;hb=466f7faff129a5699c7674f59900a92aa256175d;hp=e061b345504d38592eab87b1dbe9c90e0c14eac9;hpb=d90810ffc98b821d57a44bbc3f105b474a8b0fa3;p=debbugs.git diff --git a/Debbugs/Versions/Dpkg.pm b/Debbugs/Versions/Dpkg.pm index e061b34..aa9d937 100644 --- a/Debbugs/Versions/Dpkg.pm +++ b/Debbugs/Versions/Dpkg.pm @@ -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 +# Copyright Ian Jackson +# Copyright 2007 by Don Armstrong . + + 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; }