summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/version.cc23
-rw-r--r--apt-pkg/version.h3
2 files changed, 24 insertions, 2 deletions
diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc
index f3ebb556e..4aad581f8 100644
--- a/apt-pkg/version.cc
+++ b/apt-pkg/version.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: version.cc,v 1.8 1998/12/05 01:44:57 jgg Exp $
+// $Id: version.cc,v 1.9 1999/04/19 06:03:09 jgg Exp $
/* ######################################################################
Version - Version string
@@ -248,3 +248,24 @@ bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op)
return false;
}
/*}}}*/
+// BaseVersion - Return the upstream version string /*{{{*/
+// ---------------------------------------------------------------------
+/* This strips all the debian specific information from the version number */
+string pkgBaseVersion(const char *Ver)
+{
+ // Strip off the bit before the first colon
+ const char *I = Ver;
+ for (; *I != 0 && *I != ':'; I++);
+ if (*I == ':')
+ Ver = I + 1;
+
+ // Chop off the trailing -
+ I = Ver;
+ unsigned Last = strlen(Ver);
+ for (; *I != 0; I++)
+ if (*I == '-')
+ Last = I - Ver;
+
+ return string(Ver,Last);
+}
+ /*}}}*/
diff --git a/apt-pkg/version.h b/apt-pkg/version.h
index ba7eb592d..127519583 100644
--- a/apt-pkg/version.h
+++ b/apt-pkg/version.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: version.h,v 1.4 1998/07/19 21:24:19 jgg Exp $
+// $Id: version.h,v 1.5 1999/04/19 06:03:09 jgg Exp $
/* ######################################################################
Version - Version comparison routines
@@ -25,5 +25,6 @@ int pkgVersionCompare(const char *A, const char *AEnd, const char *B,
const char *BEnd);
int pkgVersionCompare(string A,string B);
bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op);
+string pkgBaseVersion(const char *Ver);
#endif