1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
4 The scenario file is designed to work as an intermediate file between
5 APT and the resolver. Its on propose very similar to a dpkg status file
6 ##################################################################### */
8 // Include Files /*{{{*/
11 #include <apt-pkg/edspindexfile.h>
12 #include <apt-pkg/edsplistparser.h>
13 #include <apt-pkg/error.h>
14 #include <apt-pkg/fileutl.h>
15 #include <apt-pkg/progress.h>
16 #include <apt-pkg/debindexfile.h>
17 #include <apt-pkg/indexfile.h>
18 #include <apt-pkg/mmap.h>
19 #include <apt-pkg/pkgcache.h>
20 #include <apt-pkg/cacheiterators.h>
21 #include <apt-pkg/pkgcachegen.h>
22 #include <apt-pkg/pkgrecords.h>
30 edspIndex::edspIndex(std::string
const &File
) : pkgDebianIndexRealFile(File
, true), d(NULL
)
33 std::string
edspIndex::GetComponent() const
37 std::string
edspIndex::GetArchitecture() const
41 bool edspIndex::HasPackages() const
45 bool edspIndex::Exists() const
49 uint8_t edspIndex::GetIndexFlags() const
53 bool edspIndex::OpenListFile(FileFd
&Pkg
, std::string
const &FileName
)
55 if (FileName
.empty() == false && FileName
!= "stdin")
56 return pkgDebianIndexRealFile::OpenListFile(Pkg
, FileName
);
57 if (Pkg
.OpenDescriptor(STDIN_FILENO
, FileFd::ReadOnly
) == false)
58 return _error
->Error("Problem opening %s",FileName
.c_str());
61 pkgCacheListParser
* edspIndex::CreateListParser(FileFd
&Pkg
)
63 if (Pkg
.IsOpen() == false)
65 _error
->PushToStack();
66 pkgCacheListParser
* const Parser
= new edspListParser(&Pkg
);
67 bool const newError
= _error
->PendingError();
68 _error
->MergeWithStack();
69 return newError
? NULL
: Parser
;
73 // Index File types for APT /*{{{*/
74 class APT_HIDDEN edspIFType
: public pkgIndexFile::Type
77 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator
const &) const APT_OVERRIDE
79 // we don't have a record parser for this type as the file is not presistent
82 edspIFType() {Label
= "EDSP scenario file";};
84 APT_HIDDEN edspIFType _apt_Edsp
;
86 const pkgIndexFile::Type
*edspIndex::GetType() const
92 edspIndex::~edspIndex() {}