osbuild / otk

A proof of concept for a new `osbuild-mpp`.
https://osbuild.org/
Apache License 2.0
3 stars 9 forks source link

Reconsider variable name format restrictions #213

Open achilleas-k opened 4 weeks ago

achilleas-k commented 4 weeks ago

/usr/bin/cp is an invalid variable name which means we can't have dictionaries under otk.define with keys that include those characters. It also means we can't have dictionaries with keys that start with numbers.

This might become a problem with content hashes used as object keys in defines, which we might need to use at some point.

_Originally posted by @achilleas-k in https://github.com/osbuild/otk/pull/210#discussion_r1771193272_

supakeen commented 4 weeks ago

The same goes with (some) package names as we chatted about a tiny bit in #205.

mvo5 commented 3 weeks ago

It seems to me if we want to open this up we probably need to design this a bit more to ensure we are happy with the result.

As a quick strawman: IMHO we should still restrict vars like they are right now, I am worried about confusion from content like ${a-b} if we are too free with the variable names. However we could reconsider the dot notation and allow something like ${a["b-c"]} or ${selinux_labels["/usr/bin/foo"]} or ${packages.versions["my-kernel"]} or ${package.versions[${modifications.kernel}]} - it feels nice but it will be extra work implementing this carefully (and thinking/ensuring we design something that is not painting us into a corner down the line).