From: Ian Jackson Date: Mon, 25 Jul 2011 10:29:39 +0000 (+0100) Subject: virt-subproc: move making of temp directory into VirtSubproc (if method wants) X-Git-Tag: debian/2.0.0~40 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=264ec5e9df9d20a26cbc4ce2266f2305999af5f2;p=autopkgtest.git virt-subproc: move making of temp directory into VirtSubproc (if method wants) --- diff --git a/virt-subproc/VirtSubproc.py b/virt-subproc/VirtSubproc.py index 5cdf46e..8839fd0 100644 --- a/virt-subproc/VirtSubproc.py +++ b/virt-subproc/VirtSubproc.py @@ -128,6 +128,8 @@ def cmd_open(c, ce): cmdnumargs(c, ce) if downtmp: bomb("`open' when already open") downtmp = caller.hook_open() + if downtmp is None: + downtmp = execute('mktemp -t -d', downp=True, outp=True) debug("down = %s, downtmp = %s" % (string.join(down), downtmp)) return [downtmp] @@ -349,7 +351,10 @@ def cleanup(): debug("cleanup..."); sethandlers(signal.SIG_DFL) cleaning = True - if downtmp: caller.hook_cleanup() + if downtmp: + if not 'revert' in caller.hook_capabilities(): + execute('rm -rf --', [downtmp], downp=True) + caller.hook_cleanup() cleaning = False downtmp = False diff --git a/virt-subproc/adt-virt-chroot b/virt-subproc/adt-virt-chroot index 9c96fba..5d5f56f 100755 --- a/virt-subproc/adt-virt-chroot +++ b/virt-subproc/adt-virt-chroot @@ -69,11 +69,10 @@ def parse_args(): def hook_open(): global downtmp vsp.execute('true', downp=True) - downtmp = vsp.execute('mktemp -t -d', downp=True, outp=True) - return downtmp + return None def hook_cleanup(): - vsp.execute('rm -rf --', [downtmp], downp=True) + pass def hook_forked_inchild(): pass