summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--cmdline/apt-cache.cc20
8 files changed, 50 insertions, 37 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 14965f91e..8c1f7005c 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 7587760b5..f73adabc0 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 a93e65c1a..63e808118 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 ecfe702d4..27bfd8868 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 e0f8f3a19..452caa74a 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 42a44453f..9ae55b7d8 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 097eb73bd..446b5bf12 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;
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index ce7ccc2c9..ac5dc17ca 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-cache.cc,v 1.1 1998/07/15 05:56:47 jgg Exp $
+// $Id: apt-cache.cc,v 1.2 1998/07/16 06:08:43 jgg Exp $
/* ######################################################################
apt-cache - Manages the cache file.
@@ -27,6 +27,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/init.h>
#include <iostream.h>
#include <fstream.h>
@@ -89,17 +90,19 @@ bool DoAdd(int argc,char *argv[])
{
if (SplitArg(argv[I],FileName,Dist,Ver) == false)
return false;
+ cout << FileName << endl;
// Do the merge
File TagF(FileName.c_str(),File::ReadOnly);
debListParser Parser(TagF);
if (_error->PendingError() == true)
- return false;
+ return _error->Error("Problem opening %s",FileName.c_str());
+
if (Gen.SelectFile(FileName) == false)
- return false;
+ return _error->Error("Problem with SelectFile");
if (Gen.MergeList(Parser) == false)
- return false;
+ return _error->Error("Problem with MergeList");
}
return true;
@@ -157,7 +160,11 @@ bool DumpPackage(int argc,char *argv[])
for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
cout << Prv.ParentPkg().Name() << " ";
cout << endl;
- }
+ }
+ cout << "Reverse Provides: " << endl;
+ for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
+ cout << Prv.OwnerPkg().Name() << " " << Prv.OwnerVer().VerStr();
+ cout << endl;
}
return true;
@@ -333,7 +340,8 @@ int main(int argc, char *argv[])
cerr << "Usage is apt-cache add cache file1:dist:ver file2:dist:ver ..." << endl;
return 100;
}
-
+
+ pkgInitialize(*_config);
while (1)
{
if (strcmp(argv[1],"add") == 0)