repo.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. package mock
  2. import (
  3. "time"
  4. alpm "github.com/Jguer/go-alpm/v2"
  5. )
  6. type DependList struct {
  7. Depends []Depend
  8. }
  9. func (d DependList) Slice() []alpm.Depend {
  10. return d.Depends
  11. }
  12. func (d DependList) ForEach(f func(*alpm.Depend) error) error {
  13. for i := range d.Depends {
  14. dep := &d.Depends[i]
  15. err := f(dep)
  16. if err != nil {
  17. return err
  18. }
  19. }
  20. return nil
  21. }
  22. type Package struct {
  23. PBase string
  24. PBuildDate time.Time
  25. PDB *DB
  26. PDescription string
  27. PISize int64
  28. PName string
  29. PShouldIgnore bool
  30. PSize int64
  31. PVersion string
  32. PReason alpm.PkgReason
  33. PDepends alpm.IDependList
  34. PProvides alpm.IDependList
  35. }
  36. func (p *Package) Base() string {
  37. return p.PBase
  38. }
  39. func (p *Package) BuildDate() time.Time {
  40. return p.PBuildDate
  41. }
  42. func (p *Package) DB() alpm.IDB {
  43. return p.PDB
  44. }
  45. func (p *Package) Description() string {
  46. return p.PDescription
  47. }
  48. func (p *Package) ISize() int64 {
  49. return p.PISize
  50. }
  51. func (p *Package) Name() string {
  52. return p.PName
  53. }
  54. func (p *Package) ShouldIgnore() bool {
  55. return p.PShouldIgnore
  56. }
  57. func (p *Package) Size() int64 {
  58. return p.PSize
  59. }
  60. func (p *Package) Version() string {
  61. return p.PVersion
  62. }
  63. func (p *Package) Reason() alpm.PkgReason {
  64. return p.PReason
  65. }
  66. func (p *Package) FileName() string {
  67. panic("not implemented")
  68. }
  69. func (p *Package) Base64Signature() string {
  70. panic("not implemented")
  71. }
  72. func (p *Package) Validation() alpm.Validation {
  73. panic("not implemented")
  74. }
  75. // Architecture returns the package target Architecture.
  76. func (p *Package) Architecture() string {
  77. panic("not implemented")
  78. }
  79. // Backup returns a list of package backups.
  80. func (p *Package) Backup() alpm.BackupList {
  81. panic("not implemented")
  82. }
  83. // Conflicts returns the conflicts of the package as a DependList.
  84. func (p *Package) Conflicts() alpm.IDependList {
  85. panic("not implemented")
  86. }
  87. // Depends returns the package's dependency list.
  88. func (p *Package) Depends() alpm.IDependList {
  89. if p.PDepends != nil {
  90. return p.PDepends
  91. }
  92. return alpm.DependList{}
  93. }
  94. // Depends returns the package's optional dependency list.
  95. func (p *Package) OptionalDepends() alpm.IDependList {
  96. panic("not implemented")
  97. }
  98. // Depends returns the package's check dependency list.
  99. func (p *Package) CheckDepends() alpm.IDependList {
  100. panic("not implemented")
  101. }
  102. // Depends returns the package's make dependency list.
  103. func (p *Package) MakeDepends() alpm.IDependList {
  104. panic("not implemented")
  105. }
  106. // Files returns the file list of the package.
  107. func (p *Package) Files() []alpm.File {
  108. panic("not implemented")
  109. }
  110. // ContainsFile checks if the path is in the package filelist.
  111. func (p *Package) ContainsFile(path string) (alpm.File, error) {
  112. panic("not implemented")
  113. }
  114. // Groups returns the groups the package belongs to.
  115. func (p *Package) Groups() alpm.StringList {
  116. panic("not implemented")
  117. }
  118. // InstallDate returns the package install date.
  119. func (p *Package) InstallDate() time.Time {
  120. panic("not implemented")
  121. }
  122. // Licenses returns the package license list.
  123. func (p *Package) Licenses() alpm.StringList {
  124. panic("not implemented")
  125. }
  126. // SHA256Sum returns package SHA256Sum.
  127. func (p *Package) SHA256Sum() string {
  128. panic("not implemented")
  129. }
  130. // MD5Sum returns package MD5Sum.
  131. func (p *Package) MD5Sum() string {
  132. panic("not implemented")
  133. }
  134. // Packager returns package packager name.
  135. func (p *Package) Packager() string {
  136. panic("not implemented")
  137. }
  138. // Provides returns DependList of packages provides by package.
  139. func (p *Package) Provides() alpm.IDependList {
  140. if p.PProvides == nil {
  141. return alpm.DependList{}
  142. }
  143. return p.PProvides
  144. }
  145. // Origin returns package origin.
  146. func (p *Package) Origin() alpm.PkgFrom {
  147. panic("not implemented")
  148. }
  149. // Replaces returns a DependList with the packages this package replaces.
  150. func (p *Package) Replaces() alpm.IDependList {
  151. panic("not implemented")
  152. }
  153. // URL returns the upstream URL of the package.
  154. func (p *Package) URL() string {
  155. panic("not implemented")
  156. }
  157. // ComputeRequiredBy returns the names of reverse dependencies of a package.
  158. func (p *Package) ComputeRequiredBy() []string {
  159. panic("not implemented")
  160. }
  161. // ComputeOptionalFor returns the names of packages that optionally
  162. // require the given package.
  163. func (p *Package) ComputeOptionalFor() []string {
  164. panic("not implemented")
  165. }
  166. // SyncNewVersion checks if there is a new version of the
  167. // package in a given DBlist.
  168. func (p *Package) SyncNewVersion(l alpm.IDBList) alpm.IPackage {
  169. panic("not implemented")
  170. }
  171. func (p *Package) Type() string {
  172. panic("not implemented")
  173. }
  174. type DB struct {
  175. alpm.IDB
  176. name string
  177. }
  178. func NewDB(name string) *DB {
  179. return &DB{name: name}
  180. }
  181. func (d *DB) Name() string {
  182. return d.name
  183. }