Redesign of knowledge about generated files #215
Labels
No labels
approved
bug
dependencies
DO-NOT-MERGE
enhancement
good-first-issue
help-wanted
historical-reviewed
historical-reviewing
needs-adoption
needs-ci
needs-design-approval
needs-info
needs-preceding-pr
needs-review
needs-reviewer
needs-work
priority-high
priority-low
priority-medium
priority-scheduled
priority-very-high
single-reviewer
size-l
size-m
size-s
size-xs
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-Mbed-TLS/mbedtls-framework#215
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There are several problems with
make_generated_files.pyas it currently stands. Some of these problems also affect the legacymake generated_filesin mbedtls. The goal of this issue is to come up with a plan to fix these problems. At this point, I don't know if there should be a series of incremental improvements, or a complete redesign. The problems withmake generated_filesmay go away naturally when we remove that.A central theme is that everything works in a static universe, but changes such as adding a new generation scripts are very difficult and time-consuming. The first time this happened after
make_generated_files.pywas in place is withscripts/generate_config_checks.py, which required a lot of steps. For the new crypto script:Some identified design problems:
make generated_filesin Mbed TLS has to know all the generation scripts in TF-PSA-Crypto. So when adding a new script in crypto, you need to first create it but not use its result, then teach mbedtls about the new script, and then you can use it in crypto.make_generated_files.pyin the framework knows all the generation scripts. So to create a new script, you first have to have it but not use it in the consuming branch, then register it in the framework, and then you can start using it. And even so, I'm not 100% sure that this works for crypto depending on when mbedtls updates its submodules. Another approach that does work is registering the new script inmake_generated_files.pybut conditionally on the script's existence, as done ingithub.com/Mbed-TLS/mbedtls-framework@5b6c405e6f.--listoption that prints the output file locations relative to the project root when called from the project root. An absolute path doesn't work. This is reasonable but undocumented, andmake_generated_files.py --check --root DIRwill look for files in the wrong place if--listdoes something different.build_treemodule,guess_project_root()returns an absolute path. This is the natural function to use, but it doesn't work for the needs ofgenerate_xxx.py --list, sincemake_generated_files.pyinsists on a relative path.make_generated_files.pydoesn't enforce that a way exist, but will look for files in the wrong place if this way is missing.make_generated_files.py --checktemporarily overwrites the existing files. It's weird that a “check” facility disrupts what it checks. If we felt that we had a reliable way to control the file locations, we could instead do the generation in an alternative location, and compare the results.make_generated_files.py --checkstops as soon as something is wrong (it only knows to exit with an exception). It should record common errors (missing file, failure of a generation script, unexpected content) but keep going, and finally exit with 1 if there was an error.This list may be incomplete. You can help by expanding it.