I7: a take-in's movers by import grain
A module of any repository whose import set is reported moves when its fingerprint moved, and only then: a reported set holding no changed package names no mover. A module with no reported set keeps the fallback that exists, moving by its requirements. Builds: design 47 H2 H-A-520, H-A-528, H-A-536, H-A-538; design 47 H §743; ADR 0593 §3
This commit is contained in:
@@ -8,11 +8,14 @@ import (
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/trunk"
|
||||
)
|
||||
|
||||
// moversOf are the movers of one take-in (design 47 H §743, A-476a): of the modules registered for a repository the source
|
||||
// revision moved (moved, by the entry's repository), those whose fingerprint differs from their entry in before, the branch's
|
||||
// newest catalog revision (one it does not hold included); and every module, in any repository, that imports a package one of
|
||||
// them publishes. A module with no fingerprint (no build) is no mover. One {module, commit, fingerprint, repository} per mover,
|
||||
// by module name.
|
||||
// moversOf are the movers of one take-in (design 47 H §743, A-476a as H2 H-A-520 amends it): of the modules registered for
|
||||
// a repository the source revision moved (moved, by the entry's repository), those whose fingerprint differs from their
|
||||
// entry in before, the branch's newest catalog revision (one it does not hold included); every module, in any repository,
|
||||
// whose import set is reported (its entry's import form, H-A-536, H-A-538) and whose fingerprint differs from its entry
|
||||
// in before, since its fingerprint moves only with a package it imports (H-A-520, ADR 0593 §3); and every module with no
|
||||
// reported import set that requires a package one of the fingerprint's movers publishes, by its packages (the fallback
|
||||
// that exists, H-A-528). A module whose reported set holds no changed package is no mover. A module with no fingerprint
|
||||
// (no build) is no mover. One {module, commit, fingerprint, repository} per mover, by module name.
|
||||
func moversOf(before []meshcatalog.CatalogEntry, after map[string]meshcatalog.CatalogEntry, moved []string) []meshcatalog.TakeInEntry {
|
||||
was := make(map[string]string, len(before))
|
||||
for _, e := range before {
|
||||
@@ -24,10 +27,12 @@ func moversOf(before []meshcatalog.CatalogEntry, after map[string]meshcatalog.Ca
|
||||
movers := map[string]bool{}
|
||||
published := map[string]bool{} // the packages the fingerprint's movers publish, by name
|
||||
for name, e := range after {
|
||||
if e.Fp == "" || !inMoved(e.Repository) {
|
||||
if e.Fp == "" {
|
||||
continue
|
||||
}
|
||||
if fp, ok := was[name]; ok && fp == e.Fp {
|
||||
fp, held := was[name]
|
||||
_, reported := importSetOf(e)
|
||||
if !inMoved(e.Repository) && !(reported && held) || held && fp == e.Fp {
|
||||
continue
|
||||
}
|
||||
movers[name] = true
|
||||
@@ -38,7 +43,7 @@ func moversOf(before []meshcatalog.CatalogEntry, after map[string]meshcatalog.Ca
|
||||
}
|
||||
}
|
||||
for name, e := range after {
|
||||
if movers[name] || e.Fp == "" {
|
||||
if _, reported := importSetOf(e); movers[name] || e.Fp == "" || reported {
|
||||
continue
|
||||
}
|
||||
for p := range e.Packages {
|
||||
|
||||
@@ -7,8 +7,9 @@ import (
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
|
||||
)
|
||||
|
||||
// A take-in's movers (design 47 H §743, A-476a): the moved repository's modules whose fingerprint moved, and every module that
|
||||
// imports a package of one of them; a module of another repository is no mover by its fingerprint alone.
|
||||
// A take-in's movers (design 47 H §743, A-476a as H2 H-A-520 amends it): the moved repository's modules whose fingerprint
|
||||
// moved, every module with a reported import set whose fingerprint moved, and every module with none that requires a package
|
||||
// of one of them (H-A-528); a module of another repository with no reported set is no mover by its fingerprint alone.
|
||||
func TestMoversOf(t *testing.T) {
|
||||
sdk := func(fp string) meshcatalog.CatalogEntry {
|
||||
return meshcatalog.CatalogEntry{Module: "mesh-sdk", Repository: "novox/mesh-sdk", Commit: "s" + fp, Fp: fp,
|
||||
@@ -16,6 +17,12 @@ func TestMoversOf(t *testing.T) {
|
||||
}
|
||||
importer := meshcatalog.CatalogEntry{Module: "gate", Repository: "novox/mesh-catalog", Commit: "g1", Fp: "g",
|
||||
Packages: map[string]string{"git.novox.be/novox/mesh-sdk/go": "v0.1.20"}}
|
||||
// Design 47 H2 H-A-520, H-A-536, H-A-538: an importer whose import set is reported (its import form set).
|
||||
reported := func(fp string) meshcatalog.CatalogEntry {
|
||||
return meshcatalog.CatalogEntry{Module: "avahi", Repository: "novox/mesh-catalog", Commit: "a1", Fp: fp,
|
||||
Packages: map[string]string{"git.novox.be/novox/mesh-sdk/go": "v0.1.20"},
|
||||
Inputs: &meshcatalog.EntryInputs{From: &meshcatalog.FingerprintInputs{Imports: []string{"git.novox.be/novox/mesh-sdk/go/announce"}, ImportForm: "src2:a"}}}
|
||||
}
|
||||
other := func(fp string) meshcatalog.CatalogEntry {
|
||||
return meshcatalog.CatalogEntry{Module: "feh", Repository: "novox/mesh-catalog", Commit: "f1", Fp: fp}
|
||||
}
|
||||
@@ -41,6 +48,13 @@ func TestMoversOf(t *testing.T) {
|
||||
entries(sdk("1"), other("f2")), []string{"novox/mesh-sdk"}, nil},
|
||||
{"a module the newest revision does not hold moves", nil,
|
||||
entries(other("f")), []string{"novox/mesh-catalog"}, []string{"feh"}},
|
||||
// I7/AC1, AC2: a mesh-sdk commit changing announce moves mesh-sdk, the reported importer of announce, whose fingerprint
|
||||
// moved, and gate, with no reported set, by its requirement (H-A-528).
|
||||
{"a reported importer whose fingerprint moved moves", []meshcatalog.CatalogEntry{sdk("1"), importer, reported("a")},
|
||||
entries(sdk("2"), importer, reported("a2")), []string{"novox/mesh-sdk"}, []string{"avahi", "gate", "mesh-sdk"}},
|
||||
// I7/AC3: one changing buildstep alone leaves the reported importer of announce where it was: no mover.
|
||||
{"a reported importer of no changed package is no mover", []meshcatalog.CatalogEntry{sdk("1"), importer, reported("a")},
|
||||
entries(sdk("2"), importer, reported("a")), []string{"novox/mesh-sdk"}, []string{"gate", "mesh-sdk"}},
|
||||
{"a module with no fingerprint is no mover", nil,
|
||||
entries(other("")), []string{"novox/mesh-catalog"}, nil},
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user