Fix more trouble with .do scripts that cd to other directories.
The interaction of REDO_STARTDIR, REDO_PWD, and getcwd() are pretty complicated. In this case, we accidentally assumed that the current instance of redo was running with getcwd() == REDO_STARTDIR+REDO_PWD, and so the new target was REDO_STARTDIR+REDO_PWD+t, but this isn't the case if the current .do script did chdir(). The correct answer is REDO_STARTDIR+getcwd()+t.
This commit is contained in:
parent
f3413c0f7c
commit
c29de89051
4 changed files with 22 additions and 12 deletions
14
state.py
14
state.py
|
|
@ -1,6 +1,6 @@
|
|||
import sys, os, errno, glob
|
||||
import vars
|
||||
from helpers import unlink, err, debug2, mkdirp, close_on_exec
|
||||
from helpers import unlink, err, debug2, debug3, mkdirp, close_on_exec
|
||||
|
||||
|
||||
def init():
|
||||
|
|
@ -50,15 +50,17 @@ def _sname(typ, t):
|
|||
# FIXME: t.replace(...) is non-reversible and non-unique here!
|
||||
tnew = relpath(t, vars.BASE)
|
||||
v = vars.BASE + ('/.redo/%s^%s' % (typ, tnew.replace('/', '^')))
|
||||
if vars.DEBUG >= 2:
|
||||
debug2('sname: (%r) %r -> %r\n' % (os.getcwd(), t, tnew))
|
||||
if vars.DEBUG >= 3:
|
||||
debug3('sname: (%r) %r -> %r\n' % (os.getcwd(), t, tnew))
|
||||
return v
|
||||
|
||||
|
||||
def add_dep(t, mode, dep):
|
||||
debug2('add-dep(%r)\n' % t)
|
||||
open(_sname('dep', t), 'a').write('%s %s\n'
|
||||
% (mode, relpath(dep, vars.BASE)))
|
||||
sn = _sname('dep', t)
|
||||
reldep = relpath(dep, vars.BASE)
|
||||
debug2('add-dep: %r < %s %r\n' % (sn, mode, reldep))
|
||||
|
||||
open(sn, 'a').write('%s %s\n' % (mode, reldep))
|
||||
|
||||
|
||||
def deps(t):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue