@@ -24,14 +24,33 @@ build_log=build-$(git rev-parse --short=7 HEAD)-$(date '+%Y-%m-%dT%H-%M-%S').log
2424exec & > >( tee -a $build_log )
2525
2626# Bail out if sources are already there
27- if [ -d pytorch ] || [ -d builder ] || [ -d ComputeLibrary ] ; then
28- echo " You appear to have sources already (pytorch/builder/ComputeLibrary)" \
27+ if [ -f .torch_build_container_id ] || [ -f .torch_ao_build_container_id ] || \
28+ [ -d ao ] || [ -d ComputeLibrary ] || [ -d pytorch ]; then
29+ printf " \n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n\n" \
30+ " You appear to have artefacts from a previous build lying around." \
31+ " Check for any of the following:" \
32+ " - .torch_build_container_id" \
33+ " - .torch_ao_build_container_id" \
34+ " - ao" \
35+ " - ComputeLibrary" \
36+ " - pytorch"
2937
30- if ! ([[ $* == * --force* ]] || [[ $* == * --use-existing-sources* ]]) ; then
31- >&2 echo " rerun with --force to overwrite sources or with" \
32- " --use-existing-sources to build your existing sources."
38+ if [[ " $* " != * --fresh* ]] && [[ " $* " != * --use-existing-sources* ]]; then
39+ >&2 printf " \n\n%s\n%s\n%s\n\n\n" \
40+ " Rerun with one of the following options:" \
41+ " - '--fresh': wipe the pre-existing sources and do a fresh build" \
42+ " - '--use-existing-sources': reuse the sources as is"
3343 exit 1
3444 fi
45+
46+ # Wipe old build artefacts
47+ if [[ $* == * --fresh* ]]; then
48+ if [ -f .torch_build_container_id ]; then rm -f .torch_build_container_id; fi
49+ if [ -f .torch_ao_build_container_id ]; then rm -f .torch_ao_build_container_id; fi
50+ if [ -d ao ]; then rm -rf ao; fi
51+ if [ -d ComputeLibrary ]; then rm -rf ComputeLibrary; fi
52+ if [ -d pytorch ]; then rm -rf pytorch; fi
53+ fi
3554fi
3655
3756if ! [[ $* == * --use-existing-sources* ]]; then
0 commit comments