From ef3ff3dfe4409b63a68a46704d0f30fa9b13f58e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 30 Jun 2024 00:40:30 +0100 Subject: [PATCH] trees, multi: download bare project *before* trees when downloading multi-tree projects, the rev can be reset to HEAD instead of the actual rev for a given target. this occurs when the bare repo (e.g. src/coreboot/coreboot) does not exist and has to be downloaded first. bare repository downloading does not rely on target.cfg, in this context, only pkg.cfg, but it uses the same variable names (e.g. "rev"). instead of using a separate variable name, thus increasing code complexity (which is the exact opposite of what i want to do), do the bare repository download first. this means that the git.sh script is much cleaner now, for multi-tree projects, in that it *only* copies the bare repo then runs git_prep; in that context, the bare repo is cloned directly by calling the relevant function from script/trees, which is the same behaviour as when cloning single-tree project sources. Signed-off-by: Leah Rowe --- include/git.sh | 2 -- script/trees | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/git.sh b/include/git.sh index e73f1ad..12aa80d 100755 --- a/include/git.sh +++ b/include/git.sh @@ -7,8 +7,6 @@ eval `setvars "" rev loc url bkup_url depend tree_depend xtree mdir subhash \ fetch_targets() { - [ ! -d "src/$project/$project" ] && x_ mkdir -p "src/$project" \ - && fetch_project "$project" [ -n "$tree_depend" ] && [ "$tree_depend" != "$tree" ] && \ x_ ./update trees -f "$project" "$tree_depend" e "src/$project/$tree" d || prepare_new_tree; return 0 diff --git a/script/trees b/script/trees index 9780550..38e40ba 100755 --- a/script/trees +++ b/script/trees @@ -140,6 +140,9 @@ handle_src_tree() load_project_config() { + [ "$cmd" = "build_targets" ] && [ ! -d "src/$project/$project" ] && \ + x_ mkdir -p "src/$project" && fetch_project "$project" + eval `setvars "" xarch xlang bootstrapargs autoconfargs xtree \ tree_depend makeargs btype mkhelper` [ -f "$1/target.cfg" ] || btype="auto"