enums.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 int
  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 << 30
  69. // Signature status
  70. type SigStatus int
  71. const (
  72. SigStatusValid SigStatus = iota
  73. SigStatusKeyExpired
  74. SigStatusSigExpired
  75. SigStatusKeyUnknown
  76. SigStatusKeyDisabled
  77. )
  78. type LogLevel uint16
  79. // Logging levels.
  80. const (
  81. LogError LogLevel = 1 << iota
  82. LogWarning
  83. LogDebug
  84. LogFunction
  85. )
  86. type QuestionType uint
  87. const (
  88. QuestionTypeInstallIgnorepkg QuestionType = 1 << iota
  89. QuestionTypeReplacePkg
  90. QuestionTypeConflictPkg
  91. QuestionTypeCorruptedPkg
  92. QuestionTypeRemovePkgs
  93. QuestionTypeSelectProvider
  94. QuestionTypeImportKey
  95. )
  96. type Validation int
  97. const (
  98. ValidationNone Validation = 1 << iota
  99. ValidationMD5Sum
  100. ValidationSHA256Sum
  101. ValidationSignature
  102. ValidationUnkown Validation = 0
  103. )
  104. type Usage int
  105. const (
  106. UsageSync Usage = 1 << iota
  107. UsageSearch
  108. UsageInstall
  109. UsageUpgrade
  110. UsageAll = (1 << 4) - 1
  111. )
  112. type TransFlag int
  113. const (
  114. TransFlagNoDeps TransFlag = 1 << iota
  115. TransFlagForce
  116. TransFlagNoSave
  117. TransFlagNoDepVersion
  118. TransFlagCascade
  119. TransFlagRecurse
  120. // 7 is missing
  121. _
  122. TransFlagDbOnly
  123. TransFlagAllDeps
  124. TransFlagDownloadOnly
  125. TransFlagNoScriptlets
  126. // 12 is missing
  127. _
  128. TransFlagNoConflicts
  129. TransFlagNeeded
  130. TransFlagAllExplicit
  131. TransFlagUnneeded
  132. TransFlagRecurseAll
  133. TransFlagNoLock
  134. )