diff options
author | Richard Purdie <richard@openedhand.com> | 2006-08-30 21:26:07 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-08-30 21:26:07 +0000 |
commit | 27e6638adc8ef10a975d6e853ef7f427ca3e5fbb (patch) | |
tree | 1af57dc014149e26d9659c4b1a26369e6e8c04f1 /bitbake/lib/bb | |
parent | 874a642961a20ef757bb5ed920247b1415e84fed (diff) | |
download | poky-27e6638adc8ef10a975d6e853ef7f427ca3e5fbb.tar.gz |
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
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/build.py | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index b59473bc23..8e169e002a 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -148,6 +148,7 @@ def exec_func_shell(func, d): | |||
148 | 148 | ||
149 | deps = data.getVarFlag(func, 'deps', d) | 149 | deps = data.getVarFlag(func, 'deps', d) |
150 | check = data.getVarFlag(func, 'check', d) | 150 | check = data.getVarFlag(func, 'check', d) |
151 | interact = data.getVarFlag(func, 'interactive', d) | ||
151 | if check in globals(): | 152 | if check in globals(): |
152 | if globals()[check](func, deps): | 153 | if globals()[check](func, deps): |
153 | return | 154 | return |
@@ -186,15 +187,16 @@ def exec_func_shell(func, d): | |||
186 | 187 | ||
187 | se = so | 188 | se = so |
188 | 189 | ||
189 | # dup the existing fds so we dont lose them | 190 | if not interact: |
190 | osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] | 191 | # dup the existing fds so we dont lose them |
191 | oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] | 192 | osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] |
192 | ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] | 193 | oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] |
194 | ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] | ||
193 | 195 | ||
194 | # replace those fds with our own | 196 | # replace those fds with our own |
195 | os.dup2(si.fileno(), osi[1]) | 197 | os.dup2(si.fileno(), osi[1]) |
196 | os.dup2(so.fileno(), oso[1]) | 198 | os.dup2(so.fileno(), oso[1]) |
197 | os.dup2(se.fileno(), ose[1]) | 199 | os.dup2(se.fileno(), ose[1]) |
198 | 200 | ||
199 | # execute function | 201 | # execute function |
200 | prevdir = os.getcwd() | 202 | prevdir = os.getcwd() |
@@ -205,20 +207,21 @@ def exec_func_shell(func, d): | |||
205 | ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile)) | 207 | ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile)) |
206 | os.chdir(prevdir) | 208 | os.chdir(prevdir) |
207 | 209 | ||
208 | # restore the backups | 210 | if not interact: |
209 | os.dup2(osi[0], osi[1]) | 211 | # restore the backups |
210 | os.dup2(oso[0], oso[1]) | 212 | os.dup2(osi[0], osi[1]) |
211 | os.dup2(ose[0], ose[1]) | 213 | os.dup2(oso[0], oso[1]) |
214 | os.dup2(ose[0], ose[1]) | ||
212 | 215 | ||
213 | # close our logs | 216 | # close our logs |
214 | si.close() | 217 | si.close() |
215 | so.close() | 218 | so.close() |
216 | se.close() | 219 | se.close() |
217 | 220 | ||
218 | # close the backup fds | 221 | # close the backup fds |
219 | os.close(osi[0]) | 222 | os.close(osi[0]) |
220 | os.close(oso[0]) | 223 | os.close(oso[0]) |
221 | os.close(ose[0]) | 224 | os.close(ose[0]) |
222 | 225 | ||
223 | if ret==0: | 226 | if ret==0: |
224 | if bb.debug_level > 0: | 227 | if bb.debug_level > 0: |
@@ -350,7 +353,12 @@ def mkstamp(task, d): | |||
350 | return | 353 | return |
351 | stamp = "%s.%s" % (data.expand(stamp, d), task) | 354 | stamp = "%s.%s" % (data.expand(stamp, d), task) |
352 | mkdirhier(os.path.dirname(stamp)) | 355 | mkdirhier(os.path.dirname(stamp)) |
353 | open(stamp, "w+") | 356 | # Remove the file and recreate to force timestamp |
357 | # change on broken NFS filesystems | ||
358 | if os.access(stamp, os.F_OK): | ||
359 | os.remove(stamp) | ||
360 | f = open(stamp, "w") | ||
361 | f.close() | ||
354 | 362 | ||
355 | 363 | ||
356 | def add_task(task, deps, d): | 364 | def add_task(task, deps, d): |