]> git.saurik.com Git - apt.git/blame - apt-pkg/edsp/edspindexfile.cc
[ABI-Break] remove the PACKAGE_MATCHER_ABI_COMPAT defines
[apt.git] / apt-pkg / edsp / edspindexfile.cc
CommitLineData
6d38011b
DK
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
e0a78caa 4 The scenario file is designed to work as an intermediate file between
6d38011b
DK
5 APT and the resolver. Its on propose very similar to a dpkg status file
6 ##################################################################### */
7 /*}}}*/
8// Include Files /*{{{*/
ea542140
DK
9#include <config.h>
10
6d38011b
DK
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>
472ff00e 18#include <apt-pkg/fileutl.h>
6d38011b
DK
19#include <apt-pkg/acquire-item.h>
20
21#include <sys/stat.h>
22 /*}}}*/
23
24// edspIndex::edspIndex - Constructor /*{{{*/
25// ---------------------------------------------------------------------
26/* */
73688d27 27edspIndex::edspIndex(std::string File) : debStatusIndex(File)
6d38011b
DK
28{
29}
30 /*}}}*/
31// StatusIndex::Merge - Load the index file into a cache /*{{{*/
32bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
33{
41ceaf02
DK
34 FileFd Pkg;
35 if (File != "stdin")
36 Pkg.Open(File, FileFd::ReadOnly);
37 else
38 Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly);
6d38011b
DK
39 if (_error->PendingError() == true)
40 return false;
41 edspListParser Parser(&Pkg);
42 if (_error->PendingError() == true)
43 return false;
44
45 if (Prog != NULL)
46 Prog->SubProgress(0,File);
73688d27 47 if (Gen.SelectFile(File,std::string(),*this) == false)
6d38011b
DK
48 return _error->Error("Problem with SelectFile %s",File.c_str());
49
50 // Store the IMS information
51 pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
76a763e1
DK
52 CFile->Size = Pkg.FileSize();
53 CFile->mtime = Pkg.ModificationTime();
2b803d40
DK
54 map_ptrloc const storage = Gen.WriteUniqString("edsp::scenario");
55 CFile->Archive = storage;
6d38011b
DK
56
57 if (Gen.MergeList(Parser) == false)
58 return _error->Error("Problem with MergeList %s",File.c_str());
59 return true;
60}
61 /*}}}*/
62// Index File types for APT /*{{{*/
63class edspIFType: public pkgIndexFile::Type
64{
65 public:
66 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
67 {
68 // we don't have a record parser for this type as the file is not presistent
69 return NULL;
70 };
e0a78caa 71 edspIFType() {Label = "EDSP scenario file";};
6d38011b
DK
72};
73static edspIFType _apt_Universe;
74
75const pkgIndexFile::Type *edspIndex::GetType() const
76{
77 return &_apt_Universe;
78}
79 /*}}}*/