Print a useful message and exit when the .redo directory disappears.

This commit is contained in:
Avery Pennarun 2010-11-22 03:34:37 -08:00
commit dce0076554
2 changed files with 17 additions and 1 deletions

View file

@ -153,6 +153,9 @@ def main(targets, shouldbuildfunc):
jwack.get_token(t) jwack.get_token(t)
if retcode[0] and not vars.KEEP_GOING: if retcode[0] and not vars.KEEP_GOING:
break break
if not state.is_sane():
retcode[0] = 205
break
lock = state.Lock(t) lock = state.Lock(t)
lock.trylock() lock.trylock()
if not lock.owned: if not lock.owned:
@ -173,6 +176,9 @@ def main(targets, shouldbuildfunc):
if retcode[0] and not vars.KEEP_GOING: if retcode[0] and not vars.KEEP_GOING:
break break
if locked: if locked:
if not state.is_sane():
retcode[0] = 205
break
t = locked.pop(0) t = locked.pop(0)
lock = state.Lock(t) lock = state.Lock(t)
lock.waitlock() lock.waitlock()

View file

@ -1,6 +1,6 @@
import sys, os, errno, glob import sys, os, errno, glob
import vars import vars
from helpers import unlink, debug2, mkdirp, close_on_exec from helpers import unlink, err, debug2, mkdirp, close_on_exec
def init(): def init():
@ -17,6 +17,16 @@ def init():
os.unlink(f) os.unlink(f)
_insane = None
def is_sane():
global _insane
if not _insane:
_insane = not os.path.exists('%s/.redo' % vars.BASE)
if _insane:
err('.redo directory disappeared; cannot continue.\n')
return not _insane
def relpath(t, base): def relpath(t, base):
t = os.path.normpath(os.path.join(os.getcwd(), t)) t = os.path.normpath(os.path.join(os.getcwd(), t))
tparts = t.split('/') tparts = t.split('/')