bitbake build.py: Add interactive flag for tasks to allow i/o redirection to be disabled. Also fix NFS stamp error
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@681 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
parent
874a642961
commit
27e6638adc
|
@ -148,6 +148,7 @@ def exec_func_shell(func, d):
|
||||||
|
|
||||||
deps = data.getVarFlag(func, 'deps', d)
|
deps = data.getVarFlag(func, 'deps', d)
|
||||||
check = data.getVarFlag(func, 'check', d)
|
check = data.getVarFlag(func, 'check', d)
|
||||||
|
interact = data.getVarFlag(func, 'interactive', d)
|
||||||
if check in globals():
|
if check in globals():
|
||||||
if globals()[check](func, deps):
|
if globals()[check](func, deps):
|
||||||
return
|
return
|
||||||
|
@ -186,15 +187,16 @@ def exec_func_shell(func, d):
|
||||||
|
|
||||||
se = so
|
se = so
|
||||||
|
|
||||||
# dup the existing fds so we dont lose them
|
if not interact:
|
||||||
osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()]
|
# dup the existing fds so we dont lose them
|
||||||
oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()]
|
osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()]
|
||||||
ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()]
|
oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()]
|
||||||
|
ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()]
|
||||||
|
|
||||||
# replace those fds with our own
|
# replace those fds with our own
|
||||||
os.dup2(si.fileno(), osi[1])
|
os.dup2(si.fileno(), osi[1])
|
||||||
os.dup2(so.fileno(), oso[1])
|
os.dup2(so.fileno(), oso[1])
|
||||||
os.dup2(se.fileno(), ose[1])
|
os.dup2(se.fileno(), ose[1])
|
||||||
|
|
||||||
# execute function
|
# execute function
|
||||||
prevdir = os.getcwd()
|
prevdir = os.getcwd()
|
||||||
|
@ -205,20 +207,21 @@ def exec_func_shell(func, d):
|
||||||
ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile))
|
ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile))
|
||||||
os.chdir(prevdir)
|
os.chdir(prevdir)
|
||||||
|
|
||||||
# restore the backups
|
if not interact:
|
||||||
os.dup2(osi[0], osi[1])
|
# restore the backups
|
||||||
os.dup2(oso[0], oso[1])
|
os.dup2(osi[0], osi[1])
|
||||||
os.dup2(ose[0], ose[1])
|
os.dup2(oso[0], oso[1])
|
||||||
|
os.dup2(ose[0], ose[1])
|
||||||
|
|
||||||
# close our logs
|
# close our logs
|
||||||
si.close()
|
si.close()
|
||||||
so.close()
|
so.close()
|
||||||
se.close()
|
se.close()
|
||||||
|
|
||||||
# close the backup fds
|
# close the backup fds
|
||||||
os.close(osi[0])
|
os.close(osi[0])
|
||||||
os.close(oso[0])
|
os.close(oso[0])
|
||||||
os.close(ose[0])
|
os.close(ose[0])
|
||||||
|
|
||||||
if ret==0:
|
if ret==0:
|
||||||
if bb.debug_level > 0:
|
if bb.debug_level > 0:
|
||||||
|
@ -350,7 +353,12 @@ def mkstamp(task, d):
|
||||||
return
|
return
|
||||||
stamp = "%s.%s" % (data.expand(stamp, d), task)
|
stamp = "%s.%s" % (data.expand(stamp, d), task)
|
||||||
mkdirhier(os.path.dirname(stamp))
|
mkdirhier(os.path.dirname(stamp))
|
||||||
open(stamp, "w+")
|
# Remove the file and recreate to force timestamp
|
||||||
|
# change on broken NFS filesystems
|
||||||
|
if os.access(stamp, os.F_OK):
|
||||||
|
os.remove(stamp)
|
||||||
|
f = open(stamp, "w")
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def add_task(task, deps, d):
|
def add_task(task, deps, d):
|
||||||
|
|
Loading…
Reference in New Issue