summaryrefslogtreecommitdiffhomepage
path: root/subr/ex_rtl_state.subr
blob: fe52b29a567dbde1e7e575fcb05f4554f5919fa4 (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
#
# set -o noglob is assumed.
#

ex_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
			ex_rtl_fileop rm "${_done_fname_pfx}.${1#-}";
		else
			ex_rtl_fileop touch "${_done_fname_pfx}.${1}";
		fi;
	shift; done;
};

ex_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
		ex_rtl_fileop test "${_done_fname}";
	elif [ "${_restart_at}" = "ALL" ]; then
		return 1;
	else
		! ex_rtl_lmatch "${_restart_at}" , "${_build_step}";
	fi;
};

# vim:filetype=sh