forked from cavaliercoder/y10k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repo.go
36 lines (31 loc) · 823 Bytes
/
repo.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
package main
type Repo struct {
ID string
Parameters map[string]string
CachePath string
EnablePlugins bool
IncludeSources bool
LocalPath string
NewOnly bool
DeleteRemoved bool
GPGCheck bool
Architecture string
YumfilePath string
YumfileLineNo int
Checksum string
Groupfile string
}
func NewRepo() *Repo {
return &Repo{
Parameters: make(map[string]string, 0),
}
}
func (c *Repo) Validate() error {
if c.ID == "" {
return NewErrorf("Upstream repository has no ID specified (in %s:%d)", c.YumfilePath, c.YumfileLineNo)
}
if c.Parameters["mirrorlist"] == "" && c.Parameters["baseurl"] == "" {
return NewErrorf("Upstream repository for '%s' has no mirror list or base URL (in %s:%d)", c.ID, c.YumfilePath, c.YumfileLineNo)
}
return nil
}