diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-03-13 14:11:22 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-03-13 14:11:22 +0100 |
commit | ea5624c3d04c35f5a269b6f7431c135330c9b9b5 (patch) | |
tree | 2d1e21d2565d67aa75aa3217152f87f2b3000fe7 /apt-pkg/deb/debversion.cc | |
parent | 2bb255740bf18b5e0524fe833523303abb5c9051 (diff) |
* apt-pkg/deb/debversion.cc:
- consider absent of debian revision equivalent to 0 (Closes: #573592)
This moves the existing testcase for version comparison to "my" directory,
adds a few more tests (e.g. the tests used in cupt) and rewrites the
testcases runner: The runner does now call dpkg --compare-versions
to check what dpkg thinks about the comparison - all done in less code ;)
Diffstat (limited to 'apt-pkg/deb/debversion.cc')
-rw-r--r-- | apt-pkg/deb/debversion.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index ad45e9a44..755ffbe96 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -190,8 +190,22 @@ int debVersioningSystem::DoCmpVersion(const char *A,const char *AEnd, dlhs++; if (drhs != rhs) drhs++; - - return CmpFragment(dlhs,AEnd,drhs,BEnd); + + // no debian revision need to be treated like -0 + if (*(dlhs-1) == '-' && *(drhs-1) == '-') + return CmpFragment(dlhs,AEnd,drhs,BEnd); + else if (*(dlhs-1) == '-') + { + const char* null = "0"; + return CmpFragment(dlhs,AEnd,null, null+1); + } + else if (*(drhs-1) == '-') + { + const char* null = "0"; + return CmpFragment(null, null+1, drhs, BEnd); + } + else + return 0; } /*}}}*/ // debVS::CheckDep - Check a single dependency /*{{{*/ |