summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-11-21 18:17:35 +0000
committerLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-11-21 18:17:35 +0000
commit1388c69bdcd0480023505b14ed45679cea076c43 (patch)
tree89ef152603367d10a2014508295650e947568c20 /subr
parent3e19f0e4390e26376c130fafb3b0b910f10c4c63 (diff)
downloadmidipix_build-1388c69bdcd0480023505b14ed45679cea076c43.tar.bz2
midipix_build-1388c69bdcd0480023505b14ed45679cea076c43.tar.xz
build.sh, subr/{build,pre_state}.subr: split.
Diffstat (limited to 'subr')
-rw-r--r--subr/build.subr25
-rw-r--r--subr/pre_state.subr31
2 files changed, 31 insertions, 25 deletions
diff --git a/subr/build.subr b/subr/build.subr
index b7341632..526d9f25 100644
--- a/subr/build.subr
+++ b/subr/build.subr
@@ -47,30 +47,6 @@ build_fileop() {
fi;
};
-build_files_fini() {
- : $((BUILD_TIMES_SECS=$(command date +%s)-${BUILD_TIMES_SECS}));
- : $((BUILD_TIMES_HOURS=${BUILD_TIMES_SECS}/3600));
- : $((BUILD_TIMES_MINUTES=(${BUILD_TIMES_SECS}%3600)/60));
- : $((BUILD_TIMES_SECS=(${BUILD_TIMES_SECS}%3600)%60));
- if [ -f "${BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
- build_fileop rm ${BUILD_STATUS_IN_PROGRESS_FNAME};
- fi;
-};
-build_files_init() {
- if [ -e ${BUILD_STATUS_IN_PROGRESS_FNAME} ]; then
- log_msg failexit "Error: another build targeting this architecture and build type is currently in progress.";
- else
- touch ${BUILD_STATUS_IN_PROGRESS_FNAME};
- fi;
- if [ -e ${BUILD_LOG_FNAME} ]; then
- mv -- ${BUILD_LOG_FNAME} ${BUILD_LOG_LAST_FNAME};
- fi;
- BUILD_DATE_START="$(date %Y-%m-%d-%H-%M-%S)";
- BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}};
- BUILD_TIMES_SECS=$(command date +%s);
- BUILD_PKGS_FAILED="";
-};
-
is_build_script_done() {
local _done_fname="${WORKDIR}/.${1}.${2}" _restart_at="${3}";
if [ -z "${_restart_at}" ]; then
@@ -87,7 +63,6 @@ is_build_script_done() {
return 0; # Skip
fi;
};
-
set_build_script_done() {
local _pkg_fname="${1}";
local _done_fname_pfx="${WORKDIR}/.${_pkg_fname}";
diff --git a/subr/pre_state.subr b/subr/pre_state.subr
new file mode 100644
index 00000000..58bfc59a
--- /dev/null
+++ b/subr/pre_state.subr
@@ -0,0 +1,31 @@
+#
+# set -o errexit -o noglob are assumed.
+#
+
+pre_state() {
+ case "${1}" in
+ fini) : $((BUILD_TIMES_SECS=$(command date +%s)-${BUILD_TIMES_SECS}));
+ : $((BUILD_TIMES_HOURS=${BUILD_TIMES_SECS}/3600));
+ : $((BUILD_TIMES_MINUTES=(${BUILD_TIMES_SECS}%3600)/60));
+ : $((BUILD_TIMES_SECS=(${BUILD_TIMES_SECS}%3600)%60));
+ if [ -f "${BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
+ build_fileop rm ${BUILD_STATUS_IN_PROGRESS_FNAME};
+ fi;
+ ;;
+ init) if [ -e ${BUILD_STATUS_IN_PROGRESS_FNAME} ]; then
+ log_msg failexit "Error: another build targeting this architecture and build type is currently in progress.";
+ else
+ touch ${BUILD_STATUS_IN_PROGRESS_FNAME};
+ fi;
+ if [ -e ${BUILD_LOG_FNAME} ]; then
+ mv -- ${BUILD_LOG_FNAME} ${BUILD_LOG_LAST_FNAME};
+ fi;
+ BUILD_DATE_START="$(date %Y-%m-%d-%H-%M-%S)";
+ BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}};
+ BUILD_TIMES_SECS=$(command date +%s);
+ BUILD_PKGS_FAILED="";
+ ;;
+ esac;
+};
+
+# vim:filetype=sh