From b5bd920611caa14aae8bfae679ff21beabb64bf5 Mon Sep 17 00:00:00 2001 From: Castulo Martinez Date: Fri, 27 Dec 2019 13:02:58 -0800 Subject: [PATCH] Fix the number of steps in swupd functions In order to report progress accuratelly, currently swupd requires a hardcoded number of steps per operation so we can report how far in the operation we are. Most of these step totals are wrong. This commit fixes the number of steps in many swupd functions. Signed-off-by: Castulo Martinez --- src/3rd_party_add.c | 16 +- src/3rd_party_bundle_add.c | 28 +-- src/3rd_party_bundle_info.c | 10 +- src/3rd_party_bundle_list.c | 7 +- src/3rd_party_bundle_remove.c | 19 +- src/3rd_party_check_update.c | 8 +- src/3rd_party_clean.c | 6 +- src/3rd_party_diagnose.c | 32 +-- src/3rd_party_list.c | 11 +- src/3rd_party_remove.c | 9 +- src/3rd_party_repair.c | 44 ++-- src/3rd_party_repos.c | 11 +- src/3rd_party_repos.h | 4 +- src/3rd_party_update.c | 43 ++-- src/bundle_add.c | 40 ++-- src/bundle_info.c | 15 +- src/bundle_list.c | 11 +- src/bundle_remove.c | 19 +- src/check_update.c | 16 +- src/clean.c | 6 +- src/info.c | 12 +- src/mirror.c | 5 +- src/os_install.c | 40 ++-- src/repair.c | 46 ++-- src/search_file.c | 41 ++-- src/update.c | 68 +++--- src/verify.c | 78 ++++--- test/functional/bundleadd/add-json.bats | 2 +- test/functional/repair/repair-json.bats | 198 +++++++++--------- test/functional/update/update-download.bats | 1 - .../update/update-search-file-index.bats | 2 +- 31 files changed, 469 insertions(+), 379 deletions(-) diff --git a/src/3rd_party_add.c b/src/3rd_party_add.c index 0c5d5a66..94b6e90a 100644 --- a/src/3rd_party_add.c +++ b/src/3rd_party_add.c @@ -88,8 +88,8 @@ static int remove_repo(const char *repo_name) enum swupd_code third_party_add_main(int argc, char **argv) { - enum swupd_code ret_code = SWUPD_OK; + const int step_in_third_party_add = 9; const char *name, *url; struct list *repos = NULL; struct repo *repo = NULL; @@ -99,21 +99,25 @@ enum swupd_code third_party_add_main(int argc, char **argv) int repo_version; int ret; const bool DONT_VERIFY_CERTIFICATE = false; - /* total steps for adding a 3rd-party repo are 8: - * one for adding the repo, plus 7 steps for adding bundle os-core */ - const int step_in_third_party_add = 8; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("third-party-add", step_in_third_party_add); ret_code = swupd_init(SWUPD_ALL); if (ret_code != SWUPD_OK) { - goto finish; + return ret_code; } + /* + * Steps for repo add: + * 1) add_repo, + * 2-9) 8 steps for adding bundle os-core + */ + progress_init_steps("third-party-add", step_in_third_party_add); + name = argv[argc - 2]; url = argv[argc - 1]; diff --git a/src/3rd_party_bundle_add.c b/src/3rd_party_bundle_add.c index 691f4676..51a90b73 100644 --- a/src/3rd_party_bundle_add.c +++ b/src/3rd_party_bundle_add.c @@ -114,22 +114,10 @@ enum swupd_code third_party_bundle_add_main(int argc, char **argv) { struct list *bundles = NULL; enum swupd_code ret_code = SWUPD_OK; - - /* - * Steps for 3rd-party bundle-add: - * - * 1) load_manifests - * 2) download_packs - * 3) extract_packs - * 4) validate_fullfiles - * 5) download_fullfiles - * 6) extract_fullfiles - * 7) install_files - */ - - const int steps_in_bundleadd = 7; + const int steps_in_bundleadd = 8; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -140,6 +128,18 @@ enum swupd_code third_party_bundle_add_main(int argc, char **argv) error("Failed swupd initialization, exiting now\n"); return ret_code; } + + /* + * Steps for 3rd-party bundle-add: + * 1) load_manifests + * 2) download_packs + * 3) extract_packs + * 4) validate_fullfiles + * 5) download_fullfiles + * 6) extract_fullfiles + * 7) install_files + * 8) run_postupdate_scripts + */ progress_init_steps("3rd-party-bundle-add", steps_in_bundleadd); /* move the bundles provided in the command line into a diff --git a/src/3rd_party_bundle_info.c b/src/3rd_party_bundle_info.c index 90b00e14..f00acc15 100644 --- a/src/3rd_party_bundle_info.c +++ b/src/3rd_party_bundle_info.c @@ -118,13 +118,12 @@ static bool parse_options(int argc, char **argv) enum swupd_code third_party_bundle_info_main(int argc, char **argv) { - struct list *bundles = NULL; enum swupd_code ret_code = SWUPD_OK; - const int steps_in_bundleinfo = 1; - - /* there is no need to report in progress for bundle-info at this time */ + const int steps_in_bundleinfo = 0; + struct list *bundles = NULL; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -134,13 +133,14 @@ enum swupd_code third_party_bundle_info_main(int argc, char **argv) error("Failed swupd initialization, exiting now\n"); return ret_code; } - progress_init_steps("3rd-party-bundle-info", steps_in_bundleinfo); /* set the command options */ bundle_info_set_option_version(cmdline_option_version); bundle_info_set_option_dependencies(cmdline_option_dependencies); bundle_info_set_option_files(cmdline_option_files); + progress_init_steps("3rd-party-bundle-info", steps_in_bundleinfo); + bundles = list_append_data(bundles, cmdline_option_bundle); ret_code = third_party_run_operation(bundles, cmdline_option_repo, bundle_info); diff --git a/src/3rd_party_bundle_list.c b/src/3rd_party_bundle_list.c index a19f984f..ca6af0ce 100644 --- a/src/3rd_party_bundle_list.c +++ b/src/3rd_party_bundle_list.c @@ -133,9 +133,10 @@ static enum swupd_code list_repo_bundles(UNUSED_PARAM char *unused) enum swupd_code third_party_bundle_list_main(int argc, char **argv) { enum swupd_code ret_code = SWUPD_OK; - const int steps_in_bundlelist = 1; + const int steps_in_bundlelist = 0; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -145,12 +146,10 @@ enum swupd_code third_party_bundle_list_main(int argc, char **argv) } else { ret_code = swupd_init(SWUPD_ALL); } - if (ret_code != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); return ret_code; } - progress_init_steps("3rd-party-bundle-list", steps_in_bundlelist); /* set the command options */ bundle_list_set_option_all(cmdline_option_all); @@ -158,7 +157,7 @@ enum swupd_code third_party_bundle_list_main(int argc, char **argv) bundle_list_set_option_deps(cmdline_option_deps); /* list the bundles */ - ret_code = third_party_run_operation_multirepo(cmdline_repo, list_repo_bundles, SWUPD_OK); + ret_code = third_party_run_operation_multirepo(cmdline_repo, list_repo_bundles, SWUPD_OK, "bundle-list", steps_in_bundlelist); swupd_deinit(); progress_finish_steps(ret_code); diff --git a/src/3rd_party_bundle_remove.c b/src/3rd_party_bundle_remove.c index fe119463..86ef2a07 100644 --- a/src/3rd_party_bundle_remove.c +++ b/src/3rd_party_bundle_remove.c @@ -108,19 +108,12 @@ static enum swupd_code remove_bundle(char *bundle) enum swupd_code third_party_bundle_remove_main(int argc, char **argv) { - struct list *bundles = NULL; enum swupd_code ret_code = SWUPD_OK; - - /* - * Steps for bundle-remove: - * - * 1) load_manifests - * 2) remove_files - */ - const int steps_in_bundle_remove = 2; + struct list *bundles = NULL; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -131,7 +124,6 @@ enum swupd_code third_party_bundle_remove_main(int argc, char **argv) error("Failed swupd initialization, exiting now\n"); return ret_code; } - progress_init_steps("3rd-party-bundle-remove", steps_in_bundle_remove); /* move the bundles provided in the command line into a * list so it is easier to handle them */ @@ -145,6 +137,13 @@ enum swupd_code third_party_bundle_remove_main(int argc, char **argv) bundle_remove_set_option_force(cmdline_option_force); bundle_remove_set_option_recursive(cmdline_option_recursive); + /* + * Steps for bundle-remove: + * 1) load_manifests + * 2) remove_files + */ + progress_init_steps("3rd-party-bundle-remove", steps_in_bundle_remove); + /* try removing bundles one by one */ ret_code = third_party_run_operation(bundles, cmdline_option_repo, remove_bundle); diff --git a/src/3rd_party_check_update.c b/src/3rd_party_check_update.c index 3597b5ff..632f3c4a 100644 --- a/src/3rd_party_check_update.c +++ b/src/3rd_party_check_update.c @@ -84,11 +84,10 @@ static enum swupd_code check_update_repo(UNUSED_PARAM char *unused) enum swupd_code third_party_check_update_main(int argc, char **argv) { enum swupd_code ret_code = SWUPD_OK; - const int steps_in_checkupdate = 1; - - /* there is no need to report in progress for check-update at this time */ + const int steps_in_checkupdate = 0; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -97,10 +96,9 @@ enum swupd_code third_party_check_update_main(int argc, char **argv) if (ret_code != SWUPD_OK) { return ret_code; } - progress_init_steps("3rd-party-check-update", steps_in_checkupdate); /* run check-update */ - ret_code = third_party_run_operation_multirepo(cmdline_option_repo, check_update_repo, SWUPD_NO); + ret_code = third_party_run_operation_multirepo(cmdline_option_repo, check_update_repo, SWUPD_NO, "check-update", steps_in_checkupdate); swupd_deinit(); progress_finish_steps(ret_code); diff --git a/src/3rd_party_clean.c b/src/3rd_party_clean.c index a86950b5..ba6d40bf 100644 --- a/src/3rd_party_clean.c +++ b/src/3rd_party_clean.c @@ -112,9 +112,10 @@ static enum swupd_code clean_repos_state(UNUSED_PARAM char *unused) enum swupd_code third_party_clean_main(int argc, char **argv) { enum swupd_code ret_code = SWUPD_OK; - const int steps_in_clean = 1; + const int steps_in_clean = 0; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -124,10 +125,9 @@ enum swupd_code third_party_clean_main(int argc, char **argv) error("Failed swupd initialization, exiting now\n"); return ret_code; } - progress_init_steps("3rd-party-clean", steps_in_clean); /* clean the cache */ - ret_code = third_party_run_operation_multirepo(cmdline_option_repo, clean_repos_state, SWUPD_OK); + ret_code = third_party_run_operation_multirepo(cmdline_option_repo, clean_repos_state, SWUPD_OK, "clean", steps_in_clean); swupd_deinit(); progress_finish_steps(ret_code); diff --git a/src/3rd_party_diagnose.c b/src/3rd_party_diagnose.c index 2d8b7394..d3cfbc74 100644 --- a/src/3rd_party_diagnose.c +++ b/src/3rd_party_diagnose.c @@ -202,20 +202,11 @@ static enum swupd_code diagnose_repos(UNUSED_PARAM char *unused) enum swupd_code third_party_diagnose_main(int argc, char **argv) { enum swupd_code ret_code = SWUPD_OK; - - /* - * Steps for diagnose: - * - * 1) load_manifests - * 2) add_missing_files - * 3) fix_files - * 4) remove_extraneous_files - */ - const int steps_in_diagnose = 4; - + int steps_in_diagnose; string_or_die(&cmdline_option_picky_tree, "/usr"); if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -226,7 +217,6 @@ enum swupd_code third_party_diagnose_main(int argc, char **argv) free_string(&cmdline_option_picky_tree); return ret_code; } - progress_init_steps("3rd-party-diagnose", steps_in_diagnose); /* set the command options */ verify_set_option_force(cmdline_option_force); @@ -237,8 +227,24 @@ enum swupd_code third_party_diagnose_main(int argc, char **argv) verify_set_picky_tree(cmdline_option_picky_tree); verify_set_extra_files_only(cmdline_option_extra_files_only); + /* + * Steps for diagnose: + * 1) load_manifests (with --extra-files-only jumps to step 5) + * 2) add_missing_files (finishes here on --quick) + * 3) fix_files + * 4) remove_extraneous_files + * 5) remove_extra_files (only with --picky or with --extra-files-only) + */ + if (cmdline_option_extra_files_only || cmdline_option_quick) { + steps_in_diagnose = 2; + } else if (cmdline_option_picky) { + steps_in_diagnose = 5; + } else { + steps_in_diagnose = 4; + } + /* diagnose 3rd-party bundles */ - ret_code = third_party_run_operation_multirepo(cmdline_option_repo, diagnose_repos, SWUPD_OK); + ret_code = third_party_run_operation_multirepo(cmdline_option_repo, diagnose_repos, SWUPD_OK, "diagnose", steps_in_diagnose); free_string(&cmdline_option_picky_tree); if (picky_whitelist) { diff --git a/src/3rd_party_list.c b/src/3rd_party_list.c index 268e58bf..c1b154a2 100644 --- a/src/3rd_party_list.c +++ b/src/3rd_party_list.c @@ -73,23 +73,24 @@ static void list_repos(void) enum swupd_code third_party_list_main(int argc, char **argv) { enum swupd_code ret = SWUPD_OK; - const int step_in_third_party_list = 1; + const int step_in_third_party_list = 0; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("third-party-list", step_in_third_party_list); - ret = swupd_init(SWUPD_NO_ROOT); if (ret != SWUPD_OK) { - goto finish; + return ret; } + progress_init_steps("third-party-list", step_in_third_party_list); + list_repos(); -finish: swupd_deinit(); progress_finish_steps(ret); + return ret; } diff --git a/src/3rd_party_remove.c b/src/3rd_party_remove.c index 456e9bfc..fb8a0189 100644 --- a/src/3rd_party_remove.c +++ b/src/3rd_party_remove.c @@ -68,21 +68,23 @@ static bool parse_options(int argc, char **argv) enum swupd_code third_party_remove_main(int argc, char **argv) { enum swupd_code ret = SWUPD_OK; + const int step_in_third_party_remove = 0; int err; char *name = NULL; - const int step_in_third_party_remove = 1; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("third-party-remove", step_in_third_party_remove); ret = swupd_init(SWUPD_NO_ROOT); if (ret != SWUPD_OK) { - goto exit; + return ret; } + progress_init_steps("third-party-remove", step_in_third_party_remove); + /* The last argument has to be the repo-name to be deleted */ name = argv[argc - 1]; info("Removing repository %s...\n", name); @@ -108,6 +110,7 @@ exit: } swupd_deinit(); progress_finish_steps(ret); + return ret; } diff --git a/src/3rd_party_repair.c b/src/3rd_party_repair.c index 9b44c8e1..22d47b0b 100644 --- a/src/3rd_party_repair.c +++ b/src/3rd_party_repair.c @@ -204,25 +204,11 @@ static enum swupd_code repair_repos(UNUSED_PARAM char *unused) enum swupd_code third_party_repair_main(int argc, char **argv) { enum swupd_code ret_code = SWUPD_OK; - - /* - * Steps for repair: - * - * 1) load_manifests - * 2) check_files_hash - * 3) validate_fullfiles - * 4) download_fullfiles - * 5) extract_fullfiles - * 6) add_missing_files - * 7) fix_files - * 8) remove_extraneous_files - * 9) remove_extra_files - */ - const int steps_in_repair = 9; - + int steps_in_repair; string_or_die(&cmdline_option_picky_tree, "%s", picky_tree_default); if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -233,7 +219,6 @@ enum swupd_code third_party_repair_main(int argc, char **argv) free_string(&cmdline_option_picky_tree); return ret_code; } - progress_init_steps("3rd-party-repair", steps_in_repair); /* set the command options */ verify_set_option_fix(true); @@ -245,8 +230,31 @@ enum swupd_code third_party_repair_main(int argc, char **argv) verify_set_picky_tree(cmdline_option_picky_tree); verify_set_option_bundles(cmdline_option_bundles); + /* + * Steps for repair: + * 1) load_manifests (with --extra-files-only jumps to step 9) + * 2) check_files_hash + * 3) validate_fullfiles + * 4) download_fullfiles + * 5) extract_fullfiles + * 6) add_missing_files (with --quick jumps to step 10) + * 7) fix_files + * 8) remove_extraneous_files + * 9) remove_extra_files (only with --picky or with --extra-files-only) + * 10) run_postupdate_scripts + */ + if (cmdline_option_extra_files_only) { + steps_in_repair = 3; + } else if (cmdline_option_quick) { + steps_in_repair = 7; + } else if (cmdline_option_picky) { + steps_in_repair = 10; + } else { + steps_in_repair = 9; + } + /* run repair (verify --fix) */ - ret_code = third_party_run_operation_multirepo(cmdline_option_repo, repair_repos, SWUPD_OK); + ret_code = third_party_run_operation_multirepo(cmdline_option_repo, repair_repos, SWUPD_OK, "repair", steps_in_repair); free_string(&cmdline_option_picky_tree); if (picky_whitelist) { diff --git a/src/3rd_party_repos.c b/src/3rd_party_repos.c index c6b2cdd9..443da95a 100644 --- a/src/3rd_party_repos.c +++ b/src/3rd_party_repos.c @@ -464,7 +464,7 @@ clean_and_exit: return ret_code; } -enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operation_fn_t run_operation_fn, enum swupd_code expected_ret_code) +enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operation_fn_t run_operation_fn, enum swupd_code expected_ret_code, const char *op_name, int op_steps) { enum swupd_code ret_code = SWUPD_OK; enum swupd_code ret; @@ -473,6 +473,10 @@ enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operat struct repo *selected_repo = NULL; char *state_dir; char *path_prefix; + char *steps_title = NULL; + int total_steps; + + string_or_die(&steps_title, "3rd-party-%s", op_name); /* load the existing 3rd-party repos from the repo.ini config file */ repos = third_party_get_repos(); @@ -481,6 +485,10 @@ enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operat state_dir = strdup_or_die(globals.state_dir); path_prefix = strdup_or_die(globals.path_prefix); + /* initialize operation steps so progress can be reported */ + total_steps = repo ? op_steps : op_steps * list_len(repos); + progress_init_steps(steps_title, total_steps); + /* if the repo to be used was specified, use it, * otherwise perform operation in all 3rd-party repos */ if (repo) { @@ -528,6 +536,7 @@ enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operat /* free data */ clean_and_exit: list_free_list_and_data(repos, repo_free_data); + free_string(&steps_title); free_string(&path_prefix); free_string(&state_dir); diff --git a/src/3rd_party_repos.h b/src/3rd_party_repos.h index f60575e0..947dc1ee 100644 --- a/src/3rd_party_repos.h +++ b/src/3rd_party_repos.h @@ -114,10 +114,12 @@ enum swupd_code third_party_run_operation(struct list *bundles, const char *repo * @param repo the name of the 3rd-party repository where the operation will be run * @param run_operation_fn the function to be performed * @param expected_ret_code the expected return code from the operation + * @param op_name the name of the operation to be run in all repos + * @param op_steps the number of steps involved in the operation * * @returns a swupd_code */ -enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operation_fn_t run_operation_fn, enum swupd_code expected_ret_code); +enum swupd_code third_party_run_operation_multirepo(const char *repo, run_operation_fn_t run_operation_fn, enum swupd_code expected_ret_code, const char *op_name, int op_steps); /** * @brief Prints a header with the repository name, useful when showing info from multiple repos. diff --git a/src/3rd_party_update.c b/src/3rd_party_update.c index f2b24580..5d647127 100644 --- a/src/3rd_party_update.c +++ b/src/3rd_party_update.c @@ -138,24 +138,10 @@ static enum swupd_code update_repos(UNUSED_PARAM char *unused) enum swupd_code third_party_update_main(int argc, char **argv) { enum swupd_code ret_code = SWUPD_OK; - - /* - * Steps for update: - * - * 1) load_manifests - * 2) run_preupdate_scripts - * 3) download_packs - * 4) extract_packs - * 5) prepare_for_update - * 6) validate_fullfiles - * 7) download_fullfiles - * 8) extract_fullfiles - * 9) update_files - * 10) run_postupdate_scripts - */ - const int steps_in_update = 10; + int steps_in_update; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } @@ -165,15 +151,36 @@ enum swupd_code third_party_update_main(int argc, char **argv) error("Failed swupd initialization, exiting now\n"); return ret_code; } - progress_init_steps("3rd-party-update", steps_in_update); /* set the command options */ update_set_option_version(cmdline_option_version); update_set_option_download_only(cmdline_option_download_only); update_set_option_keepcache(cmdline_option_keepcache); + /* + * Steps for update: + * 1) load_manifests + * 2) run_preupdate_scripts + * 3) download_packs + * 4) extract_packs + * 5) prepare_for_update + * 6) validate_fullfiles + * 7) download_fullfiles + * 8) extract_fullfiles (finishes here on --download) + * 9) update_files + * 10) run_postupdate_scripts + * 11) update_search_index (only with --update-search-file-index) + */ + if (cmdline_option_status) { + steps_in_update = 0; + } else if (cmdline_option_download_only) { + steps_in_update = 8; + } else { + steps_in_update = 10; + } + /* update 3rd-party bundles */ - ret_code = third_party_run_operation_multirepo(cmdline_option_repo, update_repos, SWUPD_NO); + ret_code = third_party_run_operation_multirepo(cmdline_option_repo, update_repos, SWUPD_NO, "update", steps_in_update); swupd_deinit(); progress_finish_steps(ret_code); diff --git a/src/bundle_add.c b/src/bundle_add.c index 5a363cea..cfc4f1e5 100644 --- a/src/bundle_add.c +++ b/src/bundle_add.c @@ -296,7 +296,9 @@ static enum swupd_code download_content(struct manifest *mom, struct list *to_in /* the progress would be completed within the * download_subscribed_packs function, since we * didn't run it, manually mark the step as completed */ + progress_next_step("download_packs", PROGRESS_BAR); info("No packs need to be downloaded\n"); + progress_next_step("extract_packs", PROGRESS_UNDEFINED); } timelist_timer_stop(globals.global_times); // closing: Download packs @@ -343,6 +345,7 @@ enum swupd_code bundle_add(struct list *bundles_list, int version) /* get the current Mom */ timelist_timer_start(globals.global_times, "Load MoM"); mix_exists = (check_mix_exists() & system_on_mix()); + progress_next_step("load_manifests", PROGRESS_UNDEFINED); mom = load_mom(version, mix_exists, NULL); if (!mom) { error("Cannot load official manifest MoM for version %i\n", version); @@ -356,7 +359,6 @@ enum swupd_code bundle_add(struct list *bundles_list, int version) timelist_timer_start(globals.global_times, "Add bundles and recurse"); /* get a list of bundles already installed in the system */ info("Loading required manifests...\n"); - progress_next_step("load_manifests", PROGRESS_UNDEFINED); ret = mom_get_manifests_list(mom, &installed_bundles, is_installed_bundle_data); if (ret) { ret = SWUPD_COULDNT_LOAD_MANIFEST; @@ -475,32 +477,19 @@ enum swupd_code execute_bundle_add(struct list *bundles_list) enum swupd_code bundle_add_main(int argc, char **argv) { - struct list *bundles_list = NULL; - int ret; - - /* - * Steps for bundle-add: - * - * 1) load_manifests - * 2) download_packs - * 3) extract_packs - * 4) validate_fullfiles - * 5) download_fullfiles - * 6) extract_fullfiles - * 7) install_files - * 8) run_postupdate_scripts - */ + enum swupd_code ret = SWUPD_OK; const int steps_in_bundleadd = 8; + struct list *bundles_list = NULL; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("bundle-add", steps_in_bundleadd); /* initialize swupd */ ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); return ret; } @@ -513,11 +502,24 @@ enum swupd_code bundle_add_main(int argc, char **argv) } bundles_list = list_head(bundles_list); + /* + * Steps for bundle-add: + * 1) load_manifests + * 2) download_packs + * 3) extract_packs + * 4) validate_fullfiles + * 5) download_fullfiles + * 6) extract_fullfiles + * 7) install_files + * 8) run_postupdate_scripts + */ + progress_init_steps("bundle-add", steps_in_bundleadd); + ret = execute_bundle_add(bundles_list); list_free_list(bundles_list); - progress_finish_steps(ret); swupd_deinit(); + progress_finish_steps(ret); return ret; } diff --git a/src/bundle_info.c b/src/bundle_info.c index daec7dc7..e0e0ba5b 100644 --- a/src/bundle_info.c +++ b/src/bundle_info.c @@ -450,28 +450,27 @@ clean: enum swupd_code bundle_info_main(int argc, char **argv) { - int ret; - const int steps_in_bundleinfo = 1; - + enum swupd_code ret = SWUPD_OK; + const int steps_in_bundleinfo = 0; /* there is no need to report in progress for bundle-info at this time */ if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("bundle-info", steps_in_bundleinfo); ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); - goto exit; + return ret; } + progress_init_steps("bundle-info", steps_in_bundleinfo); + ret = bundle_info(bundle); swupd_deinit(); - -exit: progress_finish_steps(ret); return ret; diff --git a/src/bundle_list.c b/src/bundle_list.c index 5ecf2b01..bf070c57 100644 --- a/src/bundle_list.c +++ b/src/bundle_list.c @@ -433,32 +433,33 @@ enum swupd_code list_bundles(void) enum swupd_code bundle_list_main(int argc, char **argv) { - enum swupd_code ret; - const int steps_in_bundlelist = 1; - + enum swupd_code ret = SWUPD_OK; + const int steps_in_bundlelist = 0; /* there is no need to report in progress for bundle-list at this time */ if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("bundle-list", steps_in_bundlelist); if (cmdline_local && !is_root()) { ret = swupd_init(SWUPD_NO_ROOT); } else { ret = swupd_init(SWUPD_ALL); } - if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); progress_finish_steps(ret); return ret; } + progress_init_steps("bundle-list", steps_in_bundlelist); + ret = list_bundles(); swupd_deinit(); progress_finish_steps(ret); + return ret; } diff --git a/src/bundle_remove.c b/src/bundle_remove.c index bc4033ca..adb9c2f9 100644 --- a/src/bundle_remove.c +++ b/src/bundle_remove.c @@ -474,21 +474,15 @@ out: enum swupd_code bundle_remove_main(int argc, char **argv) { - struct list *bundles_list = NULL; - int ret; - /* - * Steps for bundle-remove: - * - * 1) load_manifests - * 2) remove_files - */ + enum swupd_code ret = SWUPD_OK; const int steps_in_bundle_remove = 2; + struct list *bundles_list = NULL; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("bundle-remove", steps_in_bundle_remove); /* initialize swupd */ ret = swupd_init(SWUPD_ALL); @@ -505,6 +499,13 @@ enum swupd_code bundle_remove_main(int argc, char **argv) } bundles_list = list_head(bundles_list); + /* + * Steps for bundle-remove: + * 1) load_manifests + * 2) remove_files + */ + progress_init_steps("bundle-remove", steps_in_bundle_remove); + ret = execute_remove_bundles(bundles_list); list_free_list(bundles_list); diff --git a/src/check_update.c b/src/check_update.c index 7c2fbee5..894465e4 100644 --- a/src/check_update.c +++ b/src/check_update.c @@ -154,25 +154,27 @@ static bool parse_options(int argc, char **argv) /* return 0 if update available, non-zero if not */ enum swupd_code check_update_main(int argc, char **argv) { - int ret; - const int steps_in_checkupdate = 1; - + enum swupd_code ret = SWUPD_OK; + const int steps_in_checkupdate = 0; /* there is no need to report in progress for check-update at this time */ if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("check-update", steps_in_checkupdate); ret = swupd_init(SWUPD_NO_ROOT); - if (ret != 0) { + if (ret != SWUPD_OK) { return ret; } - ret = check_update(); - swupd_deinit(); + progress_init_steps("check-update", steps_in_checkupdate); + ret = check_update(); + + swupd_deinit(); progress_finish_steps(ret); + return ret; } diff --git a/src/clean.c b/src/clean.c index f65c860b..dd3e055c 100644 --- a/src/clean.c +++ b/src/clean.c @@ -366,18 +366,20 @@ static enum swupd_code clean_staged_manifests(const char *path, bool dry_run, bo enum swupd_code clean_main(int argc, char **argv) { enum swupd_code ret = SWUPD_OK; - const int steps_in_clean = 1; + const int steps_in_clean = 0; if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); return ret; } + progress_init_steps("clean", steps_in_clean); /* NOTE: Delete specific file patterns to avoid disasters in case some paths are diff --git a/src/info.c b/src/info.c index ef55e329..e32f1a5e 100644 --- a/src/info.c +++ b/src/info.c @@ -91,26 +91,26 @@ static bool parse_options(int argc, char **argv) enum swupd_code info_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv) { enum swupd_code ret = SWUPD_OK; - const int steps_in_info = 1; - + const int steps_in_info = 0; /* there is no need to report in progress for init at this time */ if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } - progress_init_steps("info", steps_in_info); ret = swupd_init(SWUPD_NO_ROOT); if (ret != SWUPD_OK) { - goto finish; + return ret; } + progress_init_steps("info", steps_in_info); + ret = print_update_conf_info(); swupd_deinit(); - -finish: progress_finish_steps(ret); + return ret; } diff --git a/src/mirror.c b/src/mirror.c index b5e90f36..44d5d52e 100644 --- a/src/mirror.c +++ b/src/mirror.c @@ -349,14 +349,15 @@ enum swupd_code mirror_main(int argc, char **argv) { int ret = SWUPD_OK; enum swupd_code init_ret; - const int steps_in_mirror = 1; - + const int steps_in_mirror = 0; /* there is no need to report in progress for mirror at this time */ if (!parse_options(argc, argv)) { + print("\n"); print_help(); return SWUPD_INVALID_OPTION; } + progress_init_steps("mirror", steps_in_mirror); if (set) { diff --git a/src/os_install.c b/src/os_install.c index 104831cc..0018fdf5 100644 --- a/src/os_install.c +++ b/src/os_install.c @@ -151,22 +151,8 @@ static bool parse_options(int argc, char **argv) enum swupd_code install_main(int argc, char **argv) { - int ret = SWUPD_OK; - - /* - * Steps for os-install: - * - * 1) load_manifests - * 2) download_packs - * 3) extract_packs - * 4) check_files_hash - * 5) validate_fullfiles - * 6) download_fullfiles - * 7) extract_fullfiles - * 8) add_missing_files - * 9) run_postupdate_scripts - */ - const int steps_in_os_install = 9; + enum swupd_code ret = SWUPD_OK; + int steps_in_os_install; if (!parse_options(argc, argv)) { print("\n"); @@ -175,7 +161,7 @@ enum swupd_code install_main(int argc, char **argv) } ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); return ret; } @@ -199,8 +185,26 @@ enum swupd_code install_main(int argc, char **argv) verify_set_option_bundles(cmdline_bundles); verify_set_option_version(cmdline_option_version); - /* install */ + /* + * Steps for os-install: + * 1) load_manifests + * 2) download_packs + * 3) extract_packs + * 4) check_files_hash + * 5) validate_fullfiles + * 6) download_fullfiles + * 7) extract_fullfiles (with --download finishes here) + * 8) add_missing_files + * 9) run_postupdate_scripts + */ + if (cmdline_option_download) { + steps_in_os_install = 7; + } else { + steps_in_os_install = 9; + } progress_init_steps("os-install", steps_in_os_install); + + /* install */ ret = execute_verify(); swupd_deinit(); diff --git a/src/repair.c b/src/repair.c index 0c51225e..c5bfa364 100644 --- a/src/repair.c +++ b/src/repair.c @@ -208,23 +208,8 @@ done: enum swupd_code repair_main(int argc, char **argv) { - int ret; - - /* - * Steps for repair: - * - * 1) load_manifests - * 2) check_files_hash - * 3) validate_fullfiles - * 4) download_fullfiles - * 5) extract_fullfiles - * 6) add_missing_files - * 7) fix_files - * 8) remove_extraneous_files - * 9) remove_extra_files - */ - const int steps_in_repair = 9; - + enum swupd_code ret = SWUPD_OK; + int steps_in_repair; string_or_die(&cmdline_option_picky_tree, "%s", picky_tree_default); if (!parse_options(argc, argv)) { @@ -234,7 +219,7 @@ enum swupd_code repair_main(int argc, char **argv) } ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); free_string(&cmdline_option_picky_tree); return ret; @@ -252,8 +237,31 @@ enum swupd_code repair_main(int argc, char **argv) verify_set_extra_files_only(cmdline_option_extra_files_only); verify_set_option_bundles(cmdline_bundles); - /* run verify --fix */ + /* + * Steps for repair: + * 1) load_manifests (with --extra-files-only jumps to step 9) + * 2) check_files_hash + * 3) validate_fullfiles + * 4) download_fullfiles + * 5) extract_fullfiles + * 6) add_missing_files (with --quick jumps to step 10) + * 7) fix_files + * 8) remove_extraneous_files + * 9) remove_extra_files (only with --picky or with --extra-files-only) + * 10) run_postupdate_scripts + */ + if (cmdline_option_extra_files_only) { + steps_in_repair = 3; + } else if (cmdline_option_quick) { + steps_in_repair = 7; + } else if (cmdline_option_picky) { + steps_in_repair = 10; + } else { + steps_in_repair = 9; + } progress_init_steps("repair", steps_in_repair); + + /* run verify --fix */ ret = execute_verify(); free_string(&cmdline_option_picky_tree); diff --git a/src/search_file.c b/src/search_file.c index 9b68390f..29ad84d9 100644 --- a/src/search_file.c +++ b/src/search_file.c @@ -501,42 +501,43 @@ static bool parse_options(int argc, char **argv) enum swupd_code search_file_main(int argc, char **argv) { - int ret = SWUPD_OK; + enum swupd_code ret = SWUPD_OK; + int steps_in_search; int err = 0; - struct manifest *mom = NULL; int current_version; + struct manifest *mom = NULL; + + if (!parse_options(argc, argv)) { + print("\n"); + print_help(); + return SWUPD_INVALID_OPTION; + } + + ret = swupd_init(SWUPD_ALL); + if (ret != SWUPD_OK) { + error("Failed swupd initialization, exiting now\n"); + return ret; + } /* * Steps for search-file: - * - * 1) load_manifests + * 1) load_manifests (with --init finishes here) * 2) search_term */ - int steps_in_search = 2; - - if (!parse_options(argc, argv)) { - return SWUPD_INVALID_OPTION; - } if (init) { - /* if user selected the --init option the number of steps in the - * search process are just 2 */ steps_in_search = 1; + } else { + steps_in_search = 2; } progress_init_steps("search", steps_in_search); - ret = swupd_init(SWUPD_ALL); - if (ret != 0) { - error("Failed swupd initialization, exiting now\n"); - goto exit; - } - - progress_next_step("load_manifests", PROGRESS_BAR); current_version = get_current_version(globals.path_prefix); if (current_version < 0) { error("Unable to determine current OS version\n"); return SWUPD_CURRENT_VERSION_UNKNOWN; } + progress_next_step("load_manifests", PROGRESS_BAR); mom = load_mom(current_version, false, NULL); if (!mom) { error("Cannot load official manifest MoM for version %i\n", current_version); @@ -576,10 +577,8 @@ clean_exit: manifest_free(mom); list_free_list_and_data(manifest_list, manifest_free_data); list_free_list_and_data(bundle_size_cache, free); - swupd_deinit(); - -exit: progress_finish_steps(ret); + return ret; } diff --git a/src/update.c b/src/update.c index 321adf9e..09c20ca5 100644 --- a/src/update.c +++ b/src/update.c @@ -523,25 +523,28 @@ version_check: timelist_timer_stop(globals.global_times); // closing: Update loop /* Run any scripts that are needed to complete update */ - timelist_timer_start(globals.global_times, "Run post-update scripts"); - progress_next_step("run_postupdate_scripts", PROGRESS_UNDEFINED); + if (!download_only) { + timelist_timer_start(globals.global_times, "Run post-update scripts"); + progress_next_step("run_postupdate_scripts", PROGRESS_UNDEFINED); - /* Determine if another update is needed so the scripts block */ - int new_current_version = get_current_version(globals.path_prefix); - if (on_new_format() && (requested_version == -1 || (requested_version > new_current_version))) { - re_update = true; + /* Determine if another update is needed so the scripts block */ + int new_current_version = get_current_version(globals.path_prefix); + if (on_new_format() && (requested_version == -1 || (requested_version > new_current_version))) { + re_update = true; + } + scripts_run_post_update(re_update || globals.wait_for_scripts); + timelist_timer_stop(globals.global_times); // closing: Run post-update scripts } - scripts_run_post_update(re_update || globals.wait_for_scripts); /* Downloading all manifests to be used as search-file index */ if (update_search_file_index) { + timelist_timer_start(globals.global_times, "Updating search file index"); progress_next_step("update_search_index", PROGRESS_BAR); - info("Downloading all Clear Linux manifests\n"); + info("Downloading all Clear Linux manifests...\n"); mom_get_manifests_list(server_manifest, NULL, NULL); + timelist_timer_stop(globals.global_times); // closing: Updating search file index } - timelist_timer_stop(globals.global_times); // closing: Run post-update scripts - /* Create the state file that will tell swupd it's on a mix on future runs */ if (mix_exists && !system_on_mix()) { int fd = open(MIXED_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); @@ -732,11 +735,26 @@ static bool parse_options(int argc, char **argv) enum swupd_code update_main(int argc, char **argv) { - int ret = SWUPD_OK; + enum swupd_code ret = SWUPD_OK; + int steps_in_update; + + if (!parse_options(argc, argv)) { + print("\n"); + print_help(); + return SWUPD_INVALID_OPTION; + } + + ret = swupd_init(SWUPD_ALL); + if (ret != SWUPD_OK) { + error("Failed swupd initialization, exiting now\n"); + return ret; + } + + /* Update should always ignore optional bundles */ + globals.skip_optional_bundles = true; /* * Steps for update: - * * 1) load_manifests * 2) run_preupdate_scripts * 3) download_packs @@ -744,31 +762,23 @@ enum swupd_code update_main(int argc, char **argv) * 5) prepare_for_update * 6) validate_fullfiles * 7) download_fullfiles - * 8) extract_fullfiles + * 8) extract_fullfiles (finishes here on --download) * 9) update_files * 10) run_postupdate_scripts + * 11) update_search_index (only with --update-search-file-index) */ - int steps_in_update = 10; - - if (!parse_options(argc, argv)) { - print_help(); - return SWUPD_INVALID_OPTION; + if (cmd_line_status) { + steps_in_update = 0; + } else if (download_only) { + steps_in_update = 8; + } else { + steps_in_update = 10; } - if (update_search_file_index) { steps_in_update++; } - - /* Update should always ignore optional bundles */ - globals.skip_optional_bundles = true; progress_init_steps("update", steps_in_update); - ret = swupd_init(SWUPD_ALL); - if (ret != 0) { - error("Updater failed to initialize, exiting now\n"); - return ret; - } - if (cmd_line_status) { ret = check_update(); } else { @@ -776,7 +786,7 @@ enum swupd_code update_main(int argc, char **argv) } swupd_deinit(); - progress_finish_steps(ret); + return ret; } diff --git a/src/verify.c b/src/verify.c index 19143662..385b5bb5 100644 --- a/src/verify.c +++ b/src/verify.c @@ -263,6 +263,11 @@ static int get_required_files(struct manifest *official_manifest, struct list *s progress_next_step("check_files_hash", PROGRESS_BAR); print("\n"); if (check_files_hash(official_manifest->files)) { + /* we don't need to do these steps, we already have the files, + * just complete the steps */ + progress_next_step("validate_fullfiles", PROGRESS_BAR); + progress_next_step("download_fullfiles", PROGRESS_BAR); + progress_next_step("extract_fullfiles", PROGRESS_UNDEFINED); return 0; } @@ -1321,21 +1326,13 @@ clean_args_and_exit: enum swupd_code verify_main(int argc, char **argv) { - int ret = SWUPD_OK; - - verify_set_command_verify(true); // set to true so we know the "verify" command was used - - /* - * Steps for verify: - * - * 1) load_manifests - * 2) add_missing_files - * 3) fix_files - * 4) remove_extraneous_files - */ - const int steps_in_verify = 4; + enum swupd_code ret = SWUPD_OK; + const int steps_in_verify = 12; string_or_die(&cmdline_option_picky_tree, "/usr"); + /* set option needed so we know the legacy "verify" command was used */ + verify_set_command_verify(true); + if (!parse_options(argc, argv)) { print("\n"); print_help(); @@ -1343,14 +1340,34 @@ enum swupd_code verify_main(int argc, char **argv) } ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); free_string(&cmdline_option_picky_tree); return ret; } - /* diagnose */ + /* + * Steps for verify: + * 1) load_manifests + * 2) download_packs + * 3) extract_packs + * 4) check_files_hash + * 5) validate_fullfiles + * 6) download_fullfiles + * 7) extract_fullfiles + * 8) add_missing_files + * 9) fix_files + * 10) remove_extraneous_files + * 11) remove_extra_files + * 12) run_postupdate_scripts + * + * TODO(castulo): steps in verify have to many variables so it is + * being left as constant for know, this should not be much of a + * problem since it is a superseded command. + */ progress_init_steps("verify", steps_in_verify); + + /* diagnose */ ret = execute_verify(); free_string(&cmdline_option_picky_tree); @@ -1367,16 +1384,7 @@ enum swupd_code verify_main(int argc, char **argv) enum swupd_code diagnose_main(int argc, char **argv) { enum swupd_code ret = SWUPD_OK; - - /* - * Steps for diagnose: - * - * 1) load_manifests - * 2) add_missing_files - * 3) fix_files - * 4) remove_extraneous_files - */ - const int steps_in_diagnose = 4; + int steps_in_diagnose; string_or_die(&cmdline_option_picky_tree, "/usr"); if (!parse_options(argc, argv)) { @@ -1386,14 +1394,30 @@ enum swupd_code diagnose_main(int argc, char **argv) } ret = swupd_init(SWUPD_ALL); - if (ret != 0) { + if (ret != SWUPD_OK) { error("Failed swupd initialization, exiting now\n"); free_string(&cmdline_option_picky_tree); return ret; } - /* diagnose */ + /* + * Steps for diagnose: + * 1) load_manifests (with --extra-files-only jumps to step 5) + * 2) add_missing_files (finishes here on --quick) + * 3) fix_files + * 4) remove_extraneous_files + * 5) remove_extra_files (only with --picky or with --extra-files-only) + */ + if (cmdline_option_extra_files_only || cmdline_option_quick) { + steps_in_diagnose = 2; + } else if (cmdline_option_picky) { + steps_in_diagnose = 5; + } else { + steps_in_diagnose = 4; + } progress_init_steps("diagnose", steps_in_diagnose); + + /* diagnose */ ret = execute_verify(); free_string(&cmdline_option_picky_tree); diff --git a/test/functional/bundleadd/add-json.bats b/test/functional/bundleadd/add-json.bats index 95e150dc..52f307e4 100755 --- a/test/functional/bundleadd/add-json.bats +++ b/test/functional/bundleadd/add-json.bats @@ -26,8 +26,8 @@ test_setup() { expected_output1=$(cat <<-EOM [ { "type" : "start", "section" : "bundle-add" }, - { "type" : "info", "msg" : "Loading required manifests..." }, { "type" : "progress", "currentStep" : 1, "totalSteps" : 8, "stepCompletion" : -1, "stepDescription" : "load_manifests" }, + { "type" : "info", "msg" : "Loading required manifests..." }, { "type" : "progress", "currentStep" : 1, "totalSteps" : 8, "stepCompletion" : 100, "stepDescription" : "load_manifests" }, { "type" : "progress", "currentStep" : 2, "totalSteps" : 8, "stepCompletion" : 0, "stepDescription" : "download_packs" }, { "type" : "info", "msg" : "Downloading packs for:" }, diff --git a/test/functional/repair/repair-json.bats b/test/functional/repair/repair-json.bats index 0d2c3bb1..88cc65a6 100755 --- a/test/functional/repair/repair-json.bats +++ b/test/functional/repair/repair-json.bats @@ -24,118 +24,118 @@ test_setup() { expected_output1=$(cat <<-EOM [ { "type" : "start", "section" : "repair" }, - { "type" : "progress", "currentStep" : 1, "totalSteps" : 9, "stepCompletion" : -1, "stepDescription" : "load_manifests" }, + { "type" : "progress", "currentStep" : 1, "totalSteps" : 10, "stepCompletion" : -1, "stepDescription" : "load_manifests" }, { "type" : "info", "msg" : "Diagnosing version 10" }, { "type" : "info", "msg" : "Downloading missing manifests..." }, - { "type" : "progress", "currentStep" : 1, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "load_manifests" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 1, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "load_manifests" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "check_files_hash" }, { "type" : "info", "msg" : "Checking for corrupt files" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 5, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 11, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 17, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 23, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 29, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 35, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 41, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 47, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 52, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 58, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 64, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 70, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 76, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 82, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 88, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 94, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 2, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "check_files_hash" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 5, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 11, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 17, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 23, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 29, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 35, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 41, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 47, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 52, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 58, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 64, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 70, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 76, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 82, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 88, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 94, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 2, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "check_files_hash" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "validate_fullfiles" }, { "type" : "info", "msg" : "Validate downloaded files" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 5, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 11, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 17, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 23, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 29, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 35, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 41, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 47, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 52, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 58, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 64, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 70, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 76, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 82, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 88, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 94, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 3, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "validate_fullfiles" }, - { "type" : "progress", "currentStep" : 4, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "download_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 5, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 11, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 17, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 23, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 29, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 35, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 41, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 47, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 52, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 58, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 64, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 70, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 76, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 82, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 88, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 94, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 3, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "validate_fullfiles" }, + { "type" : "progress", "currentStep" : 4, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "download_fullfiles" }, { "type" : "info", "msg" : "Starting download of remaining update content. This may take a while..." }, EOM ) expected_output2=$(cat <<-EOM - { "type" : "progress", "currentStep" : 4, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "download_fullfiles" }, - { "type" : "progress", "currentStep" : 5, "totalSteps" : 9, "stepCompletion" : -1, "stepDescription" : "extract_fullfiles" }, - { "type" : "progress", "currentStep" : 5, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "extract_fullfiles" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 4, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "download_fullfiles" }, + { "type" : "progress", "currentStep" : 5, "totalSteps" : 10, "stepCompletion" : -1, "stepDescription" : "extract_fullfiles" }, + { "type" : "progress", "currentStep" : 5, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "extract_fullfiles" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "add_missing_files" }, { "type" : "info", "msg" : "Adding any missing files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 5, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 11, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 5, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 11, "stepDescription" : "add_missing_files" }, { "type" : "info", "msg" : " -> Missing file: $PATH_PREFIX/baz" }, { "type" : "info", "msg" : " -> fixed" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 17, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 23, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 29, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 17, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 23, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 29, "stepDescription" : "add_missing_files" }, { "type" : "info", "msg" : " -> Missing file: $PATH_PREFIX/foo/test-file1" }, { "type" : "info", "msg" : " -> fixed" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 35, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 41, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 47, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 52, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 58, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 64, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 70, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 76, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 82, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 88, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 94, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 6, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "add_missing_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 35, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 41, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 47, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 52, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 58, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 64, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 70, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 76, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 82, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 88, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 94, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 6, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "add_missing_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "fix_files" }, { "type" : "info", "msg" : "Repairing corrupt files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 5, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 11, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 17, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 23, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 29, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 35, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 41, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 47, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 52, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 58, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 64, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 70, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 76, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 82, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 88, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 94, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 7, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "fix_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 5, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 11, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 17, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 23, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 29, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 35, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 41, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 47, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 52, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 58, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 64, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 70, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 76, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 82, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 88, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 94, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 7, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "fix_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "remove_extraneous_files" }, { "type" : "info", "msg" : "Removing extraneous files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 5, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 11, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 17, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 23, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 29, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 35, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 41, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 47, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 52, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 58, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 64, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 70, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 76, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 82, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 88, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 94, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 8, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "remove_extraneous_files" }, - { "type" : "progress", "currentStep" : 9, "totalSteps" : 9, "stepCompletion" : 0, "stepDescription" : "remove_extra_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 5, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 11, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 17, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 23, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 29, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 35, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 41, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 47, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 52, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 58, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 64, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 70, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 76, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 82, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 88, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 94, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 8, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "remove_extraneous_files" }, + { "type" : "progress", "currentStep" : 9, "totalSteps" : 10, "stepCompletion" : 0, "stepDescription" : "remove_extra_files" }, { "type" : "info", "msg" : "Removing extra files under $PATH_PREFIX/usr" }, { "type" : "info", "msg" : " -> Extra file: $PATH_PREFIX/usr/share/defaults/swupd/versionurl" }, { "type" : "info", "msg" : " -> deleted" }, @@ -150,10 +150,12 @@ test_setup() { { "type" : "info", "msg" : " 3 files found which should be deleted" }, { "type" : "info", "msg" : " 3 of 3 files were deleted" }, { "type" : "info", "msg" : " 0 of 3 files were not deleted" }, + { "type" : "progress", "currentStep" : 9, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "remove_extra_files" }, + { "type" : "progress", "currentStep" : 10, "totalSteps" : 10, "stepCompletion" : -1, "stepDescription" : "run_postupdate_scripts" }, { "type" : "info", "msg" : "Calling post-update helper scripts" }, { "type" : "warning", "msg" : "helper script ($PATH_PREFIX//usr/bin/clr-boot-manager) not found, it will be skipped" }, { "type" : "info", "msg" : " Repair successful" }, - { "type" : "progress", "currentStep" : 9, "totalSteps" : 9, "stepCompletion" : 100, "stepDescription" : "remove_extra_files" }, + { "type" : "progress", "currentStep" : 10, "totalSteps" : 10, "stepCompletion" : 100, "stepDescription" : "run_postupdate_scripts" }, { "type" : "end", "section" : "repair", "status" : 0 } ] EOM diff --git a/test/functional/update/update-download.bats b/test/functional/update/update-download.bats index a89f7b42..6478d9d7 100755 --- a/test/functional/update/update-download.bats +++ b/test/functional/update/update-download.bats @@ -30,7 +30,6 @@ test_setup() { deleted files : 0 Validate downloaded files No extra files need to be downloaded - Calling post-update helper scripts EOM ) assert_is_output "$expected_output" diff --git a/test/functional/update/update-search-file-index.bats b/test/functional/update/update-search-file-index.bats index 309ee4d3..61116769 100755 --- a/test/functional/update/update-search-file-index.bats +++ b/test/functional/update/update-search-file-index.bats @@ -34,7 +34,7 @@ test_setup() { Installing files... Update was applied Calling post-update helper scripts - Downloading all Clear Linux manifests + Downloading all Clear Linux manifests... Update successful - System updated from version 10 to version 100 EOM )