enums.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // enums.go - libaplm enumerations.
  2. //
  3. // Copyright (c) 2013 The go-alpm Authors
  4. //
  5. // MIT Licensed. See LICENSE for details.
  6. package alpm
  7. // Install reason of a package.
  8. type PkgReason uint
  9. const (
  10. PkgReasonExplicit PkgReason = 0
  11. PkgReasonDepend PkgReason = 1
  12. )
  13. func (r PkgReason) String() string {
  14. switch r {
  15. case PkgReasonExplicit:
  16. return "Explicitly installed"
  17. case PkgReasonDepend:
  18. return "Installed as a dependency of another package"
  19. }
  20. return ""
  21. }
  22. // Source of a package structure.
  23. type PkgFrom uint
  24. const (
  25. FromFile PkgFrom = iota + 1
  26. FromLocalDB
  27. FromSyncDB
  28. )
  29. // Dependency constraint types.
  30. type DepMod uint
  31. const (
  32. DepModAny DepMod = iota + 1 // Any version.
  33. DepModEq // Specific version.
  34. DepModGE // Test for >= some version.
  35. DepModLE // Test for <= some version.
  36. DepModGT // Test for > some version.
  37. DepModLT // Test for < some version.
  38. )
  39. func (mod DepMod) String() string {
  40. switch mod {
  41. case DepModEq:
  42. return "="
  43. case DepModGE:
  44. return ">="
  45. case DepModLE:
  46. return "<="
  47. case DepModGT:
  48. return ">"
  49. case DepModLT:
  50. return "<"
  51. }
  52. return ""
  53. }
  54. // Signature checking level.
  55. type SigLevel uint
  56. const (
  57. SigPackage SigLevel = 1 << iota
  58. SigPackageOptional
  59. SigPackageMarginalOk
  60. SigPackageUnknownOk
  61. )
  62. const (
  63. SigDatabase SigLevel = 1 << (10 + iota)
  64. SigDatabaseOptional
  65. SigDatabaseMarginalOk
  66. SigDatabaseUnknownOk
  67. )
  68. const SigUseDefault SigLevel = 1 << 31
  69. // Signature status
  70. type SigStatus uint
  71. const (
  72. SigStatusValid SigStatus = iota
  73. SigStatusKeyExpired
  74. SigStatusSigExpired
  75. SigStatusKeyUnknown
  76. SigStatusKeyDisabled
  77. )
  78. // Logging levels.
  79. const (
  80. LogError uint16 = 1 << iota
  81. LogWarning
  82. LogDebug
  83. LogFunction
  84. )
  85. type QuestionType uint
  86. const (
  87. QuestionTypeInstallIgnorepkg QuestionType = 1 << iota
  88. QuestionTypeReplacePkg
  89. QuestionTypeConflictPkg
  90. QuestionTypeCorruptedPkg
  91. QuestionTypeRemovePkgs
  92. QuestionTypeSelectProvider
  93. QuestionTypeImportKey
  94. )
  95. type Validation int
  96. const (
  97. ValidationNone Validation = 1 << iota
  98. ValidationMD5Sum
  99. ValidationSHA256Sum
  100. ValidationSignature
  101. ValidationUnkown Validation = 0
  102. )