blob: 409117c5ef8c93c060f40d128f77a511f8752e74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
/* ######################################################################
The scenario file is designed to work as an intermediate file between
APT and the resolver. Its on propose very similar to a dpkg status file
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
#include <config.h>
#include <apt-pkg/edspindexfile.h>
#include <apt-pkg/edsplistparser.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <stddef.h>
#include <unistd.h>
#include <string>
/*}}}*/
// EDSP Index /*{{{*/
edspIndex::edspIndex(std::string const &File) : pkgDebianIndexRealFile(File, true), d(NULL)
{
}
std::string edspIndex::GetComponent() const
{
return "edsp";
}
std::string edspIndex::GetArchitecture() const
{
return std::string();
}
bool edspIndex::HasPackages() const
{
return true;
}
bool edspIndex::Exists() const
{
return true;
}
uint8_t edspIndex::GetIndexFlags() const
{
return 0;
}
bool edspIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
{
if (FileName.empty() == false && FileName != "stdin")
return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
return _error->Error("Problem opening %s",FileName.c_str());
return true;
}
pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
{
if (Pkg.IsOpen() == false)
return NULL;
_error->PushToStack();
pkgCacheListParser * const Parser = new edspListParser(&Pkg);
bool const newError = _error->PendingError();
_error->MergeWithStack();
return newError ? NULL : Parser;
}
/*}}}*/
// Index File types for APT /*{{{*/
class APT_HIDDEN edspIFType: public pkgIndexFile::Type
{
public:
virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
{
// we don't have a record parser for this type as the file is not presistent
return NULL;
};
edspIFType() {Label = "EDSP scenario file";};
};
APT_HIDDEN edspIFType _apt_Edsp;
const pkgIndexFile::Type *edspIndex::GetType() const
{
return &_apt_Edsp;
}
/*}}}*/
edspIndex::~edspIndex() {}
|