boot-qemu.py: Fix get_linux_ver_code() when CONFIG_LOCALVERSION_AUTO is not set#74
Merged
nathanchance merged 1 commit intoOct 5, 2022
Conversation
a90b5ae to
2be5b3e
Compare
msfjarvis
approved these changes
Oct 4, 2022
…is not set
When CONFIG_LOCALVERSION_AUTO is not set, the Linux version string may be
"Linux version x.y.z+", which is not handled gracefully by the script:
Traceback (most recent call last):
File ".../boot-utils/boot-qemu.py", line 726, in <module>
cfg = get_qemu_args(cfg)
File ".../boot-utils/boot-qemu.py", line 452, in get_qemu_args
linux_ver_code = get_linux_ver_code(gzip_kernel_cmd)
File ".../boot-utils/boot-qemu.py", line 339, in get_linux_ver_code
return create_version_code(linux_version)
File ".../boot-utils/boot-qemu.py", line 263, in create_version_code
major, minor, patch = [int(version[i]) for i in (0, 1, 2)]
File ".../boot-utils/boot-qemu.py", line 263, in <listcomp>
major, minor, patch = [int(version[i]) for i in (0, 1, 2)]
ValueError: invalid literal for int() with base 10: '0+'
Use re.search() for a more specific match, which ends up simplifying the
logic to the point of not needing a comment.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
f293df5 to
604db5b
Compare
nickdesaulniers
approved these changes
Oct 5, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When CONFIG_LOCALVERSION_AUTO is not set, the Linux version string may be
"Linux version x.y.z+", which is not handled gracefully by the script:
Use
re.search()for a more specific match, which ends up simplifying thelogic to the point of not needing a comment.