X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3b3028467ceccca0b73a8f53051c0fa4de313111..4adc750a2a8d0c6b2c03353b5538bc7446020f68:/apt-pkg/edsp/edspindexfile.cc diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 649d94b5d..042a88cf9 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -12,13 +12,8 @@ #include #include #include -#include -#include #include -#include #include -#include -#include #include #include @@ -26,60 +21,108 @@ #include /*}}}*/ -// edspIndex::edspIndex - Constructor /*{{{*/ -// --------------------------------------------------------------------- -/* */ -edspIndex::edspIndex(std::string File) : debStatusIndex(File), d(NULL) +// EDSP-like Index /*{{{*/ +edspLikeIndex::edspLikeIndex(std::string const &File) : pkgDebianIndexRealFile(File, true) { } - /*}}}*/ -// StatusIndex::Merge - Load the index file into a cache /*{{{*/ -bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) 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 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()); +std::string edspLikeIndex::GetArchitecture() const +{ + return std::string(); +} +bool edspLikeIndex::HasPackages() const +{ + return true; +} +bool edspLikeIndex::Exists() const +{ + return true; +} +uint8_t edspLikeIndex::GetIndexFlags() const +{ + return 0; +} +bool edspLikeIndex::OpenListFile(FileFd &Pkg, std::string const &FileName) +{ + if (FileName.empty() == false && FileName != "/nonexistent/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; } /*}}}*/ +// EDSP Index /*{{{*/ +edspIndex::edspIndex(std::string const &File) : edspLikeIndex(File) +{ +} +std::string edspIndex::GetComponent() const +{ + return "edsp"; +} +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; +} + /*}}}*/ +// EIPP Index /*{{{*/ +eippIndex::eippIndex(std::string const &File) : edspLikeIndex(File) +{ +} +std::string eippIndex::GetComponent() const +{ + return "eipp"; +} +pkgCacheListParser * eippIndex::CreateListParser(FileFd &Pkg) +{ + if (Pkg.IsOpen() == false) + return NULL; + _error->PushToStack(); + pkgCacheListParser * const Parser = new eippListParser(&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; +} + +class APT_HIDDEN eippIFType: public pkgIndexFile::Type +{ + public: + 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; + }; + eippIFType() {Label = "EIPP scenario file";}; +}; +APT_HIDDEN eippIFType _apt_Eipp; +const pkgIndexFile::Type *eippIndex::GetType() const +{ + return &_apt_Eipp; } /*}}}*/ +edspLikeIndex::~edspLikeIndex() {} edspIndex::~edspIndex() {} +eippIndex::~eippIndex() {}