blob: da091e9cfa188a24ec6b62132ee906420ce73242 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#
# set +o errexit -o noglob -o nounset is assumed.
#
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}";
done;
};
rtl_state_set() {
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_steps="${3}" \
_restart_at="${4:-}" _build_step="" _done_fname="" \
IFS="," _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;
else
rtl_lmatch "${_restart_at}" "${_build_step}" ",";
_rc=$((${?} ? 0 : 1));
fi; [ "${_rc}" -eq 0 ] && break;
done; return "${_rc}";
};
# vim:filetype=sh
|