From d3adfeb0acea3c81e18b809d422f441d9b69fc8e Mon Sep 17 00:00:00 2001 From: Davide Gardenal <davide.gardenal@huawei.com> Date: Mon, 1 Aug 2022 15:49:53 +0200 Subject: [PATCH] upgrade_oniro: add function description Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> --- scripts/upgrade_oniro/upgrade_oniro.py | 39 ++++++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/scripts/upgrade_oniro/upgrade_oniro.py b/scripts/upgrade_oniro/upgrade_oniro.py index 67503bdc..0b9215c6 100755 --- a/scripts/upgrade_oniro/upgrade_oniro.py +++ b/scripts/upgrade_oniro/upgrade_oniro.py @@ -149,13 +149,24 @@ def perform_pre_upgrade_checks(): return def backup_oniro(): - # This will back up: - # - All layers specified in the Oniro Manifest - # - .repo folder - # - If build_directory is not empty, backup its content excluding tmp* and tmp-newlib* directories - # - all the folders starting with "meta-" - # - if the backup command is used you can specify custom folders and they will be backed up - # TODO add function description + """ + Create a backup of Oniro. + + This function creates a backup of Oniro containing the following files: + - all the layers specified in the Oniro Manifest + - .repo folder + - `build_directory` if it exists, excluding tmp sub-folders + - all the folders starting with "meta-" + - all the folders / files in `extra_folders` + + The backup file will contain also a text file with a list of all the + folders that have been saved, this will be used to delete them + in the `restore_oniro` function. + + Returns: + None. Side effects the creation of a backup in './upgrade_oniro_backups/'. + """ + from upgrade_oniro_utils import get_manifest_projects from datetime import datetime @@ -207,9 +218,19 @@ def backup_oniro(): return def restore_oniro(): - # TODO add function description + """ + Restore a backup of Oniro. + + This function will restore a backup of Oniro, to do so it will delete + all the folders (and their content) from repo's dir and substitute them with + the copy of the backup. + The backup must be created with `backup_oniro`. + + Returns: + None. Side effects Oniro's backup restore + """ # TODO add an exception handling if the metadata file is not found - # TODO if something created some files / directories we are not able to + # TODO if something created some files / directories we are not able to # delete those and we may end up with a inconsistent state from upgrade_oniro_utils import find_latest_backup -- GitLab