debindexfile.h
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
/* ######################################################################
Debian Index Files
There are three sorts currently
Package files that have File: tags
Package files that don't (/var/lib/dpkg/status)
Source files
##################################################################### */
/*}}}*/
#ifndef PKGLIB_DEBINDEXFILE_H
#define PKGLIB_DEBINDEXFILE_H
#include <apt-pkg/indexfile.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/srcrecords.h>
#include <string>
class OpProgress;
class pkgAcquire;
class pkgCacheGenerator;
class debStatusIndex : public pkgDebianIndexRealFile
{
void * const d;
protected:
[[nodiscard]] std::string GetArchitecture() const override;
[[nodiscard]] std::string GetComponent() const override;
[[nodiscard]] uint8_t GetIndexFlags() const override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
// Interface for the Cache Generator
[[nodiscard]] bool HasPackages() const override { return true; };
// Abort if the file does not exist.
[[nodiscard]] bool Exists() const override { return true; };
pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
explicit debStatusIndex(std::string const &File);
~debStatusIndex() override;
};
class debPackagesIndex : public pkgDebianIndexTargetFile
{
void * const d;
protected:
[[nodiscard]] uint8_t GetIndexFlags() const override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
// Stuff for accessing files on remote items
[[nodiscard]] std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
// Interface for the Cache Generator
[[nodiscard]] bool HasPackages() const override {return true;};
debPackagesIndex(IndexTarget const &Target, bool const Trusted);
~debPackagesIndex() override;
};
class debTranslationsIndex : public pkgDebianIndexTargetFile
{
void * const d;
protected:
[[nodiscard]] std::string GetArchitecture() const override;
[[nodiscard]] uint8_t GetIndexFlags() const override;
bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
// Interface for the Cache Generator
[[nodiscard]] bool HasPackages() const override;
explicit debTranslationsIndex(IndexTarget const &Target);
~debTranslationsIndex() override;
};
class debSourcesIndex : public pkgDebianIndexTargetFile
{
void * const d;
[[nodiscard]] uint8_t GetIndexFlags() const override;
bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
// Stuff for accessing files on remote items
[[nodiscard]] std::string SourceInfo(pkgSrcRecords::Parser const &Record,
pkgSrcRecords::File const &File) const override;
// Interface for the record parsers
[[nodiscard]] pkgSrcRecords::Parser *CreateSrcParser() const override;
// Interface for the Cache Generator
[[nodiscard]] bool HasPackages() const override { return false; };
debSourcesIndex(IndexTarget const &Target, bool const Trusted);
~debSourcesIndex() override;
};
class debDebPkgFileIndex : public pkgDebianIndexRealFile
{
void * const d;
std::string DebFile;
protected:
[[nodiscard]] std::string GetComponent() const override;
[[nodiscard]] std::string GetArchitecture() const override;
[[nodiscard]] uint8_t GetIndexFlags() const override;
bool OpenListFile(FileFd &Pkg, std::string const &FileName) override;
APT_HIDDEN pkgCacheListParser *CreateListParser(FileFd &Pkg) override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
static bool GetContent(std::ostream &content, std::string const &debfile);
// Interface for the Cache Generator
[[nodiscard]] bool HasPackages() const override { return true; }
pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const override;
// Interface for acquire
explicit debDebPkgFileIndex(std::string const &DebFile);
~debDebPkgFileIndex() override;
[[nodiscard]] std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const override;
};
class APT_PUBLIC debDscFileIndex : public pkgDebianIndexRealFile
{
void * const d;
protected:
[[nodiscard]] std::string GetComponent() const override;
[[nodiscard]] std::string GetArchitecture() const override;
[[nodiscard]] uint8_t GetIndexFlags() const override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
[[nodiscard]] pkgSrcRecords::Parser *CreateSrcParser() const override;
[[nodiscard]] bool HasPackages() const override { return false; };
explicit debDscFileIndex(std::string const &DscFile);
virtual ~debDscFileIndex();
};
class debDebianSourceDirIndex : public debDscFileIndex
{
protected:
[[nodiscard]] std::string GetComponent() const override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
};
class APT_PUBLIC debStringPackageIndex : public pkgDebianIndexRealFile
{
void * const d;
protected:
[[nodiscard]] std::string GetArchitecture() const override;
[[nodiscard]] std::string GetComponent() const override;
[[nodiscard]] uint8_t GetIndexFlags() const override;
public:
[[nodiscard]] const Type *GetType() const override APT_PURE;
// Interface for the Cache Generator
[[nodiscard]] bool HasPackages() const override { return true; };
// Abort if the file does not exist.
[[nodiscard]] bool Exists() const override { return true; };
explicit debStringPackageIndex(std::string const &content);
~debStringPackageIndex() override;
};
#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