From f1de814df5ff7649268c5684d85f6679ac2be049 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Fri, 19 Feb 2021 00:23:40 +0000 Subject: [PATCH 1/3] clang: Support rbm checkpointing --- projects/clang/build | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/clang/build b/projects/clang/build index 05a93dc..0c78780 100644 --- a/projects/clang/build +++ b/projects/clang/build @@ -2,6 +2,13 @@ [% c("var/set_default_env") -%] distdir=/var/tmp/dist/[% project %] mkdir -p /var/tmp/dist + +if [[ -e /var/tmp/dist/checkpoint1 ]] ; then + set +e + source /var/tmp/dist/checkpoint1 + set -e +else + tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %] export PATH="/var/tmp/dist/cmake/bin:$PATH" [% IF c("var/linux") || c("var/android") %] @@ -37,6 +44,12 @@ cd build [% IF c("var/rlbox") -%]-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \[% END -%] -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;lld" [% END -%] + +set > /var/tmp/dist/checkpoint1 +export -p >> /var/tmp/dist/checkpoint1 +fi + +cd /var/tmp/build/clang-source/build make -j[% c("buildconf/num_procs") %] make install cd /var/tmp/dist -- 2.20.1 From 68a55e0dc82875550eb78d17683c0eb582c22c23 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Sat, 20 Feb 2021 08:51:15 +0000 Subject: [PATCH 2/3] macosx-toolchain: Support rbm checkpointing --- projects/macosx-toolchain/build | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/projects/macosx-toolchain/build b/projects/macosx-toolchain/build index 5716a9e..94f6df1 100644 --- a/projects/macosx-toolchain/build +++ b/projects/macosx-toolchain/build @@ -1,5 +1,12 @@ #!/bin/bash [% c("var/set_default_env") -%] + +if [[ -e /var/tmp/dist/checkpoint1 ]] ; then + set +e + source /var/tmp/dist/checkpoint1 + set -e +else + builddir=/var/tmp/build mkdir $builddir distdir=/var/tmp/dist/[% project %] @@ -65,6 +72,12 @@ cmake -GNinja \ -DDARWIN_osx_ARCHS=x86_64 \ -DDARWIN_osx_SYSROOT=$sysrootdir \ -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin $builddir/clang-source + +set > /var/tmp/dist/checkpoint1 +export -p >> /var/tmp/dist/checkpoint1 +fi + +cd $builddir/clang-source/build ninja install -v # We now have a native macosx64 toolchain. -- 2.20.1 From 54af5c1fd0c1bb6268ff6d8e0d2755fc9d96966a Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Mon, 22 Mar 2021 17:19:12 +0000 Subject: [PATCH 3/3] rbm.conf: Support rbm checkpointing --- rbm.conf | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/rbm.conf b/rbm.conf index a7023f2..18d8f78 100644 --- a/rbm.conf +++ b/rbm.conf @@ -509,6 +509,18 @@ container: remote_start: | #!/bin/sh set -e + + # Handle SIGINT case + if [ -d '[% c("rbm_tmp_dir") %]'/../interrupted_dirs/'[% sha256(dest_dir _ '/' _ c("filename")) %]' ] + then + # We previously did this build but it was manually interrupted. + # Restore the container's saved state instead of making a new container. + mkdir -p '[% c("var/container/dir") %]' + rmdir '[% c("var/container/dir") %]' + mv '[% c("rbm_tmp_dir") %]'/../interrupted_dirs/'[% sha256(dest_dir _ '/' _ c("filename")) %]' '[% c("var/container/dir") %]' + exit + fi + if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ] then echo "Can't find container image in input files" >&2 @@ -568,6 +580,19 @@ container: remote_finish: | #!/bin/sh set -e + + # Handle SIGINT case + if [ -e '[% c("rbm_tmp_dir") %]'/../interrupted ] + then + # This build was manually interrupted via tools/container-interrupt.sh. + # Save the container's state instead of deleting, so we can resume + # the build later. + mkdir -p '[% c("rbm_tmp_dir") %]'/../interrupted_dirs + mv '[% c("var/container/dir") %]' '[% c("rbm_tmp_dir") %]'/../interrupted_dirs/'[% sha256(dest_dir _ '/' _ c("filename")) %]' + rm '[% c("rbm_tmp_dir") %]'/../interrupted + exit + fi + [% c("rbmdir") %]/container remove '[% c("var/container/dir") %]' ENV: -- 2.20.1