exec: Add autoEdges between ExecRes and PkgRes

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto
2017-05-16 16:03:52 +02:00
parent c2b5729ebd
commit 5e9a085e39
3 changed files with 89 additions and 5 deletions

View File

@@ -323,13 +323,19 @@ func (obj *PkgRes) CheckApply(apply bool) (checkOK bool, err error) {
return false, nil // success
}
// PkgUID is the UID struct for PkgRes.
// PkgUID is the main UID struct for PkgRes.
type PkgUID struct {
BaseUID
name string // pkg name
state string // pkg state or "version"
}
// PkgFileUID is the UID struct for PkgRes files.
type PkgFileUID struct {
BaseUID
path string // path of the file
}
// IFF aka if and only if they are equivalent, return true. If not, false.
func (obj *PkgUID) IFF(uid ResUID) bool {
res, ok := uid.(*PkgUID)
@@ -473,6 +479,14 @@ func (obj *PkgRes) UIDs() []ResUID {
state: obj.State,
}
result := []ResUID{x}
for _, y := range obj.fileList {
y := &PkgFileUID{
BaseUID: BaseUID{Name: obj.GetName(), Kind: obj.GetKind()},
path: y,
}
result = append(result, y)
}
return result
}