]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/deb/debindexfile.h
add support for Build-Depends/Conflicts-Arch
[apt.git] / apt-pkg / deb / debindexfile.h
... / ...
CommitLineData
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/cacheiterators.h>
20#include <apt-pkg/pkgcache.h>
21#include <apt-pkg/srcrecords.h>
22
23#include <string>
24
25class OpProgress;
26class pkgAcquire;
27class pkgCacheGenerator;
28
29class debStatusIndex : public pkgDebianIndexRealFile
30{
31 void * const d;
32protected:
33 virtual std::string GetArchitecture() const APT_OVERRIDE;
34 virtual std::string GetComponent() const APT_OVERRIDE;
35 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
36
37public:
38
39 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
40
41 // Interface for the Cache Generator
42 virtual bool HasPackages() const APT_OVERRIDE {return true;};
43 // Abort if the file does not exist.
44 virtual bool Exists() const APT_OVERRIDE {return true;};
45
46 virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
47
48 debStatusIndex(std::string const &File);
49 virtual ~debStatusIndex();
50};
51
52class debPackagesIndex : public pkgDebianIndexTargetFile
53{
54 void * const d;
55protected:
56 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
57
58public:
59 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
60
61 // Stuff for accessing files on remote items
62 virtual std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const APT_OVERRIDE;
63
64 // Interface for the Cache Generator
65 virtual bool HasPackages() const APT_OVERRIDE {return true;};
66
67 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
68 virtual ~debPackagesIndex();
69};
70
71class debTranslationsIndex : public pkgDebianIndexTargetFile
72{
73 void * const d;
74protected:
75 virtual std::string GetArchitecture() const APT_OVERRIDE;
76 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
77 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
78 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
79
80public:
81
82 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
83
84 // Interface for the Cache Generator
85 virtual bool HasPackages() const APT_OVERRIDE;
86
87 debTranslationsIndex(IndexTarget const &Target);
88 virtual ~debTranslationsIndex();
89};
90
91class debSourcesIndex : public pkgDebianIndexTargetFile
92{
93 void * const d;
94 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
95 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
96 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
97
98 public:
99
100 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
101
102 // Stuff for accessing files on remote items
103 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
104 pkgSrcRecords::File const &File) const APT_OVERRIDE;
105
106 // Interface for the record parsers
107 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
108
109 // Interface for the Cache Generator
110 virtual bool HasPackages() const APT_OVERRIDE {return false;};
111
112 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
113 virtual ~debSourcesIndex();
114};
115
116class debDebPkgFileIndex : public pkgDebianIndexRealFile
117{
118 void * const d;
119 std::string DebFile;
120
121protected:
122 virtual std::string GetComponent() const APT_OVERRIDE;
123 virtual std::string GetArchitecture() const APT_OVERRIDE;
124 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
125 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
126 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
127
128public:
129 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
130
131 /** get the control (file) content of the deb file
132 *
133 * @param[out] content of the control file
134 * @param debfile is the filename of the .deb-file
135 * @return \b true if successful, otherwise \b false.
136 */
137 static bool GetContent(std::ostream &content, std::string const &debfile);
138
139 // Interface for the Cache Generator
140 virtual bool HasPackages() const APT_OVERRIDE {return true;}
141 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE;
142
143 // Interface for acquire
144
145 debDebPkgFileIndex(std::string const &DebFile);
146 virtual ~debDebPkgFileIndex();
147
148 //FIXME: use proper virtual-handling on next ABI break
149 APT_HIDDEN std::string ArchiveInfo_impl(pkgCache::VerIterator const &Ver) const;
150};
151
152class debDscFileIndex : public pkgDebianIndexRealFile
153{
154 void * const d;
155
156protected:
157 virtual std::string GetComponent() const APT_OVERRIDE;
158 virtual std::string GetArchitecture() const APT_OVERRIDE;
159 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
160
161public:
162 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
163 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
164 virtual bool HasPackages() const APT_OVERRIDE {return false;};
165
166 debDscFileIndex(std::string const &DscFile);
167 virtual ~debDscFileIndex();
168};
169
170class debDebianSourceDirIndex : public debDscFileIndex
171{
172protected:
173 virtual std::string GetComponent() const APT_OVERRIDE;
174
175public:
176 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
177};
178
179class debStringPackageIndex : public pkgDebianIndexRealFile
180{
181 void * const d;
182protected:
183 virtual std::string GetArchitecture() const APT_OVERRIDE;
184 virtual std::string GetComponent() const APT_OVERRIDE;
185 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
186
187public:
188 virtual const Type *GetType() const APT_OVERRIDE APT_CONST;
189
190 // Interface for the Cache Generator
191 virtual bool HasPackages() const APT_OVERRIDE {return true;};
192 // Abort if the file does not exist.
193 virtual bool Exists() const APT_OVERRIDE {return true;};
194
195 debStringPackageIndex(std::string const &content);
196 virtual ~debStringPackageIndex();
197};
198#endif