From ea5624c3d04c35f5a269b6f7431c135330c9b9b5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 13 Mar 2010 14:11:22 +0100 Subject: * 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 ;) --- apt-pkg/deb/debversion.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/debversion.cc') 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 /*{{{*/ -- cgit v1.2.3