edsplistparser.cc 2.8 KB

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