]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debversion.cc
* apt-pkg/packagemanager.cc:
[apt.git] / apt-pkg / deb / debversion.cc
index 064d8fa5be69371595bceba4058964e6adf36046..bc9e13d92958f93754a2e1160babcd85869fe27a 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#define APT_COMPATIBILITY 986
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/debversion.h"
-#endif
+#include <config.h>
 
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/pkgcache.h>
@@ -193,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                         /*{{{*/
@@ -251,7 +262,7 @@ bool debVersioningSystem::CheckDep(const char *PkgVer,
 // debVS::UpstreamVersion - Return the upstream version string         /*{{{*/
 // ---------------------------------------------------------------------
 /* This strips all the debian specific information from the version number */
-string debVersioningSystem::UpstreamVersion(const char *Ver)
+std::string debVersioningSystem::UpstreamVersion(const char *Ver)
 {
    // Strip off the bit before the first colon
    const char *I = Ver;
@@ -266,6 +277,6 @@ string debVersioningSystem::UpstreamVersion(const char *Ver)
       if (*I == '-')
         Last = I - Ver;
    
-   return string(Ver,Last);
+   return std::string(Ver,Last);
 }
                                                                        /*}}}*/