mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
run: add --depot-auto-update feature
If enabled, this option triggers the automated management of depot content according to the needs of a run script. Fixes #3270
This commit is contained in:
parent
d027f12764
commit
a3411c8e96
@ -3,3 +3,6 @@
|
||||
## Run-tool configuration
|
||||
##
|
||||
|
||||
# create depot archives and update recipe versions automatically
|
||||
#RUN_OPT += --depot-auto-update
|
||||
|
||||
|
@ -323,6 +323,7 @@ run/%: $(call select_from_repositories,run/%.run) $(RUN_ENV)
|
||||
--repositories "$(REPOSITORIES)" \
|
||||
--cross-dev-prefix "$(CROSS_DEV_PREFIX)" \
|
||||
--qemu-args "$(QEMU_OPT)" \
|
||||
--make "$(MAKE)" \
|
||||
$(RUN_OPT) \
|
||||
--include $(RUN_SCRIPT)
|
||||
|
||||
|
@ -25,6 +25,19 @@ export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../../..)
|
||||
include $(GENODE_DIR)/tool/depot/mk/front_end.inc
|
||||
|
||||
|
||||
#
|
||||
# Provide Genode build system with clean environment
|
||||
#
|
||||
unexport BASE_DIR
|
||||
unexport SPECS
|
||||
unexport SPEC_FILES
|
||||
unexport LIB_CACHE_DIR
|
||||
unexport LIB_DEP_FILE
|
||||
unexport LIB_PROGRESS_LOG
|
||||
unexport CONTRIB_DIR
|
||||
unexport REPOSITORIES
|
||||
|
||||
|
||||
#
|
||||
# The target is the name of the archive
|
||||
#
|
||||
|
@ -183,9 +183,56 @@ proc _depot_contains_archive { user type name version } {
|
||||
}
|
||||
|
||||
|
||||
proc _depot_auto_update { archives } {
|
||||
|
||||
set archives_to_create { }
|
||||
foreach archive $archives {
|
||||
|
||||
if {[regexp [_depot_archive_path_pattern] $archive dummy user type name]} {
|
||||
|
||||
if {$type == "pkg"} {
|
||||
lappend archives_to_create "$user/pkg/[depot_spec]/$name" }
|
||||
|
||||
if {$type == "src"} {
|
||||
lappend archives_to_create "$user/bin/[depot_spec]/$name" }
|
||||
|
||||
if {$type == "raw"} {
|
||||
lappend archives_to_create "$user/raw/$name" }
|
||||
}
|
||||
}
|
||||
|
||||
# remove duplicates
|
||||
set archives_to_create [lsort -unique $archives_to_create]
|
||||
|
||||
set cmd "[genode_dir]/tool/depot/create $archives_to_create "
|
||||
append cmd "CROSS_DEV_PREFIX=[cross_dev_prefix] "
|
||||
append cmd "UPDATE_VERSIONS=1 FORCE=1 REBUILD= "
|
||||
|
||||
set make_j_arg ""
|
||||
regexp {.*(-j\d*)} [get_cmd_arg_first --make ""] dummy make_j_arg
|
||||
append cmd "$make_j_arg "
|
||||
|
||||
puts "update depot: $cmd"
|
||||
|
||||
exec {*}$cmd >@ stdout 2>@ stderr
|
||||
}
|
||||
|
||||
|
||||
# keep track of recursion to perform '_depot_auto_update' only at the top level
|
||||
set _collect_from_depot_nesting_level 0
|
||||
|
||||
|
||||
proc _collect_from_depot { archives } {
|
||||
|
||||
global _missing_depot_archives
|
||||
global _collect_from_depot_nesting_level
|
||||
|
||||
incr _collect_from_depot_nesting_level
|
||||
|
||||
# fill depot with up-to-date content if --depot-auto-update is enabled
|
||||
if {[get_cmd_switch --depot-auto-update]} {
|
||||
if {$_collect_from_depot_nesting_level == 1} {
|
||||
_depot_auto_update $archives } }
|
||||
|
||||
set all_content {}
|
||||
|
||||
@ -234,6 +281,8 @@ proc _collect_from_depot { archives } {
|
||||
}
|
||||
set all_content [concat $all_content $content]
|
||||
}
|
||||
|
||||
incr _collect_from_depot_nesting_level -1
|
||||
return $all_content
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user