]>
Commit | Line | Data |
---|---|---|
b2e465d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
b2e465d6 AL |
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 | ||
453b82a3 DK |
18 | #include <apt-pkg/indexfile.h> |
19 | #include <apt-pkg/cacheiterators.h> | |
20 | #include <apt-pkg/pkgcache.h> | |
21 | #include <apt-pkg/srcrecords.h> | |
13500573 | 22 | |
453b82a3 DK |
23 | #include <string> |
24 | ||
25 | class OpProgress; | |
26 | class pkgAcquire; | |
27 | class pkgCacheGenerator; | |
b2e465d6 | 28 | |
c9443c01 | 29 | class debStatusIndex : public pkgDebianIndexRealFile |
b2e465d6 | 30 | { |
6c55f07a | 31 | void * const d; |
c9443c01 DK |
32 | protected: |
33 | virtual std::string GetArchitecture() const APT_OVERRIDE; | |
34 | virtual std::string GetComponent() const APT_OVERRIDE; | |
35 | virtual uint8_t GetIndexFlags() const APT_OVERRIDE; | |
6d38011b | 36 | |
c9443c01 | 37 | public: |
b2e465d6 | 38 | |
6d7122b5 | 39 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
e3c1cfc7 | 40 | |
b2e465d6 | 41 | // Interface for the Cache Generator |
3b302846 | 42 | virtual bool HasPackages() const APT_OVERRIDE {return true;}; |
c9443c01 DK |
43 | // Abort if the file does not exist. |
44 | virtual bool Exists() const APT_OVERRIDE {return true;}; | |
b2e465d6 | 45 | |
1c73b0fc JAK |
46 | virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE; |
47 | ||
c9443c01 | 48 | debStatusIndex(std::string const &File); |
862bafea | 49 | virtual ~debStatusIndex(); |
b2e465d6 | 50 | }; |
3809194b | 51 | |
c9443c01 | 52 | class debPackagesIndex : public pkgDebianIndexTargetFile |
e3c1cfc7 | 53 | { |
6c55f07a | 54 | void * const d; |
c9443c01 | 55 | protected: |
6d7122b5 | 56 | virtual uint8_t GetIndexFlags() const APT_OVERRIDE; |
e3c1cfc7 | 57 | |
c9443c01 | 58 | public: |
6d7122b5 | 59 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
b2e465d6 AL |
60 | |
61 | // Stuff for accessing files on remote items | |
c9443c01 | 62 | virtual std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const APT_OVERRIDE; |
e3c1cfc7 | 63 | |
b2e465d6 | 64 | // Interface for the Cache Generator |
3b302846 | 65 | virtual bool HasPackages() const APT_OVERRIDE {return true;}; |
7db98ffc | 66 | |
e3c1cfc7 | 67 | debPackagesIndex(IndexTarget const &Target, bool const Trusted); |
862bafea | 68 | virtual ~debPackagesIndex(); |
b2e465d6 AL |
69 | }; |
70 | ||
c9443c01 | 71 | class debTranslationsIndex : public pkgDebianIndexTargetFile |
a52f938b | 72 | { |
6c55f07a | 73 | void * const d; |
c9443c01 DK |
74 | protected: |
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 | ||
80 | public: | |
d38926ef | 81 | |
6d7122b5 | 82 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
a52f938b | 83 | |
a52f938b | 84 | // Interface for the Cache Generator |
3b302846 | 85 | virtual bool HasPackages() const APT_OVERRIDE; |
a52f938b | 86 | |
e3c1cfc7 | 87 | debTranslationsIndex(IndexTarget const &Target); |
862bafea | 88 | virtual ~debTranslationsIndex(); |
a52f938b OS |
89 | }; |
90 | ||
c9443c01 | 91 | class debSourcesIndex : public pkgDebianIndexTargetFile |
b2e465d6 | 92 | { |
6c55f07a | 93 | void * const d; |
6d7122b5 | 94 | virtual uint8_t GetIndexFlags() const APT_OVERRIDE; |
c9443c01 DK |
95 | virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE; |
96 | APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE; | |
97 | ||
b2e465d6 AL |
98 | public: |
99 | ||
6d7122b5 | 100 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
b2e465d6 AL |
101 | |
102 | // Stuff for accessing files on remote items | |
8f3ba4e8 | 103 | virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, |
3b302846 | 104 | pkgSrcRecords::File const &File) const APT_OVERRIDE; |
b2e465d6 AL |
105 | |
106 | // Interface for the record parsers | |
3b302846 | 107 | virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE; |
e3c1cfc7 | 108 | |
b2e465d6 | 109 | // Interface for the Cache Generator |
3b302846 | 110 | virtual bool HasPackages() const APT_OVERRIDE {return false;}; |
e3c1cfc7 DK |
111 | |
112 | debSourcesIndex(IndexTarget const &Target, bool const Trusted); | |
862bafea | 113 | virtual ~debSourcesIndex(); |
b2e465d6 AL |
114 | }; |
115 | ||
c9443c01 | 116 | class debDebPkgFileIndex : public pkgDebianIndexRealFile |
0d29b9d4 | 117 | { |
6c55f07a | 118 | void * const d; |
0d29b9d4 | 119 | std::string DebFile; |
0d29b9d4 | 120 | |
c9443c01 DK |
121 | protected: |
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; | |
0d29b9d4 | 127 | |
c9443c01 | 128 | public: |
6d7122b5 | 129 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
0d29b9d4 | 130 | |
2f6a2fbb DK |
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 | ||
0d29b9d4 | 139 | // Interface for the Cache Generator |
c9443c01 | 140 | virtual bool HasPackages() const APT_OVERRIDE {return true;} |
3b302846 | 141 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE; |
0d29b9d4 MV |
142 | |
143 | // Interface for acquire | |
0d29b9d4 | 144 | |
5465192b | 145 | debDebPkgFileIndex(std::string const &DebFile); |
862bafea | 146 | virtual ~debDebPkgFileIndex(); |
64b66a46 DK |
147 | |
148 | //FIXME: use proper virtual-handling on next ABI break | |
149 | APT_HIDDEN std::string ArchiveInfo_impl(pkgCache::VerIterator const &Ver) const; | |
862bafea | 150 | }; |
070536e6 | 151 | |
c9443c01 | 152 | class debDscFileIndex : public pkgDebianIndexRealFile |
a49e7948 | 153 | { |
6c55f07a | 154 | void * const d; |
f359b7e8 DK |
155 | |
156 | protected: | |
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 | ||
161 | public: | |
6d7122b5 | 162 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
3b302846 | 163 | virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE; |
3b302846 | 164 | virtual bool HasPackages() const APT_OVERRIDE {return false;}; |
a49e7948 | 165 | |
5465192b | 166 | debDscFileIndex(std::string const &DscFile); |
c8a4ce6c | 167 | virtual ~debDscFileIndex(); |
a49e7948 MV |
168 | }; |
169 | ||
5465192b | 170 | class debDebianSourceDirIndex : public debDscFileIndex |
77da39b9 | 171 | { |
f359b7e8 DK |
172 | protected: |
173 | virtual std::string GetComponent() const APT_OVERRIDE; | |
174 | ||
175 | public: | |
6d7122b5 | 176 | virtual const Type *GetType() const APT_OVERRIDE APT_CONST; |
0d29b9d4 MV |
177 | }; |
178 | ||
a249b3e6 DK |
179 | class debStringPackageIndex : public pkgDebianIndexRealFile |
180 | { | |
181 | void * const d; | |
182 | protected: | |
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 | ||
187 | public: | |
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 | }; | |
b2e465d6 | 198 | #endif |