summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:50:50 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:50:50 +0000
commit8efa2a3ba4ae833415223a888e4561e57e4bf132 (patch)
tree3935e15c8802549d872c4f2569c0329739e3aea4 /apt-pkg
parent1164783d22d97e7ca0454e23faad8f8bb70a901d (diff)
downloadapt-8efa2a3ba4ae833415223a888e4561e57e4bf132.tar.gz
Working cache generator
Author: jgg Date: 1998-07-16 06:08:36 GMT Working cache generator
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.cc4
-rw-r--r--apt-pkg/deb/deblistparser.cc11
-rw-r--r--apt-pkg/init.cc6
-rw-r--r--apt-pkg/init.h4
-rw-r--r--apt-pkg/pkgcachegen.cc35
-rw-r--r--apt-pkg/tagfile.cc3
-rw-r--r--apt-pkg/tagfile.h4
7 files changed, 36 insertions, 31 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 14965f91..8c1f7005 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: strutl.cc,v 1.1 1998/07/07 04:17:16 jgg Exp $
+// $Id: strutl.cc,v 1.2 1998/07/16 06:08:41 jgg Exp $
/* ######################################################################
String Util - Some usefull string functions.
@@ -226,7 +226,7 @@ string TimeToStr(unsigned long Sec)
/* This replaces all occurances of Subst with Contents in Str. */
string SubstVar(string Str,string Subst,string Contents)
{
- string::size_type Pos;
+ string::size_type Pos = 0;
string::size_type OldPos = 0;
string Temp;
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 7587760b..f73adabc 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.6 1998/07/12 23:58:52 jgg Exp $
+// $Id: deblistparser.cc,v 1.7 1998/07/16 06:08:42 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -162,7 +162,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
return false;
- if (ParseDepends(Ver,"PreDepends",pkgCache::Dep::PreDepends) == false)
+ if (ParseDepends(Ver,"Pre-Depends",pkgCache::Dep::PreDepends) == false)
return false;
if (ParseDepends(Ver,"Suggests",pkgCache::Dep::Suggests) == false)
return false;
@@ -426,13 +426,16 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver,
string Version;
unsigned int Op;
- while ((Start = ParseDepends(Start,Stop,Package,Version,Op)) != Stop)
+ while (1)
{
+ Start = ParseDepends(Start,Stop,Package,Version,Op);
if (Start == 0)
return _error->Error("Problem parsing dependency %s",Tag);
-
+
if (NewDepends(Ver,Package,Version,Op,Type) == false)
return false;
+ if (Start == Stop)
+ break;
}
return true;
}
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index a93e65c1..63e80811 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: init.cc,v 1.2 1998/07/12 23:58:26 jgg Exp $
+// $Id: init.cc,v 1.3 1998/07/16 06:08:36 jgg Exp $
/* ######################################################################
Init - Initialize the package library
@@ -11,12 +11,12 @@
#include <apt-pkg/init.h>
/*}}}*/
-// pkglibInitialize - Initialize the configuration class /*{{{*/
+// pkgInitialize - Initialize the configuration class /*{{{*/
// ---------------------------------------------------------------------
/* Directories are specified in such a way that the FindDir function will
understand them. That is, if they don't start with a / then their parent
is prepended, this allows a fair degree of flexability. */
-bool pkglibInitialize(Configuration &Cnf)
+bool pkgInitialize(Configuration &Cnf)
{
// General APT things
Cnf.Set("APT::Architecture","i386");
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index ecfe702d..27bfd886 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: init.h,v 1.2 1998/07/12 23:58:27 jgg Exp $
+// $Id: init.h,v 1.3 1998/07/16 06:08:37 jgg Exp $
/* ######################################################################
Init - Initialize the package library
@@ -16,6 +16,6 @@
#include <apt-pkg/configuration.h>
-bool pkglibInitialize(Configuration &Cnf);
+bool pkgInitialize(Configuration &Cnf);
#endif
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index e0f8f3a1..452caa74 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.cc,v 1.9 1998/07/12 23:58:34 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.10 1998/07/16 06:08:38 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -69,12 +69,8 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
// Get a pointer to the package structure
string PackageName = List.Package();
pkgCache::PkgIterator Pkg;
- Cache.FindPkg(PackageName);
- if (Pkg.end() == true)
- {
- if (NewPackage(Pkg,PackageName) == false)
- return false;
- }
+ if (NewPackage(Pkg,PackageName) == false)
+ return false;
/* Get a pointer to the version structure. We know the list is sorted
so we use that fact in the search. Insertion of new versions is
@@ -132,6 +128,10 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
/* This creates a new package structure and adds it to the hash table */
bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,string Name)
{
+ Pkg = Cache.FindPkg(Name);
+ if (Pkg.end() == false)
+ return true;
+
// Get a structure
unsigned long Package = Map.Allocate(sizeof(pkgCache::Package));
if (Package == 0)
@@ -222,10 +222,9 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
Dep->ID = Cache.HeaderP->DependsCount++;
// Locate the target package
- pkgCache::PkgIterator Pkg = Cache.FindPkg(PackageName);
- if (Pkg.end() == true)
- if (Owner->NewPackage(Pkg,PackageName) == false)
- return false;
+ pkgCache::PkgIterator Pkg;
+ if (Owner->NewPackage(Pkg,PackageName) == false)
+ return false;
// Probe the reverse dependency list for a version string that matches
if (Version.empty() == false)
@@ -257,10 +256,14 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
// ---------------------------------------------------------------------
/* */
bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
- string PackageName,
+ string PackageName,
string Version)
{
pkgCache &Cache = Owner->Cache;
+
+ // We do not add self referencing provides
+ if (Ver.ParentPkg().Name() == PackageName)
+ return true;
// Get a structure
unsigned long Provides = Owner->Map.Allocate(sizeof(pkgCache::Provides));
@@ -276,10 +279,9 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
return false;
// Locate the target package
- pkgCache::PkgIterator Pkg = Cache.FindPkg(PackageName);
- if (Pkg.end() == true)
- if (Owner->NewPackage(Pkg,PackageName) == false)
- return false;
+ pkgCache::PkgIterator Pkg;
+ if (Owner->NewPackage(Pkg,PackageName) == false)
+ return false;
// Link it to the package
Prv->ParentPkg = Pkg.Index();
@@ -314,6 +316,7 @@ bool pkgCacheGenerator::SelectFile(string File,unsigned long Flags)
if (CurrentFile->FileName == 0)
return false;
+ return true;
}
/*}}}*/
// CacheGenerator::WriteUniqueString - Insert a unique string /*{{{*/
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 42a44453..9ae55b7d 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.cc,v 1.7 1998/07/12 23:58:39 jgg Exp $
+// $Id: tagfile.cc,v 1.8 1998/07/16 06:08:39 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -17,7 +17,6 @@
#include <apt-pkg/tagfile.h>
#include <apt-pkg/error.h>
-#include <apt-pkg/init.h>
#include <string>
#include <stdio.h>
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index 097eb73b..446b5bf1 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: tagfile.h,v 1.4 1998/07/12 23:58:40 jgg Exp $
+// $Id: tagfile.h,v 1.5 1998/07/16 06:08:40 jgg Exp $
/* ######################################################################
Fast scanner for RFC-822 type header information
@@ -50,7 +50,7 @@ class pkgTagSection
class pkgTagFile
{
- File Fd;
+ File &Fd;
char *Buffer;
char *Start;
char *End;