swupd: make slim packs across minversions

Add an additional fileContentInManifest check to pack creation to
exclude full files that are represented in the from manifest even if the
version changed in the to manifest. This allows mixer to exclude
unchanged files from delta packs over minversion bumps.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
Matthew Johnson
2018-07-02 17:13:52 -07:00
committed by tmarcu
parent 6614ab1ab2
commit 77aeaad2f5
2 changed files with 26 additions and 1 deletions
+25
View File
@@ -887,6 +887,31 @@ func writeIndexManifest(c *config, ui *UpdateInfo, bundles []*Manifest) (*Manife
return idxMan, nil
}
func fileContentInManifest(f *File, m *Manifest) bool {
if m == nil {
return false
}
for i := range m.Files {
if f.Name != m.Files[i].Name {
continue
}
if f.Hash != m.Files[i].Hash {
continue
}
if f.Type != m.Files[i].Type {
continue
}
if f.Status != m.Files[i].Status {
continue
}
if f.Modifier != m.Files[i].Modifier {
continue
}
return true
}
return false
}
// this is a hack to allow users to update using swupd-client v3.15.3 which performs a
// check on contentsize with a maximum a couple of orders off the intended maximum.
// Remove this code (and the caller) when a format bump has occurred in Clear.
+1 -1
View File
@@ -238,7 +238,7 @@ func WritePack(w io.Writer, fromManifest, toManifest *Manifest, outputDir, chroo
entry := &info.Entries[i]
entry.File = f
if f.Version <= fromVersion {
if f.Version <= fromVersion || fileContentInManifest(f, fromManifest) {
entry.Reason = "already in from manifest"
continue
}