diff --git a/tool/builddir/build.conf/run b/tool/builddir/build.conf/run index 0b49e7324..1cd62257a 100644 --- a/tool/builddir/build.conf/run +++ b/tool/builddir/build.conf/run @@ -3,3 +3,6 @@ ## Run-tool configuration ## +# create depot archives and update recipe versions automatically +#RUN_OPT += --depot-auto-update + diff --git a/tool/builddir/build.mk b/tool/builddir/build.mk index 8d3cd7d0e..8e4a81b5d 100644 --- a/tool/builddir/build.mk +++ b/tool/builddir/build.mk @@ -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) diff --git a/tool/depot/mk/build_bin_archive b/tool/depot/mk/build_bin_archive index 9ccbc79dd..ee57cf742 100755 --- a/tool/depot/mk/build_bin_archive +++ b/tool/depot/mk/build_bin_archive @@ -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 # diff --git a/tool/run/depot.inc b/tool/run/depot.inc index e2aefd3be..b436a0884 100644 --- a/tool/run/depot.inc +++ b/tool/run/depot.inc @@ -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 }