Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pre_state.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
pre_state() {
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
	case "${1}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
	fini)	: $((BUILD_TIMES_SECS=$(command date +%s)-${BUILD_TIMES_SECS}));
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		: $((BUILD_TIMES_HOURS=${BUILD_TIMES_SECS}/3600));
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		: $((BUILD_TIMES_MINUTES=(${BUILD_TIMES_SECS}%3600)/60));
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		: $((BUILD_TIMES_SECS=(${BUILD_TIMES_SECS}%3600)%60));
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		if [ -f "${BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
			build_fileop rm ${BUILD_STATUS_IN_PROGRESS_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
	init)	if [ -e ${BUILD_STATUS_IN_PROGRESS_FNAME} ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
			log_msg failexit "Error: another build targeting this architecture and build type is currently in progress.";
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		else
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
			touch ${BUILD_STATUS_IN_PROGRESS_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		if [ -e ${BUILD_LOG_FNAME} ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
			mv -- ${BUILD_LOG_FNAME} ${BUILD_LOG_LAST_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		BUILD_DATE_START="$(date %Y-%m-%d-%H-%M-%S)";
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}};
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		BUILD_TIMES_SECS=$(command date +%s);
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		BUILD_PKGS_FAILED="";
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
	esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
};
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
Lucio Andrés Illanes Albornoz (arab, vxp) 1388c6
# vim:filetype=sh