diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/git.sh | 34 | ||||
-rwxr-xr-x | include/mrc.sh | 2 |
2 files changed, 25 insertions, 11 deletions
diff --git a/include/git.sh b/include/git.sh index fa53fed1..811b298a 100755 --- a/include/git.sh +++ b/include/git.sh @@ -4,7 +4,7 @@ # This file is only used by update/project/trees -eval "$(setvars "" _target rev _xm loc url bkup_url depend)" +eval "$(setvars "" _target rev _xm loc url bkup_url depend patchfail)" tmp_git_dir="${PWD}/tmp/gitclone" fetch_project_trees() @@ -58,16 +58,27 @@ prepare_new_tree() { printf "Creating %s tree %s (%s)\n" "${project}" "${tree}" "${_target}" - x_ cp -R "src/${project}/${project}" "src/${project}/${tree}" - git_reset_rev "src/${project}/${tree}" "${rev}" + rm -Rf "${tmp_git_dir%/*}" || \ + err "prepare_new_tree ${project}/${tree}: can't rm tmpclone" + mkdir "${tmp_git_dir%/*}" || \ + err "prepare_new_tree ${project}/${tree}: can't mkdir tmp" + cp -R "src/${project}/${project}" "${tmp_git_dir}" || \ + err "prepare_new_tree ${project}/${tree}: can't make tmpclone" + git_reset_rev "${tmp_git_dir}" "${rev}" ( - x_ cd "src/${project}/${tree}" + cd "${tmp_git_dir}" || \ + err "prepare_new_tree ${project}/${tree}: can't cd tmpclone" if [ -f ".gitmodules" ]; then git submodule update --init --checkout || \ err "prepare_new_tree ${project}/${tree}: !submodules" fi - ) - git_am_patches "$PWD/src/$project/$tree" "$PWD/$cfgsdir/$tree/patches" + ) || err "git submodule update failure" + git_am_patches "${tmp_git_dir}" "$PWD/$cfgsdir/$tree/patches" || \ + err "prepare_new_tree ${project}/${tree}: patch fail" + [ "${patchfail}" = "y" ] && err "PATCH FAIL" + + mv "${tmp_git_dir}" "src/${project}/${tree}" || \ + err "prepare_new_tree ${project}/${tree}: can't copy tmpclone" } fetch_project_repo() @@ -107,7 +118,9 @@ clone_project() git clone ${bkup_url} "${tmp_git_dir}" || \ err "clone_project: could not download ${project}" git_reset_rev "${tmp_git_dir}" "${rev}" - git_am_patches "${tmp_git_dir}" "${PWD}/config/${project}/patches" + git_am_patches "${tmp_git_dir}" "${PWD}/config/${project}/patches" \ + || err "clone_project ${project} ${loc}: patch fail" + [ "${patchfail}" = "y" ] && err "PATCH FAIL" x_ rm -Rf "${loc}" [ "${loc}" = "${loc%/*}" ] || x_ mkdir -p ${loc%/*} @@ -125,7 +138,7 @@ git_reset_rev() git submodule update --init --checkout || \ err "git_reset_rev ${1}: can't download submodules" fi - ) + ) || err "git reset fail" } git_am_patches() @@ -137,17 +150,18 @@ git_am_patches() for patch in "${patchdir}/"*; do [ -L "${patch}" ] && continue [ -f "${patch}" ] || continue - patchfail="n" git am "${patch}" || patchfail="y" if [ "${patchfail}" = "y" ]; then git am --abort || err "${sdir}: !git am --abort" err "!git am ${patch} -> ${sdir}" fi done - ) + ) || err "PATCH FAILURE" for patches in "${patchdir}/"*; do [ -L "${patches}" ] && continue [ ! -d "${patches}" ] && continue git_am_patches "${sdir}" "${patches}" done + [ "${patchfail}" = "y" ] && return 1 + return 0 } diff --git a/include/mrc.sh b/include/mrc.sh index e57026a4..929aed7a 100755 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -20,7 +20,7 @@ extract_mrc() extract_partition extract_shellball extract_coreboot - ) + ) || err "mrc download/extract failure" "${cbfstool}" "${appdir}/"coreboot-*.bin extract -n mrc.bin \ -f "${_dest}" -r RO_SECTION || err "extract_mrc: cbfstool ${_dest}" |