]>
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 /*{{{*/
9 #include <apt-pkg/edspindexfile.h>
10 #include <apt-pkg/edsplistparser.h>
11 #include <apt-pkg/sourcelist.h>
12 #include <apt-pkg/configuration.h>
13 #include <apt-pkg/progress.h>
14 #include <apt-pkg/error.h>
15 #include <apt-pkg/strutl.h>
16 #include <apt-pkg/acquire-item.h>
21 // edspIndex::edspIndex - Constructor /*{{{*/
22 // ---------------------------------------------------------------------
24 edspIndex::edspIndex(string File
) : debStatusIndex(File
)
28 // StatusIndex::Merge - Load the index file into a cache /*{{{*/
29 bool edspIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const
33 Pkg
.Open(File
, FileFd::ReadOnly
);
35 Pkg
.OpenDescriptor(STDIN_FILENO
, FileFd::ReadOnly
);
36 if (_error
->PendingError() == true)
38 edspListParser
Parser(&Pkg
);
39 if (_error
->PendingError() == true)
43 Prog
->SubProgress(0,File
);
44 if (Gen
.SelectFile(File
,string(),*this) == false)
45 return _error
->Error("Problem with SelectFile %s",File
.c_str());
47 // Store the IMS information
48 pkgCache::PkgFileIterator CFile
= Gen
.GetCurFile();
50 if (fstat(Pkg
.Fd(),&St
) != 0)
51 return _error
->Errno("fstat","Failed to stat");
52 CFile
->Size
= St
.st_size
;
53 CFile
->mtime
= St
.st_mtime
;
54 CFile
->Archive
= Gen
.WriteUniqString("edsp::scenario");
56 if (Gen
.MergeList(Parser
) == false)
57 return _error
->Error("Problem with MergeList %s",File
.c_str());
61 // Index File types for APT /*{{{*/
62 class edspIFType
: public pkgIndexFile::Type
65 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator File
) const
67 // we don't have a record parser for this type as the file is not presistent
70 edspIFType() {Label
= "EDSP scenario file";};
72 static edspIFType _apt_Universe
;
74 const pkgIndexFile::Type
*edspIndex::GetType() const
76 return &_apt_Universe
;