]>
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/acquire-item.h>
23 // edspIndex::edspIndex - Constructor /*{{{*/
24 // ---------------------------------------------------------------------
26 edspIndex::edspIndex(string File
) : debStatusIndex(File
)
30 // StatusIndex::Merge - Load the index file into a cache /*{{{*/
31 bool edspIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const
35 Pkg
.Open(File
, FileFd::ReadOnly
);
37 Pkg
.OpenDescriptor(STDIN_FILENO
, FileFd::ReadOnly
);
38 if (_error
->PendingError() == true)
40 edspListParser
Parser(&Pkg
);
41 if (_error
->PendingError() == true)
45 Prog
->SubProgress(0,File
);
46 if (Gen
.SelectFile(File
,string(),*this) == false)
47 return _error
->Error("Problem with SelectFile %s",File
.c_str());
49 // Store the IMS information
50 pkgCache::PkgFileIterator CFile
= Gen
.GetCurFile();
52 if (fstat(Pkg
.Fd(),&St
) != 0)
53 return _error
->Errno("fstat","Failed to stat");
54 CFile
->Size
= St
.st_size
;
55 CFile
->mtime
= St
.st_mtime
;
56 CFile
->Archive
= Gen
.WriteUniqString("edsp::scenario");
58 if (Gen
.MergeList(Parser
) == false)
59 return _error
->Error("Problem with MergeList %s",File
.c_str());
63 // Index File types for APT /*{{{*/
64 class edspIFType
: public pkgIndexFile::Type
67 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator File
) const
69 // we don't have a record parser for this type as the file is not presistent
72 edspIFType() {Label
= "EDSP scenario file";};
74 static edspIFType _apt_Universe
;
76 const pkgIndexFile::Type
*edspIndex::GetType() const
78 return &_apt_Universe
;