]>
git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edspindexfile.cc
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/sourcelist.h>
14 #include <apt-pkg/configuration.h>
15 #include <apt-pkg/progress.h>
16 #include <apt-pkg/error.h>
17 #include <apt-pkg/strutl.h>
18 #include <apt-pkg/fileutl.h>
19 #include <apt-pkg/acquire-item.h>
24 // edspIndex::edspIndex - Constructor /*{{{*/
25 // ---------------------------------------------------------------------
27 edspIndex::edspIndex(std::string File
) : debStatusIndex(File
)
31 // StatusIndex::Merge - Load the index file into a cache /*{{{*/
32 bool edspIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const
36 Pkg
.Open(File
, FileFd::ReadOnly
);
38 Pkg
.OpenDescriptor(STDIN_FILENO
, FileFd::ReadOnly
);
39 if (_error
->PendingError() == true)
41 edspListParser
Parser(&Pkg
);
42 if (_error
->PendingError() == true)
46 Prog
->SubProgress(0,File
);
47 if (Gen
.SelectFile(File
,std::string(),*this) == false)
48 return _error
->Error("Problem with SelectFile %s",File
.c_str());
50 // Store the IMS information
51 pkgCache::PkgFileIterator CFile
= Gen
.GetCurFile();
52 CFile
->Size
= Pkg
.FileSize();
53 CFile
->mtime
= Pkg
.ModificationTime();
54 map_ptrloc
const storage
= Gen
.WriteUniqString("edsp::scenario");
55 CFile
->Archive
= storage
;
57 if (Gen
.MergeList(Parser
) == false)
58 return _error
->Error("Problem with MergeList %s",File
.c_str());
62 // Index File types for APT /*{{{*/
63 class edspIFType
: public pkgIndexFile::Type
66 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator File
) const
68 // we don't have a record parser for this type as the file is not presistent
71 edspIFType() {Label
= "EDSP scenario file";};
73 static edspIFType _apt_Universe
;
75 const pkgIndexFile::Type
*edspIndex::GetType() const
77 return &_apt_Universe
;