mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
depot_deploy: graceful handling of missing content
This patch improves the error handling for the case where the depot lacks the content of the to-be-deployed pkg. Instead of infinitely reattempting to obtain blueprints for such content, the deploy tool prints a single message.
This commit is contained in:
parent
cb9a448fc9
commit
5286456e48
@ -61,6 +61,11 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
Binary_name _binary_name { };
|
||||
Config_name _config_name { };
|
||||
|
||||
/*
|
||||
* Set if the depot query for the child's blueprint failed.
|
||||
*/
|
||||
bool _pkg_incomplete = false;
|
||||
|
||||
bool _configured() const
|
||||
{
|
||||
return _pkg_xml.constructed()
|
||||
@ -122,6 +127,9 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
|
||||
/* import new start node */
|
||||
_start_xml.construct(_alloc, start_node);
|
||||
|
||||
/* reset error state, attempt to obtain the blueprint again */
|
||||
_pkg_incomplete = false;
|
||||
}
|
||||
|
||||
void apply_blueprint(Xml_node pkg)
|
||||
@ -144,9 +152,24 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
_pkg_xml.construct(_alloc, pkg);
|
||||
}
|
||||
|
||||
void mark_as_incomplete(Xml_node missing)
|
||||
{
|
||||
/* print error message only once */
|
||||
if(_pkg_incomplete)
|
||||
return;
|
||||
|
||||
Archive::Path const path = missing.attribute_value("path", Archive::Path());
|
||||
if (path != _blueprint_pkg_path)
|
||||
return;
|
||||
|
||||
error(path, " incomplete or missing");
|
||||
|
||||
_pkg_incomplete = true;
|
||||
}
|
||||
|
||||
void gen_query(Xml_generator &xml) const
|
||||
{
|
||||
if (_configured())
|
||||
if (_configured() || _pkg_incomplete)
|
||||
return;
|
||||
|
||||
xml.node("blueprint", [&] () {
|
||||
|
@ -73,6 +73,10 @@ class Depot_deploy::Children
|
||||
blueprint.for_each_sub_node("pkg", [&] (Xml_node pkg) {
|
||||
_children.for_each([&] (Child &child) {
|
||||
child.apply_blueprint(pkg); }); });
|
||||
|
||||
blueprint.for_each_sub_node("missing", [&] (Xml_node missing) {
|
||||
_children.for_each([&] (Child &child) {
|
||||
child.mark_as_incomplete(missing); }); });
|
||||
}
|
||||
|
||||
void gen_start_nodes(Xml_generator &xml, Xml_node common)
|
||||
|
@ -273,8 +273,8 @@ struct Depot_query::Main
|
||||
catch (Xml_generator::Buffer_exceeded) {
|
||||
throw; /* handled by 'generate' */ }
|
||||
catch (...) {
|
||||
warning("could not obtain blueprint for '", pkg, "'");
|
||||
}
|
||||
xml.node("missing", [&] () {
|
||||
xml.attribute("path", pkg); }); }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user