feat: dynamically solve all requirements.mod files#148
Conversation
Signed-off-by: Eike Waldt <waldt@b1-systems.de> On-behalf-of: SAP <eike.waldt@sap.com>
b4a01c0 to
eb2637d
Compare
nkraetzschmar
left a comment
There was a problem hiding this comment.
Either we need to adjust the way the requirements.mod files are evaluated to ensure that they are just key=value pairs, or we need a better way to dynamically determine the set of keys.
One idea I'd have: introduce a requirements_keys array and let the mod scripts dynamically add/remove keys there and then use that for the final output. So have something like
requirements_keys=(arch uefi secureboot tpm2)
# source the requirements.mod files here which may add keys
for key in "${requirements_keys[@]}"; do
echo "$key=${!key}"
done| # Scan all requirements.mod files to find all possible modifiers and set defaults | ||
| for req_mod in "$features_dir"/*/requirements.mod; do | ||
| [ -e "$req_mod" ] || continue | ||
| while IFS='=' read -r key _; do |
There was a problem hiding this comment.
This makes the assumption that all requirements.mod files are of a plain key=value format. But since they get sourced there could be more complex setups, so this scanning for possible modifiers is fragile if we keep the way the requirements.mod files as is.
|
@nkraetzschmar good catch...
I like this being potentially dynamic for future use cases.
I like this idea but would keep the initial array minimal and only include what is not set in features, e.g. non-bool requirements_keys=(arch)Each feature's requirements_keys+=(uefi)
uefi=true |
|
@nkraetzschmar Please re-review. |
This is a companion PR to gardenlinux/builder#148 Signed-off-by: Eike Waldt <waldt@b1-systems.de> On-behalf-of: SAP <eike.waldt@sap.com>
|
gardenlinux/gardenlinux#4912 is a companion PR that extends the |
Use requirements_keys array to discover existing modifiers. Signed-off-by: Eike Waldt <waldt@b1-systems.de> On-behalf-of: SAP <eike.waldt@sap.com>
64264f6 to
17b7dc3
Compare
What this PR does / why we need it:
feat: dynamically solve all requirements.mod files
This enables adding new variables to
requirements.modfiles in any feature without updating the builder.