diff options
author | Leah Rowe <leah@libreboot.org> | 2023-10-02 05:47:49 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-10-02 05:47:49 +0100 |
commit | 0f86a393ace984fcb2035138e01b61cda84af68d (patch) | |
tree | 40bd4fe3617d7ce13bb44b09a1a5659b318a8ff1 /script/update/project | |
parent | 67ac799d4964a75f6c302ec787cceae01781eefd (diff) |
update/project/trees: optimise error handling
some x_ calls are made that aren't needed. this is now
corrected. additionally, some x_ calls were being made
that are quite error-prone, like ones that use $PWD.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update/project')
-rwxr-xr-x | script/update/project/trees | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/script/update/project/trees b/script/update/project/trees index f030c8dc..38d2c59d 100755 --- a/script/update/project/trees +++ b/script/update/project/trees @@ -29,7 +29,7 @@ main() for x in ${targets}; do x_ rm -f "${cfgsdir}/"*/seen - x_ download_for_target "${x}" + download_for_target "${x}" done } @@ -39,14 +39,14 @@ download_for_target() tree="undefined" rev="undefined" - x_ fetch_config "${_target}" + fetch_config "${_target}" if [ -d "${project}/${tree}" ]; then 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}" + fetch_from_upstream + prepare_new_tree fi } @@ -87,20 +87,16 @@ check_config_for_target() fetch_from_upstream() { - [ -d "${1}" ] || mkdir -p "${1}" || return 1 - [ -d "${1}" ] || return 1 - [ -d "${1}/${1}" ] && return 0 + [ -d "${project}" ] || mkdir -p "${project}" || return 1 + [ -d "${project}" ] || return 1 + [ -d "${project}/${project}" ] && return 0 - ./update project repo ${1} || return 1 + x_ ./update project repo "${project}" } prepare_new_tree() { - target=${1} - tree=${2} - rev=${3} - - printf "Preparing %s tree %s (%s)\n" "${project}" "${tree}" "${target}" + printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}" x_ cp -R "${project}/${project}" "${project}/${tree}" x_ git_reset_rev "${project}/${tree}" "${rev}" "err" @@ -109,7 +105,7 @@ prepare_new_tree() git submodule update --init --checkout || \ err "prepare_new_tree ${project}/${tree}: can't update git modules" ) - x_ git_am_patches "${PWD}/${project}/${tree}" \ + git_am_patches "${PWD}/${project}/${tree}" \ "${PWD}/${cfgsdir}/${tree}/patches" "err" } |