summaryrefslogtreecommitdiff
path: root/script/update/project/trees
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-02 04:53:22 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-02 04:53:22 +0100
commitcd2caecb739bb2c20f25780c17813bc70cd2b29a (patch)
tree199b0430f5a527b7619b87ede531ae3f7e44f938 /script/update/project/trees
parentbcbd3734b3f482195338b1cb416c978980797bc8 (diff)
update/project/trees: general code cleanup
reduced sloccount, without reducing functionality Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update/project/trees')
-rwxr-xr-xscript/update/project/trees28
1 files changed, 10 insertions, 18 deletions
diff --git a/script/update/project/trees b/script/update/project/trees
index de01a942..c5b40dc0 100755
--- a/script/update/project/trees
+++ b/script/update/project/trees
@@ -42,16 +42,12 @@ download_for_target()
x_ fetch_config "${_target}"
if [ -d "${project}/${tree}" ]; then
- printf "REMARK: download/%s %s: exists. Skipping.\n" \
- "${project}" "${tree}" 1>&2
- [ "${tree}" != "${_target}" ] && \
- printf "(for target: '%s}')\n" "${_target}" 1>&2
- return 0
+ printf "REMARK: download/%s %s (%s): exists. Skipping.\n" \
+ "${project}" "${tree}" "${_target}" 1>&2
+ else
+ x_ fetch_from_upstream "${project}"
+ x_ prepare_new_tree "${_target}" "${tree}" "${rev}"
fi
-
- fetch_from_upstream || \
- err "download_for_target: cannot fetch: ${project}"
- x_ prepare_new_tree "${_target}" "${tree}" "${rev}"
}
fetch_config()
@@ -111,11 +107,11 @@ check_config_for_target()
fetch_from_upstream()
{
- [ -d "${project}" ] || mkdir -p "${project}" || return 1
- [ -d "${project}" ] || return 1
- [ -d "${project}/${project}" ] && return 0
+ [ -d "${1}" ] || mkdir -p "${1}" || return 1
+ [ -d "${1}" ] || return 1
+ [ -d "${1}/${1}" ] && return 0
- ./update project repo ${project} || return 1
+ ./update project repo ${1} || return 1
}
prepare_new_tree()
@@ -124,19 +120,15 @@ prepare_new_tree()
tree=${2}
rev=${3}
- printf "Preparing %s tree: %s\n" ${project} ${tree}
- [ "${tree}" != "${target}" ] && \
- printf "(for target, %s)\n" "${target}"
+ printf "Preparing %s tree %s (%s)\n" "${project}" "${tree}" "${target}"
x_ cp -R "${project}/${project}" "${project}/${tree}"
x_ git_reset_rev "${project}/${tree}" "${rev}" "err"
-
(
x_ cd "${project}/${tree}"
git submodule update --init --checkout || \
err "prepare_new_tree ${project}/${tree}: can't update git modules"
)
-
x_ git_am_patches "${PWD}/${project}/${tree}" \
"${PWD}/${cfgsdir}/${tree}/patches" "err"
}