Compare commits

...
2 Commits
Author SHA1 Message Date
Matthew Johnson 90c1c89183 Release v3.7.2
This release fixes a bug that caused ghosted files to only be deprecated
over format bumps. Ghosted files are now removed from the manifest every
build.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-11-28 13:39:54 -08:00
Matthew Johnson 010131eb85 Fix ghosted-file deprecation
Ghosted files were only being deprecated over format bumps. Move the
format-bump-check logic out to the calling function to allow ghosted
files to be removed on every build. Also assign the is_ghosted flag when
adding "deleted" files from the old manifest so that the file will
actually be removed.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-11-28 13:39:38 -08:00
4 changed files with 27 additions and 15 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.66])
AC_INIT(swupd-server, 3.7.1, matthew.johnson@intel.com)
AC_INIT(swupd-server, 3.7.2, matthew.johnson@intel.com)
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC
+18 -3
View File
@@ -336,7 +336,12 @@ int main(int argc, char **argv)
apply_heuristics(new_full);
match_manifests(old_full, new_full);
old_deleted = remove_deprecated_files(old_full, new_full, both_deleted);
if (old_full->format < new_full->format) {
old_deleted = remove_deprecated_files(old_full, new_full, both_deleted);
} else {
old_deleted = 0;
}
if (old_deleted > 0) {
LOG(NULL, "", "Old deleted files (%d) removed from full manifest", old_deleted);
printf("Old deleted files (%d) removed from full manifest\n", old_deleted);
@@ -402,7 +407,12 @@ int main(int argc, char **argv)
/* Detect renamed files specifically for os-core */
rename_detection(new_core);
#endif
old_deleted = remove_deprecated_files(old_core, new_core, both_deleted);
if (old_core->format < new_core->format) {
old_deleted = remove_deprecated_files(old_core, new_core, both_deleted);
} else {
old_deleted = 0;
}
old_ghosted = remove_deprecated_files(old_core, new_core, both_ghosted);
sort_manifest_by_version(new_core); /* sorts by filename */
/* clean up orphaned renames by marking them as deleted */
@@ -526,7 +536,12 @@ int main(int argc, char **argv)
rename_detection(newm);
#endif
/* Step 6b: otherwise, write out the manifest */
old_deleted = remove_deprecated_files(oldm, newm, both_deleted);
if (oldm->format < newm->format) {
old_deleted = remove_deprecated_files(oldm, newm, both_deleted);
} else {
old_deleted = 0;
}
old_ghosted = remove_deprecated_files(oldm, newm, both_ghosted);
sort_manifest_by_version(newm);
type_change_detection(newm);
+7 -10
View File
@@ -440,8 +440,11 @@ int match_manifests(struct manifest *m1, struct manifest *m2)
file3->is_config = file1->is_config;
file3->is_state = file1->is_state;
file3->is_boot = file1->is_boot;
file3->is_ghosted = file1->is_ghosted;
/* ghost deleted boot files */
file3->is_ghosted = file1->is_boot && file1->is_deleted;
if (!file3->is_ghosted) {
file3->is_ghosted = file1->is_boot && file1->is_deleted;
}
if (file3->is_ghosted || file1->is_deleted) {
/* if the new file is ghosted or the file was deleted, preserve
@@ -983,10 +986,9 @@ bool changed_includes(struct manifest *old, struct manifest *new)
return false;
}
/* For a format bump, it's convenient to remove deleted files from manifests
* that last changed prior to the format bump, since they are no longer
* considered for deletion as part of an update.
*
/* Remove files deprecated in this version as identified by the compfunc
* function. This function can be used to remove old deleted files over a format
* bump and remove deprecated ghosted files.
* Note: this function should be called after match_manifests().
*/
int remove_deprecated_files(struct manifest *m1, struct manifest *m2, bool (*compfunc)(struct file *file1, struct file *file2))
@@ -1005,11 +1007,6 @@ int remove_deprecated_files(struct manifest *m1, struct manifest *m2, bool (*com
return -1;
}
/* This is the common case, so bail early, reporting no deletions */
if (m1->format == m2->format) {
return 0;
}
/* At this point, the manifest formats mismatch, and it's assumed that
* m1 is the old manifest, and m2 is the new.
*/
+1 -1
View File
@@ -52,7 +52,7 @@ setup() {
# version 20: add a new boot file
[ 1 -eq $(grep 'F\.b\. .* 20 /usr/lib/kernel/baz' $DIR/www/20/Manifest.full | wc -l) ]
# version 30: old ghosted file /usr/lib/kernel/bar cleaned up
[ 0 -eq $(grep '10 /usr/lib/kernel/bar' $DIR/www/30/Manifest.full | wc -l) ]
[ 0 -eq $(grep '/usr/lib/kernel/bar' $DIR/www/30/Manifest.full | wc -l) ]
# version 30: boot file added in version 20 ghosted
[ 1 -eq $(grep '\.gb\. .* 30 /usr/lib/kernel/baz' $DIR/www/30/Manifest.full | wc -l) ]
}