diff --git a/redo-ifchange.py b/redo-ifchange.py index 0e7d79c..d0e9472 100755 --- a/redo-ifchange.py +++ b/redo-ifchange.py @@ -46,7 +46,6 @@ if not vars.TARGET: try: want_build = [] for t in sys.argv[1:]: - mkdirp('%s/.redo' % vars.BASE) state.add_dep(vars.TARGET, 'm', t) if dirty_deps(t, depth = ''): want_build.append(t) diff --git a/redo-ifcreate.py b/redo-ifcreate.py index 2bd8cd1..160fff5 100755 --- a/redo-ifcreate.py +++ b/redo-ifcreate.py @@ -10,7 +10,6 @@ if not vars.TARGET: try: for t in sys.argv[1:]: - mkdirp('%s/.redo' % vars.BASE) if os.path.exists(t): err('redo-ifcreate: error: %r already exists\n' % t) sys.exit(1) diff --git a/redo.py b/redo.py index 0fcdcaf..2092a99 100755 --- a/redo.py +++ b/redo.py @@ -22,7 +22,9 @@ if opt.verbose: if opt.shuffle: os.environ['REDO_SHUFFLE'] = '1' +is_root = False if not os.environ.get('REDO_BASE', ''): + is_root = True base = os.path.commonprefix([os.path.abspath(os.path.dirname(t)) for t in targets] + [os.getcwd()]) bsplit = base.split('/') @@ -35,18 +37,21 @@ if not os.environ.get('REDO_BASE', ''): os.environ['REDO_STARTDIR'] = os.getcwd() os.environ['REDO'] = os.path.abspath(sys.argv[0]) + +import vars, state +from helpers import * + + +if is_root: # FIXME: just wiping out all the locks is kind of cheating. But we # only do this from the toplevel redo process, so unless the user # deliberately starts more than one redo on the same repository, it's # sort of ok. + mkdirp('%s/.redo' % base) for f in glob.glob('%s/.redo/lock^*' % base): os.unlink(f) -import vars, state -from helpers import * - - class BuildError(Exception): pass class BuildLocked(Exception): @@ -139,7 +144,6 @@ def _build(t): def build(t): - mkdirp('%s/.redo' % vars.BASE) lock = state.Lock(t) lock.lock() if not lock.owned: