apt 3.1.11 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
24 class OpProgress;
25 class pkgAcquire;
26 class pkgCacheGenerator;
27
28 class debStatusIndex : public pkgDebianIndexRealFile
29{
30 void * const d;
31 protected:
32 [[nodiscard]] std::string GetArchitecture() const override;
33 [[nodiscard]] std::string GetComponent() const override;
34 [[nodiscard]] uint8_t GetIndexFlags() const override;
35
36 public:
37
38 [[nodiscard]] const Type *GetType() const override APT_PURE;
39
40 // Interface for the Cache Generator
41 [[nodiscard]] bool HasPackages() const override { return true; };
42 // Abort if the file does not exist.
43 [[nodiscard]] bool Exists() const override { return true; };
44
45 pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
46
47 explicit debStatusIndex(std::string const &File);
48 ~debStatusIndex() override;
49};
50
51 class debPackagesIndex : public pkgDebianIndexTargetFile
52{
53 void * const d;
54 protected:
55 [[nodiscard]] uint8_t GetIndexFlags() const override;
56
57 public:
58 [[nodiscard]] const Type *GetType() const override APT_PURE;
59
60 // Stuff for accessing files on remote items
61 [[nodiscard]] std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
62
63 // Interface for the Cache Generator
64 [[nodiscard]] bool HasPackages() const override {return true;};
65
66 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
67 ~debPackagesIndex() override;
68};
69
70 class debTranslationsIndex : public pkgDebianIndexTargetFile
71{
72 void * const d;
73 protected:
74 [[nodiscard]] std::string GetArchitecture() const override;
75 [[nodiscard]] uint8_t GetIndexFlags() const override;
76 bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
77 APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
78
79 public:
80 [[nodiscard]] const Type *GetType() const override APT_PURE;
81
82 // Interface for the Cache Generator
83 [[nodiscard]] bool HasPackages() const override;
84
85 explicit debTranslationsIndex(IndexTarget const &Target);
86 ~debTranslationsIndex() override;
87};
88
89 class debSourcesIndex : public pkgDebianIndexTargetFile
90{
91 void * const d;
92 [[nodiscard]] uint8_t GetIndexFlags() const override;
93 bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
94 APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
95
96 public:
97 [[nodiscard]] const Type *GetType() const override APT_PURE;
98
99 // Stuff for accessing files on remote items
100 [[nodiscard]] std::string SourceInfo(pkgSrcRecords::Parser const &Record,
101 pkgSrcRecords::File const &File) const override;
102
103 // Interface for the record parsers
104 [[nodiscard]] pkgSrcRecords::Parser *CreateSrcParser() const override;
105
106 // Interface for the Cache Generator
107 [[nodiscard]] bool HasPackages() const override { return false; };
108
109 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
110 ~debSourcesIndex() override;
111};
112
113 class debDebPkgFileIndex : public pkgDebianIndexRealFile
114{
115 void * const d;
116 std::string DebFile;
117
118 protected:
119 [[nodiscard]] std::string GetComponent() const override;
120 [[nodiscard]] std::string GetArchitecture() const override;
121 [[nodiscard]] uint8_t GetIndexFlags() const override;
122 bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
123 APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
124
125 public:
126 [[nodiscard]] const Type *GetType() const override APT_PURE;
127
134 static bool GetContent(std::ostream &content, std::string const &debfile);
135
136 // Interface for the Cache Generator
137 [[nodiscard]] bool HasPackages() const override { return true; }
138 pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const override;
139
140 // Interface for acquire
141
142 explicit debDebPkgFileIndex(std::string const &DebFile);
143 ~debDebPkgFileIndex() override;
144
145 [[nodiscard]] std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
146};
147
148 class APT_PUBLIC debDscFileIndex : public pkgDebianIndexRealFile
149{
150 void * const d;
151
152 protected:
153 [[nodiscard]] std::string GetComponent() const override;
154 [[nodiscard]] std::string GetArchitecture() const override;
155 [[nodiscard]] uint8_t GetIndexFlags() const override;
156
157 public:
158 [[nodiscard]] const Type *GetType() const override APT_PURE;
159 [[nodiscard]] pkgSrcRecords::Parser *CreateSrcParser() const override;
160 [[nodiscard]] bool HasPackages() const override { return false; };
161
162 explicit debDscFileIndex(std::string const &DscFile);
163 virtual ~debDscFileIndex();
164};
165
166 class debDebianSourceDirIndex : public debDscFileIndex
167{
168 protected:
169 [[nodiscard]] std::string GetComponent() const override;
170
171 public:
172[[nodiscard]] const Type *GetType() const override APT_PURE;
173};
174
175 class APT_PUBLIC debStringPackageIndex : public pkgDebianIndexRealFile
176{
177 void * const d;
178 protected:
179 [[nodiscard]] std::string GetArchitecture() const override;
180 [[nodiscard]] std::string GetComponent() const override;
181 [[nodiscard]] uint8_t GetIndexFlags() const override;
182
183 public:
184 [[nodiscard]] const Type *GetType() const override APT_PURE;
185
186 // Interface for the Cache Generator
187 [[nodiscard]] bool HasPackages() const override { return true; };
188 // Abort if the file does not exist.
189 [[nodiscard]] bool Exists() const override { return true; };
190
191 explicit debStringPackageIndex(std::string const &content);
192 ~debStringPackageIndex() override;
193};
194#endif
FileFd
Definition fileutl.h:43
IndexTarget
Information about an index file.
Definition indexfile.h:39
OpProgress
Definition progress.h:30
debDebPkgFileIndex::GetContent
static bool GetContent(std::ostream &content, std::string const &debfile)
Definition debindexfile.cc:174
debDebianSourceDirIndex
Definition debindexfile.h:167
pkgAcquire
The core download scheduler. {{{.
Definition acquire.h:94
pkgCacheGenerator
Definition pkgcachegen.h:44
pkgCacheListParser
Definition pkgcachegen.h:181
pkgCache::PkgFileIterator
Definition cacheiterators.h:496
pkgCache::VerIterator
Definition cacheiterators.h:218
pkgCache
Definition pkgcache.h:126
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