edsplistparser.cc 2.8 KB

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