diff --git a/scripts/upgrade_oniro.py b/scripts/upgrade_oniro.py new file mode 100644 index 0000000000000000000000000000000000000000..492b60f494789b0bc6519b2a39d95edf5ab5436c --- /dev/null +++ b/scripts/upgrade_oniro.py @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# A tool to upgrade to a newer version of Oniro + +# Steps to upgrade: +# 1. Get the input from the user: +# 1.1. Target version +# 1.2. Build directory, can be empty or not and this will define some additional checks to perform +# 1.3. Machine and target to build, in order to test the upgraded build we need to know these things +# 1.4. Optional: Conf directory path, this can be specified in order to use a specific config directory. +# In case we have a clean build directory and this is not specified the default config will be used. +# 1.5. Optional: Flavour. In case the conf directory is not specified and the build directory is empty it becomes mandatory +# 1.6. Some other stuff to control the output of the tool (TBD) +# +# 2. Check for tool updates. If the newest version of Oniro has a new version of this script it should be upgraded before +# Oniro's upgrade, then it should be run instead of the old one. +# +# 3. Pre-upgrade checks: +# 3.1. Check if "Target version" is newer than the current +# 3.2. Check if all the layers in the sample of Oniro are checked out in the correct state. +# 3.4. If the build directory is non-empty check if bblayers.conf have some additional layers, if positive flag them for the config update. +# 3.5. Flag all the .bbappends for update +# +# 4. Pre-upgrade backup to ensure that if something goes wrong we can restore a good state of the build. +# Option to also backup the build (tmp dir excluded) if the build directory is not empty. +# +# 5. Update: +# 5.1. Sync the repos +# 5.2. Update the .bbappends files (needs user confirmation) if needed +# 5.2. Run the script to init the environment +# 5.3. If specified copy the conf directory +# 5.4. Update the configs +# 5.5. If present delete the tmp directory +# 5.6. Build the target +# 6. In case of error let the user know that they can restore the old version using this tool +# 7. In case of a successful upgrade print/dump some additional information about the upgrade (CVE diff, buildhistory, ...) + + +if __name__ == "__main__": + print("test")