summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debindexfile.cc21
-rw-r--r--apt-pkg/deb/debindexfile.h8
-rw-r--r--apt-pkg/deb/debsystem.cc31
-rw-r--r--apt-pkg/deb/debsystem.h8
4 files changed, 54 insertions, 14 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 2cc1de8a1..38316d17e 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: debindexfile.cc,v 1.4 2001/03/13 06:51:46 jgg Exp $
+// $Id: debindexfile.cc,v 1.5 2001/04/29 05:13:51 jgg Exp $
/* ######################################################################
Debian Specific sources.list types and the three sorts of Debian
@@ -74,11 +74,15 @@ pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const
// SourcesIndex::Describe - Give a descriptive path to the index /*{{{*/
// ---------------------------------------------------------------------
/* */
-string debSourcesIndex::Describe() const
+string debSourcesIndex::Describe(bool Short) const
{
char S[300];
- snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(),
- IndexFile("Sources").c_str());
+ if (Short == true)
+ snprintf(S,sizeof(S),"%s",Info("Packages").c_str());
+ else
+ snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(),
+ IndexFile("Sources").c_str());
+
return S;
}
/*}}}*/
@@ -188,11 +192,14 @@ string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const
// ---------------------------------------------------------------------
/* This should help the user find the index in the sources.list and
in the filesystem for problem solving */
-string debPackagesIndex::Describe() const
+string debPackagesIndex::Describe(bool Short) const
{
char S[300];
- snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(),
- IndexFile("Packages").c_str());
+ if (Short == true)
+ snprintf(S,sizeof(S),"%s",Info("Packages").c_str());
+ else
+ snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(),
+ IndexFile("Packages").c_str());
return S;
}
/*}}}*/
diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h
index b4dee3c22..9bce4da83 100644
--- a/apt-pkg/deb/debindexfile.h
+++ b/apt-pkg/deb/debindexfile.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: debindexfile.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
+// $Id: debindexfile.h,v 1.3 2001/04/29 05:13:51 jgg Exp $
/* ######################################################################
Debian Index Files
@@ -31,7 +31,7 @@ class debStatusIndex : public pkgIndexFile
virtual const Type *GetType() const;
// Interface for acquire
- virtual string Describe() const {return File;};
+ virtual string Describe(bool Short) const {return File;};
// Interface for the Cache Generator
virtual bool Exists() const;
@@ -62,7 +62,7 @@ class debPackagesIndex : public pkgIndexFile
virtual string ArchiveURI(string File) const {return URI + File;};
// Interface for acquire
- virtual string Describe() const;
+ virtual string Describe(bool Short) const;
virtual bool GetIndexes(pkgAcquire *Owner) const;
// Interface for the Cache Generator
@@ -95,7 +95,7 @@ class debSourcesIndex : public pkgIndexFile
virtual string ArchiveURI(string File) const {return URI + File;};
// Interface for acquire
- virtual string Describe() const;
+ virtual string Describe(bool Short) const;
virtual bool GetIndexes(pkgAcquire *Owner) const;
// Interface for the record parsers
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 0abd4c8aa..5a4cbe654 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: debsystem.cc,v 1.2 2001/02/20 07:03:17 jgg Exp $
+// $Id: debsystem.cc,v 1.3 2001/04/29 05:13:51 jgg Exp $
/* ######################################################################
System - Abstraction for running on different systems.
@@ -42,6 +42,14 @@ debSystem::debSystem()
VS = &debVS;
}
/*}}}*/
+// System::~debSystem - Destructor /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+debSystem::~debSystem()
+{
+ delete StatusFile;
+}
+ /*}}}*/
// System::Lock - Get the lock /*{{{*/
// ---------------------------------------------------------------------
/* This mirrors the operations dpkg does when it starts up. Note the
@@ -191,7 +199,26 @@ signed debSystem::Score(Configuration const &Cnf)
/* */
bool debSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
{
- List.push_back(new debStatusIndex(_config->FindFile("Dir::State::status")));
+ if (StatusFile == 0)
+ StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status"));
+ List.push_back(StatusFile);
return true;
}
/*}}}*/
+// System::FindIndex - Get an index file for status files /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool debSystem::FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const
+{
+ if (StatusFile == 0)
+ return false;
+ if (StatusFile->FindInCache(*File.Cache()) == File)
+ {
+ Found = StatusFile;
+ return true;
+ }
+
+ return false;
+}
+ /*}}}*/
diff --git a/apt-pkg/deb/debsystem.h b/apt-pkg/deb/debsystem.h
index 4fd267f77..c4e27ced3 100644
--- a/apt-pkg/deb/debsystem.h
+++ b/apt-pkg/deb/debsystem.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: debsystem.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
+// $Id: debsystem.h,v 1.3 2001/04/29 05:13:51 jgg Exp $
/* ######################################################################
System - Debian version of the System Class
@@ -16,6 +16,7 @@
#include <apt-pkg/pkgsystem.h>
+class debStatusIndex;
class debSystem : public pkgSystem
{
// For locking support
@@ -23,6 +24,8 @@ class debSystem : public pkgSystem
unsigned LockCount;
bool CheckUpdates();
+ debStatusIndex *StatusFile;
+
public:
virtual bool Lock();
@@ -32,8 +35,11 @@ class debSystem : public pkgSystem
virtual bool ArchiveSupported(const char *Type);
virtual signed Score(Configuration const &Cnf);
virtual bool AddStatusFiles(vector<pkgIndexFile *> &List);
+ virtual bool FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const;
debSystem();
+ ~debSystem();
};
extern debSystem debSys;