-
Notifications
You must be signed in to change notification settings - Fork 349
build: Add commandline versioning #7930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ | |
| west_top = pathlib.Path(SOF_TOP, "..").resolve() | ||
|
|
||
| sof_fw_version = None | ||
| sof_build_version = None | ||
|
|
||
| if py_platform.system() == "Windows": | ||
| xtensa_tools_version_postfix = "-win32" | ||
|
|
@@ -212,6 +213,11 @@ def parse_args(): | |
| default=[], help="Paths to overlays") | ||
| parser.add_argument("-p", "--pristine", required=False, action="store_true", | ||
| help="Perform pristine build removing build directory.") | ||
| parser.add_argument("-b", "--build_version", required=False, | ||
| help="Overrides cmake provided build version") | ||
| parser.add_argument("-f", "--fw_version", required=False, | ||
| help="Overrides cmake provided fw version") | ||
|
|
||
| parser.add_argument("-u", "--update", required=False, action="store_true", | ||
| help="""Runs west update command - clones SOF dependencies. Downloads next to this sof clone a new Zephyr | ||
| project with its required dependencies. Creates a modules/audio/sof symbolic link pointing | ||
|
|
@@ -256,6 +262,15 @@ def parse_args(): | |
| if args.all: | ||
| args.platforms = platform_names | ||
|
|
||
| global sof_fw_version | ||
| global sof_build_version | ||
|
|
||
| if args.fw_version is not None: | ||
| sof_fw_version = args.fw_version | ||
|
|
||
| if args.build_version is not None: | ||
| sof_build_version = args.build_version | ||
|
|
||
| # print help message if no arguments provided | ||
| if len(sys.argv) == 1: | ||
| parser.print_help() | ||
|
|
@@ -624,7 +639,12 @@ def rimage_options(platform_dict): | |
| # FIXME: drop this line once the following test is fixed | ||
| # tests/avs/fw_00_basic/test_01_load_fw_extended.py::TestLoadFwExtended::():: | ||
| # test_00_01_load_fw_and_check_version | ||
| opts.append(("-b", "1")) | ||
|
|
||
| global sof_build_version | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing as above, just use |
||
| if sof_build_version is not None: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid double negations if sof_build_version is None:
opts.append(("-b", "1"))
else:
... |
||
| opts.append(("-b", sof_build_version)) | ||
| else: | ||
| opts.append(("-b", "1")) | ||
|
|
||
| if args.ipc == "IPC4": | ||
| rimage_desc = platform_dict["IPC4_RIMAGE_DESC"] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't define new globals, just use
args.sof_fw_versiondirectly inget_sof_version()and keep all thesof_fw_versionrelated code in a single place.We already use
argsas a global all over the place, as long as it's keep immutable it's fine.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a difference between sof_fw_version and sof_build_version when passing it to rimage so i would have to do string operations to get out the build number. I think global is less bothersome.
Or did I misunderstand what is your intent here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm got it