Skip to content
Snippets Groups Projects
Verified Commit 87c0fe6d authored by Davide Gardenal's avatar Davide Gardenal
Browse files

upgrade_oniro.py: add argument parsing


Signed-off-by: Davide Gardenal's avatarDavide Gardenal <davide.gardenal@huawei.com>
parent 2731b75d
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
# 3.2. Check if all the layers in the sample of Oniro are checked out in the correct state. # 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.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 # 3.5. Flag all the .bbappends for update
# 3.6 Check if the flavor is correct if the conf dir is specified
# #
# 4. Pre-upgrade backup to ensure that if something goes wrong we can restore a good state of the build. # 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. # Option to also backup the build (tmp dir excluded) if the build directory is not empty.
...@@ -36,7 +37,38 @@ ...@@ -36,7 +37,38 @@
# 5.6. Build the target # 5.6. Build the target
# 6. In case of error let the user know that they can restore the old version using this tool # 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, ...) # 7. In case of a successful upgrade print/dump some additional information about the upgrade (CVE diff, buildhistory, ...)
#
# TODO think about a way to let the user know BEFORE the upgrade what changed so (s)he can choose. (maybe you can use git diff --compact-summary)
import argparse
import pathlib
script_description = "[WIP] A tool to upgrade to a newer version of Oniro"
def arg_parsing():
parser = argparse.ArgumentParser(description=script_description)
# TODO a choice could be added in the version by checking all the tags of Oniro
parser.add_argument("-tv", "--target-version", type=str, required=True,
help="Specify the target version of Oniro you want to upgrade to")
parser.add_argument("-d", "--build-directory", type=pathlib.Path, required=True,
help="Path to the build directory you want to use (can be non-existent)")
# TODO a choice could be added in the machine
parser.add_argument("-m", "--machine", type=str, default="qemux86-64",
help="The target machine for the Oniro build. (qemux86-64 by default)")
# TODO the option gathering can be automated by looking at oniro/flavours/
parser.add_argument("-f", "--flavour", type=str, choices=["linux", "zephyr", "freertos"], default="linux",
help="The flavor for the Oniro build. (linux by default)")
# TODO the option gathering can be automated by looking at oniro/meta-oniro-core/recipes-core/images
parser.add_argument("-i", "--image", type=str, default="oniro-image-base",
choices=["oniro-image-base", "oniro-image-base-tests", "oniro-image-extra", "oniro-image-extra-tests"],
help = "The image that will be built to check if the upgrade is successful (oniro-image-base by default)")
parser.add_argument("-c", "--conf-directory", type=pathlib.Path,
help="Path to the config directory you want to use. If omitted the default configs will be use.")
return parser.parse_args()
if __name__ == "__main__": if __name__ == "__main__":
print("test") print(arg_parsing())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment