summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
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/deblistparser.cc
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/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc37
1 files changed, 36 insertions, 1 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,