-#!/usr/bin/python2.4
+#!/usr/bin/python2.6
#
# adt-virt-chroot is part of autopkgtest
# autopkgtest is a tool for testing Debian binary packages
import string
from optparse import OptionParser
-try: our_base = os.environ['AUTOPKGTEST_BASE']
-except KeyError: our_base = '/usr/share/autopkgtest';
-sys.path.insert(1, our_base+'/python')
+try: our_base = os.environ['AUTOPKGTEST_BASE']+'/lib'
+except KeyError: our_base = '/usr/share/autopkgtest/python';
+sys.path.insert(1, our_base)
import VirtSubproc as vsp
capabilities = []
chroot_arg = args[0]
if not chroot_arg: pe("chroot specification may not be empty")
- if chroot_arg == '=': down = ['dchroot','-q']
- elif chroot_arg == '=': down = ['dchroot','-q']
- elif chroot_arg[0] == '=': down = ['dchroot','-q','-c',chroot_arg[1:]]
- elif chroot_arg[0] == '/': down = ['chroot',chroot_arg,'--']
- else: pe("chroot spec must be =[DCHROOT] or /PATH/TO/CHROOT")
+ if chroot_arg == '=':
+ down = ['dchroot','-q','--']
+ elif chroot_arg == '=':
+ down = ['dchroot','-q','--']
+ elif chroot_arg[0] == '=':
+ down = ['dchroot','-q','-c',chroot_arg[1:],'--']
+ elif chroot_arg[0] == '/':
+ down = ['chroot',chroot_arg]
+ else:
+ pe("chroot spec must be =[DCHROOT] or /PATH/TO/CHROOT")
+
+ if down[0] == 'chroot':
+ vsp.downkind = 'auxverb'
+ elif down[0] == 'dchroot':
+ vsp.downkind = 'shstring'
+ else:
+ print >>sys.stderr, 'down[0]=%s' % `down[0]`
+ assert(False)
if opts.gain_root != None:
down = opts.gain_root.split() + down
vsp.down = down
def hook_open():
- global downtmp
- vsp.execute('true', downp=True)
- downtmp = vsp.execute('mktemp -t -d', downp=True, outp=True)
- return downtmp
+ pass
+
+def hook_downtmp():
+ return vsp.downtmp_mktemp()
def hook_cleanup():
- vsp.execute('rm -rf --', [downtmp], downp=True)
+ vsp.downtmp_remove()
def hook_forked_inchild():
pass