From 204fbdcce67a08d33a5e7eb3ca9e7a9ae80918c5 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:53:48 +0000 Subject: Multiple different versions support Author: jgg Date: 1999-05-23 22:55:54 GMT Multiple different versions support --- apt-pkg/deb/deblistparser.cc | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb/deblistparser.cc') 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 #include #include +#include #include /*}}}*/ @@ -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, -- cgit v1.2.3