resolveVersionOverride returns a package view for a specific version with the first matching aqua "version_override" applied. Packages without version_overrides are returned unchanged. aqua evaluates the base package's own constraint first (commonly "false" so it never matches on its own), then eac
(pkg *Package, version string)
| 17 | // it never matches on its own), then each override top-to-bottom; the first |
| 18 | // match wins and its fields are layered over the base. |
| 19 | func resolveVersionOverride(pkg *Package, version string) *Package { |
| 20 | if len(pkg.VersionOverrides) == 0 { |
| 21 | return pkg |
| 22 | } |
| 23 | |
| 24 | if pkg.VersionConstraint != "" && evalVersionConstraint(pkg.VersionConstraint, version) { |
| 25 | return pkg |
| 26 | } |
| 27 | |
| 28 | for i := range pkg.VersionOverrides { |
| 29 | vo := &pkg.VersionOverrides[i] |
| 30 | if evalVersionConstraint(vo.VersionConstraint, version) { |
| 31 | return applyVersionOverride(pkg, vo) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | return pkg |
| 36 | } |
| 37 | |
| 38 | // applyVersionOverride layers a matched override's non-empty fields onto a copy |
| 39 | // of the base package. Replacements and checksum are merged; everything else |