git.sh: unify am/submodule and tree copying
do it all in a single function! Signed-off-by: Leah Rowe <leah@libreboot.org>9020vga
parent
ce67c99f40
commit
48551ced3f
|
@ -58,13 +58,9 @@ prepare_new_tree()
|
||||||
{
|
{
|
||||||
printf "Creating %s tree %s (%s)\n" "$project" "$tree" "$_target"
|
printf "Creating %s tree %s (%s)\n" "$project" "$tree" "$_target"
|
||||||
|
|
||||||
cp -R "src/${project}/${project}" "${tmp_git_dir}" || \
|
cp -R "src/${project}/${project}" "${tmpgit}" || \
|
||||||
err "prepare_new_tree ${project}/${tree}: can't make tmpclone"
|
err "prepare_new_tree ${project}/${tree}: can't make tmpclone"
|
||||||
git_patch "$tmp_git_dir" "$PWD/$cfgsdir/$tree/patches"
|
git_prep "$PWD/$cfgsdir/$tree/patches" "src/$project/$tree" "update"
|
||||||
git_submodule_update "${tmp_git_dir}"
|
|
||||||
|
|
||||||
mv "${tmp_git_dir}" "src/${project}/${tree}" || \
|
|
||||||
err "prepare_new_tree ${project}/${tree}: can't copy tmpclone"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_project_repo()
|
fetch_project_repo()
|
||||||
|
@ -76,7 +72,7 @@ fetch_project_repo()
|
||||||
[ -z "${depend}" ] || for d in ${depend} ; do
|
[ -z "${depend}" ] || for d in ${depend} ; do
|
||||||
x_ ./update trees -f ${d}
|
x_ ./update trees -f ${d}
|
||||||
done
|
done
|
||||||
rm -Rf "${tmp_git_dir}" || err "fetch_repo: !rm -Rf ${tmp_git_dir}"
|
rm -Rf "${tmpgit}" || err "fetch_repo: !rm -Rf ${tmpgit}"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_config()
|
verify_config()
|
||||||
|
@ -95,23 +91,29 @@ clone_project()
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git clone ${url} "${tmp_git_dir}" || \
|
git clone $url "$tmpgit" || git clone $bkup_url "$tmpgit" \
|
||||||
git clone ${bkup_url} "${tmp_git_dir}" || \
|
|| err "clone_project: could not download ${project}"
|
||||||
err "clone_project: could not download ${project}"
|
git_prep "$PWD/config/$project/patches" "$loc"
|
||||||
git_patch "${tmp_git_dir}" "${PWD}/config/${project}/patches"
|
|
||||||
|
|
||||||
x_ rm -Rf "${loc}"
|
|
||||||
[ "${loc}" = "${loc%/*}" ] || x_ mkdir -p "${loc%/*}"
|
|
||||||
mv "${tmp_git_dir}" "${loc}" || \
|
|
||||||
err "clone_project: !mv ${tmp_git_dir} ${loc}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
git_patch()
|
git_prep()
|
||||||
{
|
{
|
||||||
git -C "${1}" reset --hard ${rev} || err "!git reset ${1} <- ${rev}"
|
_patchdir="$1"
|
||||||
git_am_patches "$1" "$2" || err "git_patch $project $1 $2: patch fail"
|
_loc="$2"
|
||||||
|
|
||||||
|
git -C "$tmpgit" reset --hard $rev || \
|
||||||
|
err "!git -C $_patchdir reset $rev"
|
||||||
|
git_am_patches "$tmpgit" "$_patchdir" || \
|
||||||
|
err "git_prep $project $_patchdir: patchfail"
|
||||||
|
|
||||||
[ "$project" != "coreboot" ] && [ "$project" != "u-boot" ] && \
|
[ "$project" != "coreboot" ] && [ "$project" != "u-boot" ] && \
|
||||||
git_submodule_update "${1}"; return 0
|
git_submodule_update "$tmpgit"
|
||||||
|
[ $# -gt 2 ] && git_submodule_update "$tmpgit"
|
||||||
|
|
||||||
|
rm -Rf "$_loc" || err "git_prep: !rm -Rf $_loc"
|
||||||
|
[ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}"
|
||||||
|
mv "$tmpgit" "$_loc" || \
|
||||||
|
err "git_prep $project $_patchdir: !mv $tmpgit $_loc"
|
||||||
}
|
}
|
||||||
|
|
||||||
git_submodule_update()
|
git_submodule_update()
|
||||||
|
|
|
@ -12,7 +12,7 @@ cbfstool="cbutils/default/cbfstool"
|
||||||
grubcfgsdir="config/grub"
|
grubcfgsdir="config/grub"
|
||||||
layoutdir="/boot/grub/layouts"
|
layoutdir="/boot/grub/layouts"
|
||||||
. "${grubcfgsdir}/modules.list"
|
. "${grubcfgsdir}/modules.list"
|
||||||
tmp_git_dir="${PWD}/tmp/gitclone"
|
tmpgit="${PWD}/tmp/gitclone"
|
||||||
|
|
||||||
eval "$(setvars "" CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \
|
eval "$(setvars "" CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \
|
||||||
CONFIG_ME_BIN_PATH CONFIG_KBC1126_FIRMWARE CONFIG_KBC1126_FW1 \
|
CONFIG_ME_BIN_PATH CONFIG_KBC1126_FIRMWARE CONFIG_KBC1126_FW1 \
|
||||||
|
|
|
@ -37,7 +37,7 @@ main()
|
||||||
elfdir="elf/${project}"
|
elfdir="elf/${project}"
|
||||||
cfgsdir="config/${project}"
|
cfgsdir="config/${project}"
|
||||||
|
|
||||||
remkdir "${tmp_git_dir%/*}"
|
remkdir "${tmpgit%/*}"
|
||||||
check_project
|
check_project
|
||||||
|
|
||||||
_cmd="build_projects"
|
_cmd="build_projects"
|
||||||
|
|
Loading…
Reference in New Issue