summaryrefslogtreecommitdiffhomepage
path: root/subr.rtl/rtl_state.subr
diff options
context:
space:
mode:
authorLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-02-17 19:29:28 +0100
committerLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-02-17 19:29:28 +0100
commite9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492 (patch)
tree37e46c2578bd8f4f435073db01abc514976da8a8 /subr.rtl/rtl_state.subr
parent56495632fc8bf612766a9c431e37ff27a903e8c6 (diff)
downloadmidipix_build-e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492.tar.bz2
midipix_build-e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492.tar.xz
Make everything a bit faster.
0) Issues several prayers and sacrifices to Enki under threat of a terrible deluge sent down by Ellil 1) Convert fork-write/read exprs to be non-forking 2) Pass mostly everything by reference 3) Don't bother cleaning the variable namespace because Bourne shell is an abomination 4) Removes broken ./pkgtool.sh -s, --restart-at, --update-diff & ./build.sh --dump-{in,on-abort} 5) Cleanup
Diffstat (limited to 'subr.rtl/rtl_state.subr')
-rw-r--r--subr.rtl/rtl_state.subr55
1 files changed, 33 insertions, 22 deletions
diff --git a/subr.rtl/rtl_state.subr b/subr.rtl/rtl_state.subr
index da091e9c..fdf58a67 100644
--- a/subr.rtl/rtl_state.subr
+++ b/subr.rtl/rtl_state.subr
@@ -3,42 +3,53 @@
#
rtl_state_clear() {
- local _workdir="${1}" _pkg_name="${2}" _pkg_fname="";
- for _pkg_fname in $(find "${_workdir}" \
- -maxdepth 1 -mindepth 1 -name .${_pkg_name}.\* -type f); do
- rtl_fileop rm "${_pkg_fname}";
+ local _rsc_workdir="${1}" _rsc_pkg_name="${2}" \
+ _rsc_pkg_fname="";
+
+ for _rsc_pkg_fname in $(
+ find "${_rsc_workdir}" \
+ -maxdepth 1 \
+ -mindepth 1 \
+ -name .${_rsc_pkg_name}.\* \
+ -type f);
+ do
+ rtl_fileop rm "${_rsc_pkg_fname}";
done;
+ return 0;
};
rtl_state_set() {
- local _workdir="${1}" _pkg_fname="${2}" _build_step="${3}" \
- _done_fname_pfx="${1}/.${2}"; shift 3;
+ local _rss_workdir="${1}" _rss_pkg_fname="${2}" _rss_build_step="${3}" \
+ _rss_done_fname_pfx="${1}/.${2}";
+ shift 3;
- rtl_fileop touch "${_done_fname_pfx}.${_build_step}";
+ rtl_fileop touch "${_rss_done_fname_pfx}.${_rss_build_step}";
while [ ${#} -ge 1 ]; do
if [ "${#1}" -gt 0 ]; then
- rtl_fileop rm "${_done_fname_pfx}.${1}";
+ rtl_fileop rm "${_rss_done_fname_pfx}.${1}";
fi; shift;
done;
+ return 0;
};
rtl_state_test() {
- local _workdir="${1}" _pkg_name="${2}" _build_steps="${3}" \
- _restart_at="${4:-}" _build_step="" _done_fname="" \
- IFS="," _rc=0;
+ local _rst_workdir="${1}" _rst_pkg_name="${2}" _rst_build_steps="${3}" \
+ _rst_restart_at="${4:-}" _rst_build_step="" _rst_done_fname="" \
+ IFS="," _rst_rc=0;
- for _build_step in ${_build_steps}; do
- _done_fname="${_workdir}/.${_pkg_name}.${_build_step}";
- if [ "${_restart_at:+1}" != 1 ]\
- || [ "${_restart_at}" = "LAST" ]; then
- rtl_fileop test "${_done_fname}"; _rc="${?}";
- elif [ "${_restart_at}" = "ALL" ]; then
- _rc=1;
+ for _rst_build_step in ${_rst_build_steps}; do
+ _rst_done_fname="${_rst_workdir}/.${_rst_pkg_name}.${_rst_build_step}";
+ if [ "${_rst_restart_at:+1}" != 1 ]\
+ || [ "${_rst_restart_at}" = "LAST" ]; then
+ rtl_fileop test "${_rst_done_fname}"; _rst_rc="${?}";
+ elif [ "${_rst_restart_at}" = "ALL" ]; then
+ _rst_rc=1;
else
- rtl_lmatch "${_restart_at}" "${_build_step}" ",";
- _rc=$((${?} ? 0 : 1));
- fi; [ "${_rc}" -eq 0 ] && break;
- done; return "${_rc}";
+ rtl_lmatch \$_rst_restart_at "${_rst_build_step}" ",";
+ _rst_rc=$((${?} ? 0 : 1));
+ fi; [ "${_rst_rc}" -eq 0 ] && break;
+ done;
+ return "${_rst_rc}";
};
# vim:filetype=sh