edsplistparser.cc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. /* ######################################################################
  4. Package Cache Generator - Generator for the cache structure.
  5. This builds the cache structure from the abstract package list parser.
  6. ##################################################################### */
  7. /*}}}*/
  8. // Include Files /*{{{*/
  9. #include <config.h>
  10. #include <apt-pkg/edsplistparser.h>
  11. #include <apt-pkg/md5.h>
  12. #include <apt-pkg/deblistparser.h>
  13. #include <apt-pkg/pkgcache.h>
  14. #include <apt-pkg/cacheiterators.h>
  15. #include <apt-pkg/tagfile.h>
  16. #include <string>
  17. /*}}}*/
  18. // ListParser::edspListParser - Constructor /*{{{*/
  19. edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch)
  20. {}
  21. /*}}}*/
  22. // ListParser::NewVersion - Fill in the version structure /*{{{*/
  23. bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
  24. {
  25. Ver->ID = Section.FindI("APT-ID", Ver->ID);
  26. return debListParser::NewVersion(Ver);
  27. }
  28. /*}}}*/
  29. // ListParser::Description - Return the description string /*{{{*/
  30. // ---------------------------------------------------------------------
  31. /* Sorry, no description for the resolvers… */
  32. std::string edspListParser::Description()
  33. {
  34. return "";
  35. }
  36. std::string edspListParser::DescriptionLanguage()
  37. {
  38. return "";
  39. }
  40. MD5SumValue edspListParser::Description_md5()
  41. {
  42. return MD5SumValue("");
  43. }
  44. /*}}}*/
  45. // ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
  46. // ---------------------------------------------------------------------
  47. /* */
  48. unsigned short edspListParser::VersionHash()
  49. {
  50. if (Section.Exists("APT-Hash") == true)
  51. return Section.FindI("APT-Hash");
  52. else if (Section.Exists("APT-ID") == true)
  53. return Section.FindI("APT-ID");
  54. return 0;
  55. }
  56. /*}}}*/
  57. // ListParser::ParseStatus - Parse the status field /*{{{*/
  58. // ---------------------------------------------------------------------
  59. /* The Status: line here is not a normal dpkg one but just one which tells
  60. use if the package is installed or not, where missing means not. */
  61. bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
  62. pkgCache::VerIterator &Ver)
  63. {
  64. unsigned long state = 0;
  65. if (Section.FindFlag("Hold",state,pkgCache::State::Hold) == false)
  66. return false;
  67. if (state != 0)
  68. Pkg->SelectedState = pkgCache::State::Hold;
  69. state = 0;
  70. if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false)
  71. return false;
  72. if (state != 0)
  73. {
  74. Pkg->CurrentState = pkgCache::State::Installed;
  75. Pkg->CurrentVer = Ver.Index();
  76. }
  77. return true;
  78. }
  79. /*}}}*/
  80. // ListParser::LoadReleaseInfo - Load the release information /*{{{*/
  81. APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*FileI*/,
  82. FileFd & /*File*/, std::string const &/*component*/)
  83. {
  84. return true;
  85. }
  86. /*}}}*/
  87. edspListParser::~edspListParser() {}