Simplify revdep code

Isolate common code into a function and also fix a sublte bug hiding in
that code.

We need to stab a copy of the package inside our PackageMap to avoid
having symlinks pointing at the same values when iterating over
requires. ( e.g. happened in this case:
https://github.com/rancher-sandbox/cOS-toolkit/pull/467#issuecomment-895060115
)
This commit is contained in:
Ettore Di Giacinto
2021-08-09 12:47:27 +02:00
parent 65a55e242e
commit 10ae872a3e
2 changed files with 31 additions and 30 deletions

View File

@@ -136,6 +136,18 @@ type Packages []Package
type DefaultPackages []*DefaultPackage
type PackageMap map[string]Package
func (pm PackageMap) String() string {
rr := []string{}
for _, r := range pm {
rr = append(rr, r.HumanReadableString())
}
return fmt.Sprint(rr)
}
func (d DefaultPackages) Hash(salt string) string {
overallFp := ""