From 89a79ad7217e1d2618a6c247402e2d7b562f3e9d Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 03 Jan 2021 21:39:52 -0500 Subject: cmd/build: Factor out interesting parts --- (limited to 'src/cmd') diff --git a/src/cmd/build.sh b/src/cmd/build.sh index feced70..021c4aa 100644 --- a/src/cmd/build.sh +++ b/src/cmd/build.sh @@ -68,6 +68,37 @@ _cmd_build_fini() done } +_cmd_build_build() +{ + local host_arch="${1}" + local host_plat="${2}" + shift 2 + local es= + + es=0 + + _cmd_build_build_deps="$(package_get_build_deps \ + "${host_arch}" "${host_plat}")" + if [ "x${_cmd_build_build_deps}" != 'x' ]; then + _cmd_build_make_deps_pkg + if session_exec opkg -a "${host_arch}" print-architecture \ + 1>/dev/null 2>&1; then + session_exec opkg -a "${host_arch}" \ + install ../builddeps.opk || es=${?} + else + session_exec opkg install ../builddeps.opk || es=${?} + fi + fi + + if [ ${es} -eq 0 ]; then + session_exec opkbuild "${@}" || es=${?} + fi + + _cmd_build_fini + + return ${es} +} + cmd_build_main() { local root= @@ -146,25 +177,7 @@ cmd_build_main() fi es=0 - - _cmd_build_build_deps="$(package_get_build_deps \ - "${host_arch}" "${host_plat}")" - if [ "x${_cmd_build_build_deps}" != 'x' ]; then - _cmd_build_make_deps_pkg - if session_exec opkg -a "${host_arch}" print-architecture \ - 1>/dev/null 2>&1; then - session_exec opkg -a "${host_arch}" \ - install ../builddeps.opk || es=${?} - else - session_exec opkg install ../builddeps.opk || es=${?} - fi - fi - - if [ ${es} -eq 0 ]; then - session_exec opkbuild "${@}" || es=${?} - fi - - _cmd_build_fini + _cmd_build_build "${host_arch}" "${host_plat}" "${@}" || es=${?} session_end -- cgit v0.9.1