From 16b863fc6ebcd91d1391c4796795e10bb417f66f Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Fri, 14 Jun 2024 20:38:09 +0200 Subject: [PATCH] tool/run: use xmlcatalog for xsd file paths With libxml2 >= 2.13, the `-path` argument can no longer be used for setting search paths for xsd files. Instead, we use an XML catalog to replace genode:// URIs with absolute paths. Fixes #5248 --- repos/dde_linux/src/app/wireguard/config.xsd | 4 ++-- repos/gems/src/app/depot_autopilot/config.xsd | 4 ++-- repos/gems/src/app/trace_recorder/config.xsd | 4 ++-- repos/libports/src/app/sntp_client/config.xsd | 6 ++--- repos/os/src/app/ping/config.xsd | 6 ++--- repos/os/src/app/trace_logger/config.xsd | 4 ++-- repos/os/src/driver/nic/virtio/config.xsd | 6 ++--- repos/os/src/init/config.xsd | 2 +- repos/os/src/server/cpu_balancer/config.xsd | 2 +- repos/os/src/server/nic_bridge/config.xsd | 4 ++-- repos/os/src/server/nic_dump/config.xsd | 2 +- repos/os/src/server/nic_router/config.xsd | 6 ++--- repos/os/src/server/nic_uplink/config.xsd | 2 +- repos/os/src/test/net_flood/config.xsd | 4 ++-- repos/os/src/test/nic_stress/config.xsd | 2 +- tool/run/run | 23 ++++++++++++------- 16 files changed, 44 insertions(+), 37 deletions(-) diff --git a/repos/dde_linux/src/app/wireguard/config.xsd b/repos/dde_linux/src/app/wireguard/config.xsd index b2a5149257..2492b9d6c7 100644 --- a/repos/dde_linux/src/app/wireguard/config.xsd +++ b/repos/dde_linux/src/app/wireguard/config.xsd @@ -1,8 +1,8 @@ - - + + diff --git a/repos/gems/src/app/depot_autopilot/config.xsd b/repos/gems/src/app/depot_autopilot/config.xsd index c173042808..64afc5379a 100644 --- a/repos/gems/src/app/depot_autopilot/config.xsd +++ b/repos/gems/src/app/depot_autopilot/config.xsd @@ -1,8 +1,8 @@ - - + + diff --git a/repos/gems/src/app/trace_recorder/config.xsd b/repos/gems/src/app/trace_recorder/config.xsd index 737dc5bac3..d699b81cb7 100644 --- a/repos/gems/src/app/trace_recorder/config.xsd +++ b/repos/gems/src/app/trace_recorder/config.xsd @@ -1,8 +1,8 @@ - - + + diff --git a/repos/libports/src/app/sntp_client/config.xsd b/repos/libports/src/app/sntp_client/config.xsd index ef1e5216a9..4e2a15f9e9 100644 --- a/repos/libports/src/app/sntp_client/config.xsd +++ b/repos/libports/src/app/sntp_client/config.xsd @@ -1,9 +1,9 @@ - - - + + + diff --git a/repos/os/src/app/ping/config.xsd b/repos/os/src/app/ping/config.xsd index 5777f6fa5c..534696c3cc 100644 --- a/repos/os/src/app/ping/config.xsd +++ b/repos/os/src/app/ping/config.xsd @@ -1,9 +1,9 @@ - - - + + + diff --git a/repos/os/src/app/trace_logger/config.xsd b/repos/os/src/app/trace_logger/config.xsd index 6bf32caa93..f0268fd50b 100644 --- a/repos/os/src/app/trace_logger/config.xsd +++ b/repos/os/src/app/trace_logger/config.xsd @@ -1,8 +1,8 @@ - - + + diff --git a/repos/os/src/driver/nic/virtio/config.xsd b/repos/os/src/driver/nic/virtio/config.xsd index 9deae92320..d5dafd07a0 100644 --- a/repos/os/src/driver/nic/virtio/config.xsd +++ b/repos/os/src/driver/nic/virtio/config.xsd @@ -1,9 +1,9 @@ - - - + + + diff --git a/repos/os/src/init/config.xsd b/repos/os/src/init/config.xsd index 727b5b91e6..015e2d6f8f 100644 --- a/repos/os/src/init/config.xsd +++ b/repos/os/src/init/config.xsd @@ -1,7 +1,7 @@ - + diff --git a/repos/os/src/server/cpu_balancer/config.xsd b/repos/os/src/server/cpu_balancer/config.xsd index 65e2f02154..842767832b 100644 --- a/repos/os/src/server/cpu_balancer/config.xsd +++ b/repos/os/src/server/cpu_balancer/config.xsd @@ -1,7 +1,7 @@ - + diff --git a/repos/os/src/server/nic_bridge/config.xsd b/repos/os/src/server/nic_bridge/config.xsd index e4c84fc295..8c054939d9 100644 --- a/repos/os/src/server/nic_bridge/config.xsd +++ b/repos/os/src/server/nic_bridge/config.xsd @@ -1,8 +1,8 @@ - - + + diff --git a/repos/os/src/server/nic_dump/config.xsd b/repos/os/src/server/nic_dump/config.xsd index dbfc9083c7..0b08c1ebb9 100644 --- a/repos/os/src/server/nic_dump/config.xsd +++ b/repos/os/src/server/nic_dump/config.xsd @@ -1,7 +1,7 @@ - + diff --git a/repos/os/src/server/nic_router/config.xsd b/repos/os/src/server/nic_router/config.xsd index 5f46dcff27..d065e5c9c9 100644 --- a/repos/os/src/server/nic_router/config.xsd +++ b/repos/os/src/server/nic_router/config.xsd @@ -1,9 +1,9 @@ - - - + + + diff --git a/repos/os/src/server/nic_uplink/config.xsd b/repos/os/src/server/nic_uplink/config.xsd index aef8844770..96951b6284 100644 --- a/repos/os/src/server/nic_uplink/config.xsd +++ b/repos/os/src/server/nic_uplink/config.xsd @@ -1,7 +1,7 @@ - + diff --git a/repos/os/src/test/net_flood/config.xsd b/repos/os/src/test/net_flood/config.xsd index 95f4b13907..4de9bffc96 100644 --- a/repos/os/src/test/net_flood/config.xsd +++ b/repos/os/src/test/net_flood/config.xsd @@ -1,8 +1,8 @@ - - + + diff --git a/repos/os/src/test/nic_stress/config.xsd b/repos/os/src/test/nic_stress/config.xsd index 4a73bf1286..2c6232053d 100644 --- a/repos/os/src/test/nic_stress/config.xsd +++ b/repos/os/src/test/nic_stress/config.xsd @@ -1,7 +1,7 @@ - + diff --git a/tool/run/run b/tool/run/run index 8bab1129d1..cd94486bd7 100755 --- a/tool/run/run +++ b/tool/run/run @@ -142,7 +142,7 @@ proc check_xml_syntax {xml_file} { # configurations of children of the component # \param nesting_level level of recursive calls of this procedure # -proc check_config {bin xml_file xsd_file label avail_xsd_files xsd_inc nesting_level} { +proc check_config {bin xml_file xsd_file label avail_xsd_files nesting_level} { # check prerequisites if this is not a recursive call if {$nesting_level == 0} { @@ -157,7 +157,7 @@ proc check_config {bin xml_file xsd_file label avail_xsd_files xsd_inc nesting_l # check the given component configuration itself puts " CHECK $label" - if {[catch {exec xmllint --noout --path $xsd_inc -schema $xsd_file $xml_file} result]} { + if {[catch {exec xmllint --noout -schema $xsd_file $xml_file} result]} { if {$result != "$xml_file validates"} { @@ -226,7 +226,7 @@ proc check_config {bin xml_file xsd_file label avail_xsd_files xsd_inc nesting_l # call this procedure again on the child config file set child_label "$label -> $child_name" check_config $child_bin $child_xml_file $child_xsd_file \ - $child_label $avail_xsd_files $xsd_inc \ + $child_label $avail_xsd_files \ [expr $nesting_level+1] # clean up @@ -317,16 +317,23 @@ proc build_boot_image { binaries } { set init_xsd_file $xsd_file } } - # determine include directories that can be used by the XSD files + # create catalog file + set catalog [file join [run_dir] genode catalog.xml] + catch { exec xmlcatalog --noout --create $catalog } + + # determine paths of additional XSD files and add to catalog global repositories; - set xsd_inc "" foreach repo $repositories { - if {[file exists $repo/xsd]} { - append xsd_inc "$repo/xsd " } + foreach xsd_path [glob -nocomplain -type f $repo/xsd/*.xsd] { + set xsd_name [file tail $xsd_path] + catch { exec xmlcatalog --noout --add "uri" "genode://$xsd_name" "$xsd_path" $catalog } + } } + set ::env(XML_CATALOG_FILES) $catalog + # check configurations of init and its children puts "checking configuration syntax" - check_config init [run_dir]/genode/config $init_xsd_file init $xsd_files $xsd_inc 0 + check_config init [run_dir]/genode/config $init_xsd_file init $xsd_files 0 run_boot_dir $binaries }