sculpt: handle deploy downloads by download queue

By managing downloads issued by the deploy subsystem via the
'Download_queue', failed downloads (e.g., due to HTTP error 404) are
properly tracked and don't cause infinite re-attempts.

Issue #4818
This commit is contained in:
Norman Feske 2023-04-19 14:08:30 +02:00 committed by Christian Helmuth
parent 5cb06b5f1c
commit 9e42c94e30
3 changed files with 23 additions and 10 deletions

View File

@ -312,17 +312,22 @@ class Depot_deploy::Child : public List_model<Child>::Element
Depot_rom_server const &cached_depot_rom,
Depot_rom_server const &uncached_depot_rom) const;
template <typename FN>
void with_missing_pkg_path(FN const &fn) const
{
if (_pkg_incomplete)
fn(_config_pkg_path());
}
/**
* Generate installation entry needed for the completion of the child
*/
void gen_installation_entry(Xml_generator &xml) const
{
if (!_pkg_incomplete) return;
xml.node("archive", [&] () {
xml.attribute("path", _config_pkg_path());
xml.attribute("source", "no");
});
with_missing_pkg_path([&] (Archive::Path const &path) {
xml.node("archive", [&] () {
xml.attribute("path", path);
xml.attribute("source", "no"); }); });
}
bool incomplete() const { return _pkg_incomplete; }

View File

@ -136,6 +136,13 @@ class Depot_deploy::Children
child.gen_installation_entry(xml); });
}
template <typename FN>
void for_each_missing_pkg_path(FN const &fn) const
{
_children.for_each([&] (Child const &child) {
child.with_missing_pkg_path(fn); });
}
size_t count() const
{
size_t count = 0;

View File

@ -54,7 +54,7 @@ struct Sculpt::Deploy
Attached_rom_dataspace const &_launcher_listing_rom;
Attached_rom_dataspace const &_blueprint_rom;
Download_queue const &_download_queue;
Download_queue &_download_queue;
typedef String<16> Arch;
Arch _arch { };
@ -195,7 +195,6 @@ struct Sculpt::Deploy
bool update_needed() const
{
return _manual_installation_scheduled
|| _children.any_incomplete()
|| _download_queue.any_active_download();
}
@ -281,9 +280,11 @@ struct Sculpt::Deploy
if (_installation.try_generate_manually_managed())
return;
_children.for_each_missing_pkg_path([&] (Depot::Archive::Path const path) {
_download_queue.add(path, Verify { true }); });
_installation.generate([&] (Xml_generator &xml) {
xml.attribute("arch", _arch);
_children.gen_installation_entries(xml);
_download_queue.gen_installation_entries(xml);
});
}
@ -295,7 +296,7 @@ struct Sculpt::Deploy
Depot_query &depot_query,
Attached_rom_dataspace const &launcher_listing_rom,
Attached_rom_dataspace const &blueprint_rom,
Download_queue const &download_queue)
Download_queue &download_queue)
:
_env(env), _alloc(alloc), _child_states(child_states),
_runtime_info(runtime_info),