-
Notifications
You must be signed in to change notification settings - Fork 20
Generate contents.xml flash files for Axiom #142
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
I'm struggling to review this parsing. Could I suggest using
getopt(1)to parse these lines instead? It would less error-prone to find edge case bugs, and I think (but am not certain) it'd look cleaner here then, too.It might also be worth considering if you've stretched shell a little further that it can sensibly go and switch to Python here instead. The task is nicely abstracted here already I think - something like
adjust_partitions_conf.pymight work well.Provided we're testing the various result for various edge cases (I think we are?), then I think it's OK to leave it as-is if you don't think it's worth it though.
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.
Reading you, I first thought that getopt would be a good idea to simplify this, but trying to use it I realized that since I have to reconstruct the line in some cases (when changing filename), it gets a bit ugly and I think sed does a better job.
Here's what I could do to make parsing (by other humans :)) easier:
name=$(echo "$line" | grep -oP '(?<=--name=)[^ ]+')What do you think?
I agree it's getting a bit of a stretch in shell, but I'm also have a bias to keep the logic in a single place without jumping between files as when branching to external scripts. Perhaps we can indeed address this directly in ptool, or in debos actions?
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.
Fair enough! I appreciate there are trade-offs.
I haven't spent the time to understand this aspect of ptool and how we're using it in detail. It does seem odd to have to parse and transform something in the form of ptool's input, but from an example file provided upstream, and this suggests that we have a use case that upstream ptool could implement a better interface there for us. That sounds like a upstream feature request to me, and in the meantime I think what you have is fine then. Maybe it's worth leaving an upstream issue open.
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.
I've added comments with sample inputs and more detailed steps