]> git.saurik.com Git - apt.git/commitdiff
* Get self-tests compiling again, updated for latest li...
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:03:13 +0000 (17:03 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:03:13 +0000 (17:03 +0000)
Author: mdz
Date: 2003-08-18 15:32:37 GMT
* Get self-tests compiling again, updated for latest library API
and g++ 3.3

debian/changelog
test/conf.cc
test/extract-control.cc
test/rpmver.cc
test/scratch.cc
test/testextract.cc
test/versions.lst
test/versiontest.cc

index a45edece0c1feb62d4d69337c6eddd38539e6a89..f664a9c6c3135f72dc56d0012a953f3a90ca4569 100644 (file)
@@ -4,8 +4,10 @@ apt (0.5.10) unstable; urgency=low
     to show that zero is not a valid priority, and print a warning if such
     a pin is encountered in the preferences file (Closes: #204971)
   * Regenerate French man pages from sgml source (Closes: #205886)
+  * Get self-tests compiling again, updated for latest library API
+    and g++ 3.3
 
- --
+ -- 
 
 apt (0.5.9) unstable; urgency=low
 
index c44161426272fa651dea5aafe9518ccb0e8df4c1..340647b5f6058e29b0bda774dd5d88e977a585b5 100644 (file)
@@ -1,6 +1,8 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 
+using namespace std;
+
 int main(int argc,const char *argv[])
 {
    Configuration Cnf;
index 1250888964ce56e287760d01520c043ed40e6da8..29dcbf371bdaf68663dcfb753f0815269bc2fd15 100644 (file)
@@ -4,6 +4,8 @@
 #include <iostream>
 #include <unistd.h>
 
+using namespace std;
+
 bool ExtractMember(const char *File,const char *Member)
 {
    FileFd Fd(File,FileFd::ReadOnly);
index c76c77bd1830a167c73dc2aa2b16c1526d023a48..9fc807de8048dffeb3f3fee0c8480d5a9d0c4446 100644 (file)
@@ -8,6 +8,8 @@
 #define xisalpha(x) isalpha(x)
 #define xisalnum(x) (isdigit(x) || isalpha(x))
 
+using namespace std;
+
 int rpmvercmp(const char * a, const char * b)
 {
     char oldch1, oldch2;
index b5260815033faf3acc7de1e632c61d6610b701cc..d638c70972e454bf930b243a9628c77d84209d17 100644 (file)
@@ -1,4 +1,3 @@
-#define APT_COMPATIBILITY 1
 #include <apt-pkg/dpkgdb.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/error.h>
@@ -8,9 +7,12 @@
 #include <apt-pkg/init.h>
 #include <apt-pkg/fileutl.h>
 
+using namespace std;
+
 int main(int argc,char *argv[])
 {
-   pkgInitialize(*_config);
+   pkgInitConfig(*_config);
+   pkgInitSystem(*_config,_system);
 
 //   cout << flNoLink(argv[1]) << endl;
    
index 41a197068f589d0d8f00807b77abf63ca5ab9cec..1c738aab99b4608f952ec9882b29fad69c2cf2cb 100644 (file)
@@ -1,4 +1,3 @@
-#define APT_COMPATIBILITY 1
 #include <apt-pkg/dpkgdb.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/error.h>
@@ -11,6 +10,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+using namespace std;
+
 bool Go(int argc,char *argv[])
 {
    // Init the database
@@ -83,7 +84,8 @@ bool Go(int argc,char *argv[])
 
 int main(int argc,char *argv[])
 {
-   pkgInitialize(*_config);
+   pkgInitConfig(*_config);
+   pkgInitSystem(*_config,_system);
    _config->Set("Dir::State::status","/tmp/testing/status");
 
    Go(argc,argv);
index da842844963a55988fa909e58a03900f03ed50d3..008a0f2d797ff23422e3a9344978f8986860ad2a 100644 (file)
@@ -36,3 +36,9 @@ z . -1
 0.4a6-2 0.4-1 1
 
 1:3.0.5-2 1:3.0.5.1 -1
+
+# #194327
+III-alpha9.8 III-alpha9.8-1.5 -1
+
+# #205960
+3.0~rc1-1 3.0-1 -1
index 3f90adf05ef36e934309143ed4bca8054c2afca3..7ce32e20b7ef7ed96cc70354be92ccfc506c6bba 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: versiontest.cc,v 1.3 2002/03/26 07:38:58 jgg Exp $
+// $Id: versiontest.cc,v 1.4 2003/08/18 15:32:38 mdz Exp $
 /* ######################################################################
 
    Version Test - Simple program to run through a file and comare versions.
    
    ##################################################################### */
                                                                        /*}}}*/
-#define APT_COMPATIBILITY 1
 #include <system.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/version.h>
+#include <apt-pkg/debversion.h>
 #include <iostream>
 #include <fstream>
 
+using namespace std;
+
   static int verrevcmp(const char *val, const char *ref) 
 {
    int vc, rc;
@@ -132,7 +134,7 @@ static int verrevcmp(const char *val, const char *ref)
     
 bool RunTest(const char *File)
 {
-   ifstream F(File,ios::in | ios::nocreate);
+   ifstream F(File,ios::in);
    if (!F != 0)
       return false;
 
@@ -173,17 +175,30 @@ bool RunTest(const char *File)
       // Result
       I++;
       int Expected = atoi(I);
-      int Res = pkgVersionCompare(A.c_str(),B.c_str());
+      int Res = debVS.CmpVersion(A.c_str(), B.c_str());
       int Res2 = verrevcmp(A.c_str(),B.c_str());
       cout << "'" << A << "' ? '" << B << "' = " << Res << " (= " << Expected << ") " << Res2 << endl;
+
+      if (Res < 0)
+           Res = -1;
+      else if (Res > 0)
+           Res = 1;
+
       if (Res != Expected)
         _error->Error("Comparison failed on line %u. '%s' ? '%s' %i != %i",CurLine,A.c_str(),B.c_str(),Res,Expected);
 
       // Check the reverse as well
       Expected = -1*Expected;
-      Res = pkgVersionCompare(B.c_str(),A.c_str());
+      Res = debVS.CmpVersion(B.c_str(), A.c_str());
       Res2 = verrevcmp(B.c_str(),A.c_str());
+
       cout << "'" << B << "' ? '" << A << "' = " << Res << " (= " << Expected << ") " << Res2 << endl;
+
+      if (Res < 0)
+           Res = -1;
+      else if (Res > 0)
+           Res = 1;
+
       if (Res != Expected)
         _error->Error("Comparison failed on line %u. '%s' ? '%s' %i != %i",CurLine,A.c_str(),B.c_str(),Res,Expected);
    }