refactor(tvix/eval): rewrite xml emitter to be simple-stupid

In order to be compatible with the nix XML generator, it’s easier to
generate the XML directly, instead of going through a library which we
have to bend to do what we need.

Removes dependency on `xml-rs`, which came with a full XML parser that
we didn’t use. Only takes a tiny bit of code for the XML escaping,
somewhat simplified.

I add a little escaping value, to make sure we have the same behaviour
as nix proper.

Interestingly enough, we never need to escape XML attribute names,
because the `builtins.toXML` format encodes user-defined values as
attribute keys only. So we only escape attribute values.

Fixes: https://b.tvl.fyi/issues/399
Change-Id: If4d407d324864b3bb9aa3160e2ec6889f7727127
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11697
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-05-20 15:50:33 +02:00 committed by clbot
parent e7be342256
commit 5b2ba0efa1
9 changed files with 205 additions and 89 deletions

7
tvix/Cargo.lock generated
View file

@ -4167,7 +4167,6 @@ dependencies = [
"test-strategy",
"toml",
"tvix-eval-builtin-macros",
"xml-rs",
]
[[package]]
@ -4844,12 +4843,6 @@ dependencies = [
"rustix",
]
[[package]]
name = "xml-rs"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
[[package]]
name = "xz2"
version = "0.1.7"