forked from remyoudompheng/go-alpm
-
Notifications
You must be signed in to change notification settings - Fork 14
/
interfaces.go
133 lines (125 loc) · 4.18 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package alpm
import (
"time"
)
// IPackage is an interface type for alpm.Package.
type IPackage interface {
FileName() string
Base() string
Base64Signature() string
Validation() Validation
// Architecture returns the package target Architecture.
Architecture() string
// Backup returns a list of package backups.
Backup() BackupList
// BuildDate returns the BuildDate of the package.
BuildDate() time.Time
// Conflicts returns the conflicts of the package as a DependList.
Conflicts() IDependList
// DB returns the package's origin database.
DB() IDB
// Depends returns the package's dependency list.
Depends() IDependList
// Depends returns the package's optional dependency list.
OptionalDepends() IDependList
// Depends returns the package's check dependency list.
CheckDepends() IDependList
// Depends returns the package's make dependency list.
MakeDepends() IDependList
// Description returns the package's description.
Description() string
// Files returns the file list of the package.
Files() []File
// ContainsFile checks if the path is in the package filelist
ContainsFile(path string) (File, error)
// Groups returns the groups the package belongs to.
Groups() StringList
// ISize returns the package installed size.
ISize() int64
// InstallDate returns the package install date.
InstallDate() time.Time
// Licenses returns the package license list.
Licenses() StringList
// SHA256Sum returns package SHA256Sum.
SHA256Sum() string
// MD5Sum returns package MD5Sum.
MD5Sum() string
// Name returns package name.
Name() string
// Packager returns package packager name.
Packager() string
// Provides returns DependList of packages provides by package.
Provides() IDependList
// Reason returns package install reason.
Reason() PkgReason
// Origin returns package origin.
Origin() PkgFrom
// Replaces returns a DependList with the packages this package replaces.
Replaces() IDependList
// Size returns the packed package size.
Size() int64
// URL returns the upstream URL of the package.
URL() string
// Version returns the package version.
Version() string
// ComputeRequiredBy returns the names of reverse dependencies of a package
ComputeRequiredBy() []string
// ComputeOptionalFor returns the names of packages that optionally
// require the given package
ComputeOptionalFor() []string
ShouldIgnore() bool
// SyncNewVersion checks if there is a new version of the
// package in a given DBlist.
SyncNewVersion(l IDBList) IPackage
Type() string
}
// IPackageList exports the alpm.PackageList symbols.
type IPackageList interface {
// ForEach executes an action on each package of the PackageList.
ForEach(func(IPackage) error) error
// Slice converts the PackageList to a Package Slice.
Slice() []IPackage
// SortBySize returns a PackageList sorted by size.
SortBySize() IPackageList
// FindSatisfier finds a package that satisfies depstring from PkgList
FindSatisfier(string) (IPackage, error)
}
type IDependList interface {
// ForEach executes an action on each package of the DependList.
ForEach(func(*Depend) error) error
// Slice converts the DependList to a Depend Slice.
Slice() []Depend
}
// IDB is an interface type for alpm.DB.
type IDB interface {
Unregister() error
// Name returns name of the db
Name() string
// Servers returns host server URL.
Servers() []string
// SetServers sets server list to use.
SetServers(servers []string)
// AddServers adds a string to the server list.
AddServer(server string)
// SetUsage sets the Usage of the database
SetUsage(usage Usage)
// Name searches a package in db.
Pkg(name string) IPackage
// PkgCache returns the list of packages of the database
PkgCache() IPackageList
Search([]string) IPackageList
}
// IDBList interfaces alpm.DBList.
type IDBList interface {
// ForEach executes an action on each DB.
ForEach(func(IDB) error) error
// Slice converts DB list to DB slice.
Slice() []IDB
// Append modifies DB list with given DB appended.
Append(IDB)
// PkgCachebyGroup returns a PackageList of packages belonging to a group
FindGroupPkgs(string) IPackageList
// FindSatisfier searches a DBList for a package that satisfies depstring
// Example "glibc>=2.12"
FindSatisfier(string) (IPackage, error)
}