[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg-ftp troubles



Kevin Dalley writes:
>
>
>Try replacing cmpvers in /usr/lib/dpkg/methods/ftp/install with the
>following function.  While the maintainer has not yet blessed this
>change, it seems to work for me.
>
># compare two versions (taken from dpkg docs)
>sub cmpvers {
>    ($a,$b) = @_;
>    my ($cm, $ad, $bd);
>    if( defined($a) && !defined($b)) { return 1; }
>    if(!defined($a) && !defined($b)) { return 0; }
>    if(!defined($a) &&  defined($b)) { return -1; }
>    do {
>        $a =~ s/^\D*//; $ad= $&; $ad =~ s/\W/ /g;
>        $b =~ s/^\D*//; $bd= $&; $bd =~ s/\W/ /g;
>        $cm = $ad cmp $bd;  return $cm if $cm;
>        $a =~ s/^\d*//; $ad= $&;
>        $b =~ s/^\d*//; $bd= $&;
>        $cm = $ad cmp $bd;  return $cm if $cm;
>    } while (length($a) && length($b));
>    return length($a) cmp length($b);
>}
>

Changing <=> to cmp changes the ordering I think.  My newest
version (not yet out) will use dpkg --compare-versions to get it
really right.

Andy.


Reply to: