mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-06 05:31:50 +00:00
Add config to linkPeersAndChange
Needed for the rename code. Currently the old Manifest does not have the Info field populated in its files, but the rename code wants to know the size of the files to see if it makes sense to use a deleted file as the source of a rename. This means that we will need to call os.Stat on the files, and we need the config to tell us where they are. Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
This commit is contained in:
committed by
Matthew Johnson
parent
59c21bf79a
commit
70bc5ae9aa
@@ -150,7 +150,7 @@ func processBundles(ui UpdateInfo, c config) ([]*Manifest, error) {
|
||||
oldM := getOldManifest(oldMPath)
|
||||
changedIncludes := compareIncludes(bundle, oldM)
|
||||
oldM.sortFilesName()
|
||||
changedFiles, added, deleted := bundle.linkPeersAndChange(oldM, ui.minVersion)
|
||||
changedFiles, added, deleted := bundle.linkPeersAndChange(oldM, c, ui.minVersion)
|
||||
// if nothing changed, skip
|
||||
if changedFiles == 0 && added == 0 && deleted == 0 && !changedIncludes {
|
||||
continue
|
||||
|
||||
+2
-2
@@ -374,7 +374,7 @@ func (m *Manifest) sortFilesVersionName() {
|
||||
// in the chroot for that manifest. Link delta peers with the oldManifest
|
||||
// if the file in the oldManifest is not deleted or ghosted.
|
||||
// Expects m and oldManifest files lists to be sorted by name only
|
||||
func (m *Manifest) linkPeersAndChange(oldManifest *Manifest, minVersion uint32) (int, int, int) {
|
||||
func (m *Manifest) linkPeersAndChange(oldManifest *Manifest, c config, minVersion uint32) (int, int, int) {
|
||||
// set previous version to oldManifest version
|
||||
m.Header.Previous = oldManifest.Header.Version
|
||||
|
||||
@@ -854,7 +854,7 @@ func writeIndexManifest(c *config, ui *UpdateInfo, bundles []*Manifest) (string,
|
||||
oldM := getOldManifest(oldMPath)
|
||||
oldM.sortFilesName()
|
||||
// linkPeersAndChange will update file versions correctly
|
||||
_, _, _ = idxMan.linkPeersAndChange(oldM, ui.minVersion)
|
||||
_, _, _ = idxMan.linkPeersAndChange(oldM, *c, ui.minVersion)
|
||||
// now add any new files to the full manifest
|
||||
lenIdxM := len(idxMan.Files)
|
||||
lenFullM := len(newFull.Files)
|
||||
|
||||
@@ -402,7 +402,7 @@ func TestLinkPeersAndChange(t *testing.T) {
|
||||
// by name.
|
||||
mNew.sortFilesName()
|
||||
mOld.sortFilesName()
|
||||
changed, added, deleted := mNew.linkPeersAndChange(&mOld, 0)
|
||||
changed, added, deleted := mNew.linkPeersAndChange(&mOld, config{}, 0)
|
||||
if changed != 2 {
|
||||
t.Errorf("%v files detected as changed when 2 was expected", changed)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user