From cc86a5dda0b462ba3ce401d43b3c8f49f427e201 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz Date: Jan 19 2019 20:39:54 +0000 Subject: build.sh, subr/{build_args,ex_pkg_dispatch}.subr: fix -r LAST. --- diff --git a/build.sh b/build.sh index 9a3b57b..143d50d 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ buildp_dispatch() { local _msg="${1}" _pkg_name="${2}" _tgt_name="${3}" \ - _build_tgt_meta="" _build_tgt_lc="" _build_tgts_lc=""_pkg_restart="" PKGS_FOUND; + _build_tgt_meta="" _build_tgt_lc="" _build_tgts_lc="" _last_pkg="" _pkg_restart="" PKGS_FOUND; case "${_msg}" in # Top-level start_build) shift; build_args "${@}"; build_init; @@ -15,6 +15,14 @@ buildp_dispatch() { if ! ex_rtl_lmatch "${ARG_DIST}" , rpm; then _build_tgts_lc="$(ex_rtl_lfilter_not "${_build_tgts_lc}" "host_tools_rpm")"; fi; + if [ "${ARG_RESTART}" = "LAST" ]; then + if [ -n "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]\ + && [ -e "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]; then + _last_pkg="$(cat "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}")"; + ex_rtl_fileop rm "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}"; + ex_rtl_state_clear "${BUILD_WORKDIR}" "${_last_pkg}"; + fi; + fi; PKGS_FOUND=""; for _build_tgt_lc in ${_build_tgts_lc}; do ex_pkg_dispatch "${_build_tgt_lc}" \ diff --git a/subr/build_args.subr b/subr/build_args.subr index 6d7c278..bf6956f 100644 --- a/subr/build_args.subr +++ b/subr/build_args.subr @@ -61,14 +61,18 @@ build_args() { ARG_DIST="${ARG_DIST:+${ARG_DIST},}minipix"; fi; fi; - if [ -n "${ARG_RESTART}" ]; then - if [ "${ARG_RESTART%:*}" != "${ARG_RESTART}" ]; then + case "${ARG_RESTART}" in + ALL) ARG_RESTART_AT=ALL; ;; + LAST) ARG_RESTART_AT=""; ;; + "") ;; + *) if [ "${ARG_RESTART%:*}" != "${ARG_RESTART}" ]; then ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}"; else ARG_RESTART_AT=ALL; fi; ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")"; - fi; + ;; + esac; case "${ARG_VERBOSE}" in -v) ARG_VERBOSE=1; ;; -vv) ARG_VERBOSE=2; ;; diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr index 9a06fd3..0b0fa7d 100644 --- a/subr/ex_pkg_dispatch.subr +++ b/subr/ex_pkg_dispatch.subr @@ -29,24 +29,16 @@ exp_pkg_dispatch() { ex_pkg_dispatch() { local _tgt_name="${1}" _restart="${2}" _restart_at="${3}" _dispatch_fn="${4}" _pkgs_found_vname="${5}" \ - _last_pkg="" _njob="" _njobs="" _njobs_max="" _pipe_msg="" _pipe_path="" \ - _pkg_names="" _pkgs_found="" _script_rc="" _stderrout_path="" _tgt_name_uc=""; + _njob="" _njobs="" _njobs_max="" _pipe_msg="" _pipe_path="" _pkg_names="" _pkgs_found="" \ + _script_rc="" _stderrout_path="" _tgt_name_uc=""; ex_rtl_fileop mkdir "${BUILD_WORKDIR}"; _pipe_path="${BUILD_WORKDIR}/build.fifo"; _tgt_name_uc="$(ex_rtl_toupper "${_tgt_name}")"; "${_dispatch_fn}" start_target "" "${_tgt_name}"; _pkg_names="$(ex_rtl_get_var_unsafe ${_tgt_name_uc}_PACKAGES)"; - if [ -n "${_restart}" ]; then - if [ "${_restart}" = "LAST" ]; then - if [ -n "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]\ - && [ -e "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]; then - _last_pkg="$(cat "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}")"; - ex_rtl_fileop rm "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}"; - ex_rtl_state_clear "${BUILD_WORKDIR}" "${_last_pkg}"; - fi; - elif [ "${_restart}" != "ALL" ]; then - _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_restart}")"; - fi; + if [ -n "${_restart}" ]\ + && ! ex_rtl_lmatch "ALL LAST" " " "${_restart}"; then + _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_restart}")"; fi; if [ "$(ex_rtl_get_var_unsafe ${_tgt_name_uc}_PARALLELISE)" = 1 ]\ && [ "${ARG_PARALLEL:-0}" -gt 1 ]; then