depot_query: refined <runtime> node structure

This patch introduces the subnodes <provides>, <requires>, and
<content> to the <runtime> node. All <rom> sessions that are
expected from the depot appear within the <content> node, which
sets them nicely apart from <rom> sessions that may be required
as runtime arguments.

Note that the <requires> and <provides> nodes do not appear in the
patch because the existing depot_deploy tool does not interpret this
information (the pkg/test-fs_report runtime does not provide any
service, and the timer session is provided as a common route).
This commit is contained in:
Norman Feske 2018-01-29 11:46:52 +01:00
parent a57dd46aff
commit 3149506963
2 changed files with 38 additions and 34 deletions

View File

@ -380,42 +380,44 @@ void Depot_query::Main::_query_blueprint(Directory::Path const &pkg_path, Xml_ge
Xml_node env_xml = _config.xml().has_sub_node("env")
? _config.xml().sub_node("env") : "<env/>";
node.for_each_sub_node([&] (Xml_node node) {
node.for_each_sub_node("content", [&] (Xml_node content) {
content.for_each_sub_node([&] (Xml_node node) {
/* skip non-rom nodes */
if (!node.has_type("rom"))
return;
/* skip non-rom nodes */
if (!node.has_type("rom"))
return;
Rom_label const label = node.attribute_value("label", Rom_label());
Rom_label const label = node.attribute_value("label", Rom_label());
/* skip ROM that is provided by the environment */
bool provided_by_env = false;
env_xml.for_each_sub_node("rom", [&] (Xml_node node) {
if (node.attribute_value("label", Rom_label()) == label)
provided_by_env = true; });
/* skip ROM that is provided by the environment */
bool provided_by_env = false;
env_xml.for_each_sub_node("rom", [&] (Xml_node node) {
if (node.attribute_value("label", Rom_label()) == label)
provided_by_env = true; });
if (provided_by_env) {
xml.node("rom", [&] () {
xml.attribute("label", label);
xml.attribute("env", "yes");
});
return;
}
if (provided_by_env) {
xml.node("rom", [&] () {
xml.attribute("label", label);
xml.attribute("env", "yes");
});
return;
}
Archive::Path const rom_path =
_find_rom_in_pkg(pkg_path, label, Recursion_limit{8});
Archive::Path const rom_path =
_find_rom_in_pkg(pkg_path, label, Recursion_limit{8});
if (rom_path.valid()) {
xml.node("rom", [&] () {
xml.attribute("label", label);
xml.attribute("path", rom_path);
});
if (rom_path.valid()) {
xml.node("rom", [&] () {
xml.attribute("label", label);
xml.attribute("path", rom_path);
});
} else {
} else {
xml.node("missing_rom", [&] () {
xml.attribute("label", label); });
}
xml.node("missing_rom", [&] () {
xml.attribute("label", label); });
}
});
});
String<160> comment("\n\n<!-- content of '", pkg_path, "/runtime' -->\n");

View File

@ -1,12 +1,14 @@
<runtime ram="32M" caps="1000" binary="init">
<timer/>
<requires> <timer/> </requires>
<rom label="ld.lib.so"/>
<rom label="ram_fs"/>
<rom label="fs_report"/>
<rom label="fs_rom"/>
<rom label="test-fs_report"/>
<content>
<rom label="ld.lib.so"/>
<rom label="ram_fs"/>
<rom label="fs_report"/>
<rom label="fs_rom"/>
<rom label="test-fs_report"/>
</content>
<config>
<parent-provides>