apt: apt-pkg/deb/debindexfile.h Source File

apt 2.7.6 commandline package manager

debindexfile.h
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 Debian Index Files
6
7 There are three sorts currently
8
9 Package files that have File: tags
10 Package files that don't (/var/lib/dpkg/status)
11 Source files
12
13 ##################################################################### */
14 /*}}}*/
15#ifndef PKGLIB_DEBINDEXFILE_H
16#define PKGLIB_DEBINDEXFILE_H
17
18#include <apt-pkg/indexfile.h>
19#include <apt-pkg/pkgcache.h>
20#include <apt-pkg/srcrecords.h>
21
22#include <string>
23
24class OpProgress;
25class pkgAcquire;
26class pkgCacheGenerator;
27
28 class debStatusIndex : public pkgDebianIndexRealFile
29{
30 void * const d;
31protected:
32 virtual std::string GetArchitecture() const APT_OVERRIDE;
33 virtual std::string GetComponent() const APT_OVERRIDE;
34 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
35
36public:
37
38 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
39
40 // Interface for the Cache Generator
41 virtual bool HasPackages() const APT_OVERRIDE {return true;};
42 // Abort if the file does not exist.
43 virtual bool Exists() const APT_OVERRIDE {return true;};
44
45 virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
46
47 explicit debStatusIndex(std::string const &File);
48 virtual ~debStatusIndex();
49};
50
51 class debPackagesIndex : public pkgDebianIndexTargetFile
52{
53 void * const d;
54protected:
55 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
56
57public:
58 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
59
60 // Stuff for accessing files on remote items
61 virtual std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const APT_OVERRIDE;
62
63 // Interface for the Cache Generator
64 virtual bool HasPackages() const APT_OVERRIDE {return true;};
65
66 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
67 virtual ~debPackagesIndex();
68};
69
70 class debTranslationsIndex : public pkgDebianIndexTargetFile
71{
72 void * const d;
73protected:
74 virtual std::string GetArchitecture() const APT_OVERRIDE;
75 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
76 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
77 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
78
79public:
80
81 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
82
83 // Interface for the Cache Generator
84 virtual bool HasPackages() const APT_OVERRIDE;
85
86 explicit debTranslationsIndex(IndexTarget const &Target);
87 virtual ~debTranslationsIndex();
88};
89
90 class debSourcesIndex : public pkgDebianIndexTargetFile
91{
92 void * const d;
93 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
94 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
95 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
96
97 public:
98
99 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
100
101 // Stuff for accessing files on remote items
102 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
103 pkgSrcRecords::File const &File) const APT_OVERRIDE;
104
105 // Interface for the record parsers
106 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
107
108 // Interface for the Cache Generator
109 virtual bool HasPackages() const APT_OVERRIDE {return false;};
110
111 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
112 virtual ~debSourcesIndex();
113};
114
115 class debDebPkgFileIndex : public pkgDebianIndexRealFile
116{
117 void * const d;
118 std::string DebFile;
119
120protected:
121 virtual std::string GetComponent() const APT_OVERRIDE;
122 virtual std::string GetArchitecture() const APT_OVERRIDE;
123 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
124 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
125 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
126
127public:
128 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
129
136 static bool GetContent(std::ostream &content, std::string const &debfile);
137
138 // Interface for the Cache Generator
139 virtual bool HasPackages() const APT_OVERRIDE {return true;}
140 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE;
141
142 // Interface for acquire
143
144 explicit debDebPkgFileIndex(std::string const &DebFile);
145 virtual ~debDebPkgFileIndex();
146
147 std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
148};
149
150 class APT_PUBLIC debDscFileIndex : public pkgDebianIndexRealFile
151{
152 void * const d;
153
154protected:
155 virtual std::string GetComponent() const APT_OVERRIDE;
156 virtual std::string GetArchitecture() const APT_OVERRIDE;
157 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
158
159public:
160 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
161 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
162 virtual bool HasPackages() const APT_OVERRIDE {return false;};
163
164 explicit debDscFileIndex(std::string const &DscFile);
165 virtual ~debDscFileIndex();
166};
167
168 class debDebianSourceDirIndex : public debDscFileIndex
169{
170protected:
171 virtual std::string GetComponent() const APT_OVERRIDE;
172
173public:
174 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
175};
176
177 class APT_PUBLIC debStringPackageIndex : public pkgDebianIndexRealFile
178{
179 void * const d;
180protected:
181 virtual std::string GetArchitecture() const APT_OVERRIDE;
182 virtual std::string GetComponent() const APT_OVERRIDE;
183 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
184
185public:
186 virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
187
188 // Interface for the Cache Generator
189 virtual bool HasPackages() const APT_OVERRIDE {return true;};
190 // Abort if the file does not exist.
191 virtual bool Exists() const APT_OVERRIDE {return true;};
192
193 explicit debStringPackageIndex(std::string const &content);
194 virtual ~debStringPackageIndex();
195};
196#endif
FileFd
Definition fileutl.h:41
IndexTarget
Information about an index file.
Definition indexfile.h:39
OpProgress
Definition progress.h:30
debDebPkgFileIndex
Definition debindexfile.h:116
debDebPkgFileIndex::GetContent
static bool GetContent(std::ostream &content, std::string const &debfile)
Definition debindexfile.cc:172
debDebianSourceDirIndex
Definition debindexfile.h:169
debDscFileIndex
Definition debindexfile.h:151
debPackagesIndex
Definition debindexfile.h:52
debSourcesIndex
Definition debindexfile.h:91
debStatusIndex
Definition debindexfile.h:29
debStringPackageIndex
Definition debindexfile.h:178
debTranslationsIndex
Definition debindexfile.h:71
pkgAcquire
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition acquire-item.h:59
pkgCacheGenerator
Definition pkgcachegen.h:43
pkgCacheListParser
Definition pkgcachegen.h:178
pkgCache
Definition cacheiterators.h:47
pkgDebianIndexRealFile
Definition indexfile.h:197
pkgDebianIndexTargetFile
Definition indexfile.h:174
pkgIndexFile::Type
Definition indexfile.h:111
pkgSrcRecords::Parser
Definition srcrecords.h:39
pkgcache.h
pkgCache - Structure definitions for the cache file
pkgSrcRecords::File
Definition srcrecords.h:30