]> git.saurik.com Git - apt.git/blame - apt-pkg/edsp/edspindexfile.cc
merge sources.list lines based on Release filename
[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>
6d38011b 13#include <apt-pkg/error.h>
472ff00e 14#include <apt-pkg/fileutl.h>
453b82a3 15#include <apt-pkg/indexfile.h>
453b82a3 16#include <apt-pkg/pkgcache.h>
453b82a3 17#include <apt-pkg/pkgrecords.h>
6d38011b 18
453b82a3
DK
19#include <stddef.h>
20#include <unistd.h>
21#include <string>
6d38011b
DK
22 /*}}}*/
23
d59671c9
DK
24// EDSP-like Index /*{{{*/
25edspLikeIndex::edspLikeIndex(std::string const &File) : pkgDebianIndexRealFile(File, true)
6d38011b
DK
26{
27}
d59671c9 28std::string edspLikeIndex::GetArchitecture() const
c9443c01
DK
29{
30 return std::string();
31}
d59671c9 32bool edspLikeIndex::HasPackages() const
c9443c01
DK
33{
34 return true;
35}
d59671c9 36bool edspLikeIndex::Exists() const
c9443c01
DK
37{
38 return true;
39}
d59671c9 40uint8_t edspLikeIndex::GetIndexFlags() const
c9443c01
DK
41{
42 return 0;
43}
d59671c9 44bool edspLikeIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
c9443c01 45{
7f58427b 46 if (FileName.empty() == false && FileName != "/nonexistent/stdin")
c9443c01
DK
47 return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
48 if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
49 return _error->Error("Problem opening %s",FileName.c_str());
6d38011b 50 return true;
d59671c9
DK
51}
52 /*}}}*/
53// EDSP Index /*{{{*/
54edspIndex::edspIndex(std::string const &File) : edspLikeIndex(File)
55{
56}
57std::string edspIndex::GetComponent() const
58{
59 return "edsp";
c9443c01
DK
60}
61pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
62{
63 if (Pkg.IsOpen() == false)
64 return NULL;
65 _error->PushToStack();
66 pkgCacheListParser * const Parser = new edspListParser(&Pkg);
67 bool const newError = _error->PendingError();
68 _error->MergeWithStack();
69 return newError ? NULL : Parser;
6d38011b
DK
70}
71 /*}}}*/
c9443c01 72
6d38011b 73// Index File types for APT /*{{{*/
dce45dbe 74class APT_HIDDEN edspIFType: public pkgIndexFile::Type
6d38011b
DK
75{
76 public:
c9443c01 77 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
6d38011b
DK
78 {
79 // we don't have a record parser for this type as the file is not presistent
80 return NULL;
81 };
e0a78caa 82 edspIFType() {Label = "EDSP scenario file";};
6d38011b 83};
c9443c01 84APT_HIDDEN edspIFType _apt_Edsp;
6d38011b
DK
85
86const pkgIndexFile::Type *edspIndex::GetType() const
87{
c9443c01 88 return &_apt_Edsp;
6d38011b
DK
89}
90 /*}}}*/
c8a4ce6c 91
d59671c9 92edspLikeIndex::~edspLikeIndex() {}
c8a4ce6c 93edspIndex::~edspIndex() {}