genode/repos/gems/run/depot_download.run
Norman Feske ac68073ffc depot_download: support downloading index files
With this commit, the 'installation' input of the depot-download
subsystem accepts <index> nodes in addition to <archive> nodes. Each
index node refers to one index file specified via the 'path' attribute.

This commit also improves the tracking of failure states. Once an
installation job failed (due to a download of verification error),
it won't get re-scheduled. In the past, such failure states were not kept
across subsequent import iterations, which could result in infinite
re-attempts when an installation contained archives from multiple users.
The the progress of the download process is now reflected by the
"progress" attribute on the download manager's state report, which
allows the final report to contain the list of installed/failed archives
along with the overall progress/completed state. The detection of the
latter is important for the sculpt manager for reattempting the
deployment of the completed packages.

The patch enhances the depot_download.run script to stress the new
abilities. In particular, the scenario downloads a mix of index files
(one present, one missing) and archives, from two different depot users
(genodelabs and nfeske).

Issue #3172
2019-02-28 11:34:06 +01:00

147 lines
4.3 KiB
Plaintext

create_boot_directory
# the test currently is tied to the x86-only iPXE NIC driver
if {![have_spec x86] || [have_spec linux]} {
puts "Run script does not support this platform."
exit 0
}
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/src/report_rom \
[depot_user]/src/fs_rom \
[depot_user]/src/vfs \
[depot_user]/src/vfs_lxip \
[depot_user]/src/fetchurl \
[depot_user]/src/libc \
[depot_user]/src/libssh \
[depot_user]/src/libssl \
[depot_user]/src/libcrypto \
[depot_user]/src/zlib \
[depot_user]/src/curl \
[depot_user]/src/init \
[depot_user]/src/chroot \
[depot_user]/src/acpi_drv \
[depot_user]/src/ipxe_nic_drv \
[depot_user]/src/platform_drv \
[depot_user]/src/extract \
[depot_user]/src/libarchive \
[depot_user]/src/liblzma \
[depot_user]/src/verify
source ${genode_dir}/repos/base/run/platform_drv.inc
set config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>}
append_platform_drv_config
proc depot_user_download { user } {
return [exec cat [genode_dir]/depot/$user/download] }
proc depot_user_pubkey { user } {
return [exec cat [genode_dir]/depot/$user/pubkey] }
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="vfs">
<resource name="RAM" quantum="20M"/>
<provides> <service name="File_system"/> </provides>
<config>
<vfs>
<dir name="depot">
<dir name="nfeske">
<ram/>
<inline name="download">} [depot_user_download nfeske] {</inline>
<inline name="pubkey">} [depot_user_pubkey nfeske] {</inline>
</dir>
<dir name="genodelabs">
<ram/>
<inline name="download">} [depot_user_download genodelabs] {</inline>
<inline name="pubkey">} [depot_user_pubkey genodelabs] {</inline>
</dir>
</dir>
<dir name="public"> <ram/> </dir>
</vfs>
<policy label="depot_download -> depot" root="/depot" writeable="yes"/>
<policy label="depot_download -> public" root="/public" writeable="yes"/>
</config>
</start>
<start name="report_rom">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Report"/> <service name="ROM"/> </provides>
<config verbose="yes">
</config>
</start>
<start name="nic_drv">
<resource name="RAM" quantum="6M"/>
<provides> <service name="Nic"/> </provides>
</start>
<start name="depot_download" caps="2000">
<binary name="init"/>
<resource name="RAM" quantum="70M"/>
<route>
<service name="ROM" label="config">
<parent label="depot_download.config"/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<service name="File_system"> <child name="vfs"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>}
set fd [open [run_dir]/genode/installation w]
puts $fd {
<installation arch="x86_64">
<archive path="genodelabs/pkg/wm/2018-02-26"/>
<index path="nfeske/index/19.02"/>
<index path="nfeske/index/19.03"/>
</installation>}
close $fd
install_config $config
file copy -force [genode_dir]/repos/gems/recipes/raw/depot_download/depot_download.config \
[run_dir]/genode/depot_download.config
build { app/depot_download_manager app/depot_query }
append boot_modules { depot_download_manager depot_query }
build_boot_image $boot_modules
append qemu_args " -nographic -net nic,model=e1000 -net user "
# watch the state reports generated by the depot-download manager
set expected_pattern {}
append expected_pattern {.*path="genodelabs/pkg/wm/2018-02-26" state="done".*}
append expected_pattern {.*path="nfeske/index/19.02" state="done".*}
append expected_pattern {.*path="nfeske/index/19.03" state="failed".*}
run_genode_until $expected_pattern 150