summaryrefslogtreecommitdiff
path: root/apt-pkg/edsp
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/edsp')
-rw-r--r--apt-pkg/edsp/edspindexfile.cc75
-rw-r--r--apt-pkg/edsp/edspindexfile.h16
-rw-r--r--apt-pkg/edsp/edspsystem.cc8
3 files changed, 54 insertions, 45 deletions
diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc
index 649d94b5d..a8a528131 100644
--- a/apt-pkg/edsp/edspindexfile.cc
+++ b/apt-pkg/edsp/edspindexfile.cc
@@ -26,59 +26,66 @@
#include <string>
/*}}}*/
-// edspIndex::edspIndex - Constructor /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-edspIndex::edspIndex(std::string File) : debStatusIndex(File), d(NULL)
+// EDSP Index /*{{{*/
+edspIndex::edspIndex(std::string const &File) : pkgDebianIndexRealFile(File, true), d(NULL)
{
}
- /*}}}*/
-// StatusIndex::Merge - Load the index file into a cache /*{{{*/
-bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
+std::string edspIndex::GetComponent() const
{
- FileFd Pkg;
- if (File != "stdin")
- Pkg.Open(File, FileFd::ReadOnly);
- else
- Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly);
- if (_error->PendingError() == true)
- return false;
- edspListParser Parser(&Pkg);
- if (_error->PendingError() == true)
- return false;
-
- if (Prog != NULL)
- Prog->SubProgress(0,File);
- if (Gen.SelectFile(File, *this, "", "edsp") == false)
- return _error->Error("Problem with SelectFile %s",File.c_str());
-
- // Store the IMS information
- pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
- pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(CFile);
- CFile->Size = Pkg.FileSize();
- CFile->mtime = Pkg.ModificationTime();
-
- if (Gen.MergeList(Parser) == false)
- return _error->Error("Problem with MergeList %s",File.c_str());
+ return "edsp";
+}
+std::string edspIndex::GetArchitecture() const
+{
+ return std::string();
+}
+bool edspIndex::HasPackages() const
+{
+ return true;
+}
+bool edspIndex::Exists() const
+{
+ return true;
+}
+uint8_t edspIndex::GetIndexFlags() const
+{
+ return 0;
+}
+bool edspIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
+{
+ if (FileName.empty() == false && FileName != "stdin")
+ return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
+ if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
+ return _error->Error("Problem opening %s",FileName.c_str());
return true;
}
+pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
+{
+ if (Pkg.IsOpen() == false)
+ return NULL;
+ _error->PushToStack();
+ pkgCacheListParser * const Parser = new edspListParser(&Pkg);
+ bool const newError = _error->PendingError();
+ _error->MergeWithStack();
+ return newError ? NULL : Parser;
+}
/*}}}*/
+
// Index File types for APT /*{{{*/
class APT_HIDDEN edspIFType: public pkgIndexFile::Type
{
public:
- virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator) const APT_OVERRIDE
+ virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
{
// we don't have a record parser for this type as the file is not presistent
return NULL;
};
edspIFType() {Label = "EDSP scenario file";};
};
-APT_HIDDEN edspIFType _apt_Universe;
+APT_HIDDEN edspIFType _apt_Edsp;
const pkgIndexFile::Type *edspIndex::GetType() const
{
- return &_apt_Universe;
+ return &_apt_Edsp;
}
/*}}}*/
diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h
index b2a510f14..edf799023 100644
--- a/apt-pkg/edsp/edspindexfile.h
+++ b/apt-pkg/edsp/edspindexfile.h
@@ -18,18 +18,24 @@
class OpProgress;
class pkgCacheGenerator;
-class APT_HIDDEN edspIndex : public debStatusIndex
+class APT_HIDDEN edspIndex : public pkgDebianIndexRealFile
{
/** \brief dpointer placeholder (for later in case we need it) */
void * const d;
- public:
+protected:
+ APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
+ virtual bool OpenListFile(FileFd &Pkg, std::string const &File) APT_OVERRIDE;
+ virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
+ virtual std::string GetComponent() const APT_OVERRIDE;
+ virtual std::string GetArchitecture() const APT_OVERRIDE;
+public:
virtual const Type *GetType() const APT_CONST;
+ virtual bool Exists() const APT_OVERRIDE;
+ virtual bool HasPackages() const APT_OVERRIDE;
- virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE;
-
- edspIndex(std::string File);
+ edspIndex(std::string const &File);
virtual ~edspIndex();
};
diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc
index f65fcc0d2..c4583252f 100644
--- a/apt-pkg/edsp/edspsystem.cc
+++ b/apt-pkg/edsp/edspsystem.cc
@@ -81,13 +81,9 @@ bool edspSystem::ArchiveSupported(const char * /*Type*/)
return false;
}
/*}}}*/
-// System::Score - Determine if we should use the edsp system /*{{{*/
-signed edspSystem::Score(Configuration const &Cnf)
+// System::Score - Never use the EDSP system automatically /*{{{*/
+signed edspSystem::Score(Configuration const &)
{
- if (Cnf.Find("edsp::scenario", "") == "stdin")
- return 1000;
- if (RealFileExists(Cnf.FindFile("edsp::scenario","")) == true)
- return 1000;
return -1000;
}
/*}}}*/