chiark / gitweb /
adt-run: Fix typo to make "build-needed" work (Closes #637353)
[autopkgtest.git] / virt-subproc / adt-virt-chroot
index 9c96fbae181b273bb6e5f44c7619876fcb9a6d71..e5fa2e3924f7ae915cc2f09d255e9720867f1776 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python2.6
 #
 # adt-virt-chroot is part of autopkgtest
 # autopkgtest is a tool for testing Debian binary packages
@@ -27,9 +27,9 @@ import os
 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 = []
@@ -52,11 +52,24 @@ def parse_args():
 
        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
@@ -67,13 +80,13 @@ def parse_args():
        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