summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:48 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:48 +0000
commit204fbdcce67a08d33a5e7eb3ca9e7a9ae80918c5 (patch)
treefef1ee61740101afa96ab907003385c9f6db0f08 /apt-pkg/deb
parent8b75eb1cadd4db3d6ecb27fa4f441843d3856f77 (diff)
Multiple different versions support
Author: jgg Date: 1999-05-23 22:55:54 GMT Multiple different versions support
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/deblistparser.cc37
-rw-r--r--apt-pkg/deb/deblistparser.h3
2 files changed, 38 insertions, 2 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 9adc60044..273b7fd42 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: deblistparser.cc,v 1.18 1999/04/12 19:16:11 jgg Exp $
+// $Id: deblistparser.cc,v 1.19 1999/05/23 22:55:54 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -14,6 +14,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/crc-16.h>
#include <system.h>
/*}}}*/
@@ -130,6 +131,40 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg,
return true;
}
/*}}}*/
+// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned short debListParser::VersionHash()
+{
+ const char *Sections[] ={"Installed-Size",
+ "Depends",
+ "Pre-Depends",
+ "Suggests",
+ "Recommends",
+ "Conflicts",
+ "Replaces",0};
+ unsigned long Result = INIT_FCS;
+ char S[300];
+ for (const char **I = Sections; *I != 0; I++)
+ {
+ const char *Start;
+ const char *End;
+ if (Section.Find(*I,Start,End) == false || End - Start >= (signed)sizeof(S))
+ continue;
+
+ /* Strip out any spaces from the text, this undoes dpkgs reformatting
+ of certain fields */
+ char *I = S;
+ for (; Start != End; Start++)
+ if (isspace(*Start) == 0)
+ *I++ = *Start;
+
+ Result = AddCRC16(Result,S,I - S);
+ }
+
+ return Result;
+}
+ /*}}}*/
// ListParser::ParseStatus - Parse the status field /*{{{*/
// ---------------------------------------------------------------------
/* Status lines are of the form,
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 6888c1a5e..3c8ea5b0a 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: deblistparser.h,v 1.6 1998/12/14 02:23:47 jgg Exp $
+// $Id: deblistparser.h,v 1.7 1999/05/23 22:55:55 jgg Exp $
/* ######################################################################
Debian Package List Parser - This implements the abstract parser
@@ -43,6 +43,7 @@ class debListParser : public pkgCacheGenerator::ListParser
virtual string Package();
virtual string Version();
virtual bool NewVersion(pkgCache::VerIterator Ver);
+ virtual unsigned short VersionHash();
virtual bool UsePackage(pkgCache::PkgIterator Pkg,
pkgCache::VerIterator Ver);
virtual unsigned long Offset() {return iOffset;};