You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

104 lines
3.0 KiB

  1. #ifndef PKGLIB_DEBMETAINDEX_H
  2. #define PKGLIB_DEBMETAINDEX_H
  3. #include <apt-pkg/metaindex.h>
  4. #include <apt-pkg/macros.h>
  5. #include <map>
  6. #include <string>
  7. #include <vector>
  8. #ifndef APT_8_CLEANER_HEADERS
  9. #include <apt-pkg/sourcelist.h>
  10. #endif
  11. #ifndef APT_10_CLEANER_HEADERS
  12. #include <apt-pkg/init.h>
  13. #endif
  14. class pkgAcquire;
  15. class pkgIndexFile;
  16. class debDebPkgFileIndex;
  17. class IndexTarget;
  18. class pkgCacheGenerator;
  19. class OpProgress;
  20. class debReleaseIndexPrivate;
  21. class APT_HIDDEN debReleaseIndex : public metaIndex
  22. {
  23. debReleaseIndexPrivate * const d;
  24. APT_HIDDEN bool parseSumData(const char *&Start, const char *End, std::string &Name,
  25. std::string &Hash, unsigned long long &Size);
  26. public:
  27. APT_HIDDEN std::string MetaIndexInfo(const char *Type) const;
  28. APT_HIDDEN std::string MetaIndexFile(const char *Types) const;
  29. APT_HIDDEN std::string MetaIndexURI(const char *Type) const;
  30. debReleaseIndex(std::string const &URI, std::string const &Dist);
  31. debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
  32. virtual ~debReleaseIndex();
  33. virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
  34. virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false);
  35. virtual std::vector<IndexTarget> GetIndexTargets() const;
  36. virtual std::string Describe() const;
  37. virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
  38. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  39. virtual bool Load(std::string const &Filename, std::string * const ErrorText);
  40. virtual metaIndex * UnloadedClone() const;
  41. virtual std::vector <pkgIndexFile *> *GetIndexFiles();
  42. bool SetTrusted(TriState const Trusted);
  43. virtual bool IsTrusted() const;
  44. void AddComponent(bool const isSrc, std::string const &Name,
  45. std::vector<std::string> const &Targets,
  46. std::vector<std::string> const &Architectures,
  47. std::vector<std::string> Languages);
  48. };
  49. class APT_HIDDEN debDebFileMetaIndex : public metaIndex
  50. {
  51. private:
  52. void * const d;
  53. std::string DebFile;
  54. debDebPkgFileIndex *DebIndex;
  55. public:
  56. virtual std::string ArchiveURI(std::string const& /*File*/) const {
  57. return DebFile;
  58. }
  59. virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) {
  60. return true;
  61. }
  62. virtual std::vector<IndexTarget> GetIndexTargets() const {
  63. return std::vector<IndexTarget>();
  64. }
  65. virtual std::vector<pkgIndexFile *> *GetIndexFiles() {
  66. return Indexes;
  67. }
  68. virtual bool IsTrusted() const {
  69. return true;
  70. }
  71. virtual bool Load(std::string const &, std::string * const ErrorText)
  72. {
  73. LoadedSuccessfully = TRI_NO;
  74. if (ErrorText != NULL)
  75. strprintf(*ErrorText, "Unparseable metaindex as it represents the standalone deb file %s", DebFile.c_str());
  76. return false;
  77. }
  78. virtual metaIndex * UnloadedClone() const
  79. {
  80. return NULL;
  81. }
  82. debDebFileMetaIndex(std::string const &DebFile);
  83. virtual ~debDebFileMetaIndex();
  84. };
  85. #endif