mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-05 05:01:28 +00:00
packs: Don't create packs for Iterative Manifests
Files that are not of type Manifest are not bundles, so we shouldn't create packs for them. Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
+3
-1
@@ -485,7 +485,9 @@ func FindBundlesToPack(from *Manifest, to *Manifest) (map[string]*BundleToPack,
|
||||
|
||||
bundles := make(map[string]*BundleToPack, len(to.Files))
|
||||
for _, b := range to.Files {
|
||||
bundles[b.Name] = &BundleToPack{b.Name, 0, b.Version}
|
||||
if b.Type == TypeManifest {
|
||||
bundles[b.Name] = &BundleToPack{b.Name, 0, b.Version}
|
||||
}
|
||||
}
|
||||
|
||||
// If this is not a zero pack, we might be able to skip some bundles.
|
||||
|
||||
+28
-2
@@ -22,6 +22,7 @@ func TestFindBundlesToPack(t *testing.T) {
|
||||
From M
|
||||
ToV uint32
|
||||
To M
|
||||
ToIMan M
|
||||
Expected []BundleToPack
|
||||
ShouldFail bool
|
||||
}{
|
||||
@@ -105,6 +106,19 @@ func TestFindBundlesToPack(t *testing.T) {
|
||||
|
||||
Expected: []BundleToPack{{"os-core", 100, 200}, {"c-basic", 0, 200}},
|
||||
},
|
||||
|
||||
{
|
||||
Name: "Don't pack Iterative manifests",
|
||||
|
||||
FromV: 10,
|
||||
From: M{"os-core": 10},
|
||||
|
||||
ToV: 20,
|
||||
To: M{"os-core": 20},
|
||||
ToIMan: M{"os-core.I.10": 20},
|
||||
|
||||
Expected: []BundleToPack{{"os-core", 10, 20}},
|
||||
},
|
||||
}
|
||||
|
||||
addBundle := func(m *Manifest, name string, version uint32) {
|
||||
@@ -116,6 +130,15 @@ func TestFindBundlesToPack(t *testing.T) {
|
||||
m.Files = append(m.Files, bundle)
|
||||
}
|
||||
|
||||
addIterativeManifest := func(m *Manifest, name string, version uint32) {
|
||||
man := &File{
|
||||
Name: name,
|
||||
Type: TypeIManifest,
|
||||
Version: version,
|
||||
}
|
||||
m.Files = append(m.Files, man)
|
||||
}
|
||||
|
||||
sortBundles := func(bundles []BundleToPack) {
|
||||
sort.Slice(bundles, func(i, j int) bool {
|
||||
return bundles[i].Name < bundles[j].Name
|
||||
@@ -143,6 +166,9 @@ func TestFindBundlesToPack(t *testing.T) {
|
||||
for name, v := range tt.To {
|
||||
addBundle(toM, name, v)
|
||||
}
|
||||
for name, v := range tt.ToIMan {
|
||||
addIterativeManifest(toM, name, v)
|
||||
}
|
||||
|
||||
bundleMap, err := FindBundlesToPack(fromM, toM)
|
||||
failed := err != nil
|
||||
@@ -823,13 +849,13 @@ func TestFindBundlesToPackErrorPaths(t *testing.T) {
|
||||
toMan := &Manifest{
|
||||
Name: "testto",
|
||||
Files: []*File{
|
||||
{Name: "test1", Version: 20},
|
||||
{Name: "test1", Version: 20, Type: TypeManifest},
|
||||
},
|
||||
}
|
||||
fromMan := &Manifest{
|
||||
Name: "testfrom",
|
||||
Files: []*File{
|
||||
{Name: "test1", Version: 30}, // invalid version greater than toMan version
|
||||
{Name: "test1", Version: 30, Type: TypeManifest}, // invalid version greater than toMan version
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user