From 370e98db644d9cd75172205e4e472978e68e0990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Fri, 7 May 2021 17:12:29 +0100 Subject: Implements extended -r syntax. build.sh:buildp_ast(): only reset package build step state if ${ARG_RESET_PKG} is 1. etc/{build.usage,README.md}: updated. etc/build.usage.short, subr/build_init.subr: implement short help screen. midipix.env: correctly escape multi-line variable assignment expressions. subr.rtl/rtl_list.subr: updated. subr.rtl/rtl_state.subr:rtl_state_set(): correctly implement invalidation. subr.rtl/rtl_state.subr:rtl_state_test(): honour `LAST'. subr/build_init.subr:buildp_init_getopts(): implements --reset-pkg. subr/build_init.subr:buildp_{expand_restart_{at,recursive},process_restart_spec}(): initial implementation. subr/ex_pkg_{dispatch,env}.subr: updated. subr/ex_pkg_exec.subr:ex_pkg_exec(): honour `ALL' and `LAST'. vars/gcc.vars: updated. --- subr.rtl/rtl_list.subr | 2 ++ subr.rtl/rtl_state.subr | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'subr.rtl') diff --git a/subr.rtl/rtl_list.subr b/subr.rtl/rtl_list.subr index 369d3b46..29abef2e 100644 --- a/subr.rtl/rtl_list.subr +++ b/subr.rtl/rtl_list.subr @@ -1,5 +1,7 @@ # # set +o errexit -o noglob -o nounset is assumed. +# N.B. Lists separated by SP, when passed to rtl_l*() w/ explicit IFS, +# must specify "" as IFS. # rtl_lassign() { diff --git a/subr.rtl/rtl_state.subr b/subr.rtl/rtl_state.subr index 6d539563..203ec520 100644 --- a/subr.rtl/rtl_state.subr +++ b/subr.rtl/rtl_state.subr @@ -11,23 +11,22 @@ rtl_state_clear() { }; rtl_state_set() { - local _workdir="${1}" _pkg_fname="${2}" _done_fname_pfx=""; - _done_fname_pfx="${_workdir}/.${_pkg_fname}"; - shift 2; while [ ${#} -ge 1 ]; do - if [ -z "${1}" ]; then - shift; continue; - elif [ "${1#-}" != "${1}" ]; then - rtl_fileop rm "${_done_fname_pfx}.${1#-}"; - else - rtl_fileop touch "${_done_fname_pfx}.${1}"; - fi; - shift; done; + local _workdir="${1}" _pkg_fname="${2}" _build_step="${3}" \ + _done_fname_pfx="${1}/.${2}"; shift 3; + + rtl_fileop touch "${_done_fname_pfx}.${_build_step}"; + while [ ${#} -ge 1 ]; do + if [ "${#1}" -gt 0 ]; then + rtl_fileop rm "${_done_fname_pfx}.${1}"; + fi; shift; + done; }; rtl_state_test() { local _workdir="${1}" _pkg_name="${2}" _build_step="${3}" _restart_at="${4:-}" _done_fname=""; _done_fname="${_workdir}/.${_pkg_name}.${_build_step}"; - if [ -z "${_restart_at}" ]; then + if [ -z "${_restart_at}" ]\ + || [ "${_restart_at}" = "LAST" ]; then rtl_fileop test "${_done_fname}"; elif [ "${_restart_at}" = "ALL" ]; then return 1; -- cgit v1.2.3