Compare commits

..
2 Commits
Author SHA1 Message Date
Tudor Marcu 3a46cb6a9d Release v3.3.5
This release fixes duplicate includes lines being printed in manifests.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2017-04-17 12:58:10 -07:00
Patrick McCarty 15c045de8d Avoid duplicate includes lines in manifests
There is no need for duplicate includes to exist in manifest headers, so
search the includes lists first before adding a new entry.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2017-04-11 11:53:21 -07:00
4 changed files with 61 additions and 3 deletions
+1
View File
@@ -114,6 +114,7 @@ dist_check_SCRIPTS = \
test/functional/full-run/test.bats \
test/functional/fullfiles/test.bats \
test/functional/include-version-bump/test.bats \
test/functional/includes-deduplicate/test.bats \
test/functional/no-delta/test.bats \
test/functional/pack/test.bats \
test/functional/state-file/test.bats \
+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.3.4, tudor.marcu@intel.com)
AC_INIT(swupd-server, 3.3.5, tudor.marcu@intel.com)
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC
+17 -2
View File
@@ -406,25 +406,40 @@ int main(int argc, char **argv)
GList *name_includes;
char *group = next_group();
struct manifest *manifest;
struct manifest *current = NULL;
if (!group) {
break;
}
manifest = g_hash_table_lookup(new_manifests, group);
name_includes = manifest->includes;
while (name_includes) {
char *name = name_includes->data;
name_includes = g_list_next(name_includes);
manifest_includes = g_list_prepend(manifest_includes, g_hash_table_lookup(new_manifests, name));
current = g_hash_table_lookup(new_manifests, name);
// Avoid adding duplicate includes to the list
if (g_list_find(manifest_includes, current) == NULL) {
manifest_includes = g_list_prepend(manifest_includes, current);
}
}
manifest->includes = manifest_includes;
manifest_includes = NULL;
manifest = g_hash_table_lookup(old_manifests, group);
name_includes = manifest->includes;
while (name_includes) {
char *name = name_includes->data;
name_includes = g_list_next(name_includes);
manifest_includes = g_list_prepend(manifest_includes, g_hash_table_lookup(old_manifests, name));
current = g_hash_table_lookup(old_manifests, name);
// Avoid adding duplicate includes to the list
if (g_list_find(manifest_includes, current) == NULL) {
manifest_includes = g_list_prepend(manifest_includes, current);
}
}
manifest->includes = manifest_includes;
}
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bats
# common functions
load "../swupdlib"
setup() {
clean_test_dir
init_test_dir
init_server_ini
set_latest_ver 0
init_groups_ini os-core test-bundle1 test-bundle2
set_os_release 10 os-core
track_bundle 10 os-core
track_bundle 10 test-bundle1
track_bundle 10 test-bundle2
set_os_release 20 os-core
track_bundle 20 os-core
track_bundle 20 test-bundle1
track_bundle 20 test-bundle2
gen_file_plain 10 os-core test0
gen_file_plain 10 test-bundle1 test1
gen_file_plain 10 test-bundle2 test2
gen_includes_file test-bundle2 10 test-bundle1 test-bundle1
gen_includes_file test-bundle2 20 test-bundle1 test-bundle1
}
@test "deduplicate bundle includes" {
sudo $CREATE_UPDATE --osversion 10 --statedir $DIR --format 3
set_latest_ver 10
sudo $CREATE_UPDATE --osversion 20 --statedir $DIR --format 3
# includes list should be deduplicated in both the old and new manifests
[[ 1 -eq $(grep '^includes: test-bundle1$' $DIR/www/10/Manifest.test-bundle2 | wc -l) ]]
[[ 1 -eq $(grep '^includes: test-bundle1$' $DIR/www/20/Manifest.test-bundle2 | wc -l) ]]
}
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80