]> git.saurik.com Git - apt.git/commitdiff
RPM version compare test program
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:57:49 +0000 (16:57 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:57:49 +0000 (16:57 +0000)
Author: jgg
Date: 2001-05-03 05:25:04 GMT
RPM version compare test program

apt-pkg/deb/debversion.h
test/makefile
test/rpmver.cc [new file with mode: 0644]

index d313f78a61461e3414d57faa9f2d6f97ddd46959..00a8832a893625e029ff6ccb8e23930808df2201 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: debversion.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
+// $Id: debversion.h,v 1.3 2001/05/03 05:25:04 jgg Exp $
 /* ######################################################################
 
    Debian Version - Versioning system for Debian
 #include <apt-pkg/version.h>
     
 class debVersioningSystem : public pkgVersioningSystem
-{  
+{     
+   public:
+   
    static int CmpFragment(const char *A, const char *AEnd, const char *B,
                          const char *BEnd);
    
-   public:
-   
    // Compare versions..
    virtual int DoCmpVersion(const char *A,const char *Aend,
                          const char *B,const char *Bend);
index 541f23834a8c0840eaa1ecca41167ac469970391..9ad6233c2d11997254751d8b005a65d226a677bb 100644 (file)
@@ -62,3 +62,8 @@ SLIBS = -lapt-pkg
 SOURCE = hash.cc
 include $(PROGRAM_H)
 
+# Program for checking rpm versions
+PROGRAM=rpmver
+SLIBS = -lapt-pkg -lrpm
+SOURCE = rpmver.cc
+include $(PROGRAM_H)
diff --git a/test/rpmver.cc b/test/rpmver.cc
new file mode 100644 (file)
index 0000000..be98260
--- /dev/null
@@ -0,0 +1,18 @@
+#include <apt-pkg/debversion.h>
+#include <rpm/rpmio.h>
+#include <rpm/misc.h>
+#include <stdlib.h>
+
+int main(int argc,const char *argv[])
+{
+   printf("'%s' <> '%s':  ",argv[1],argv[2]);
+   printf("rpm: %i   deb:  %i\n",rpmvercmp(argv[1],argv[2]),
+         debVS.CmpFragment(argv[1],argv[1]+strlen(argv[1]),
+                           argv[2],argv[2]+strlen(argv[2])));
+   
+   printf("'%s' <> '%s':  ",argv[2],argv[1]);
+   printf("rpm: %i   deb:  %i\n",rpmvercmp(argv[2],argv[1]),
+         debVS.CmpFragment(argv[2],argv[2]+strlen(argv[2]),
+                           argv[1],argv[1]+strlen(argv[1])));
+   return 0;
+}