chiark / gitweb /
python libs: new Autopkgtest.py module
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Jul 2011 14:34:24 +0000 (15:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Jul 2011 14:34:24 +0000 (15:34 +0100)
- This makes shellscript quoting available to adt-run too
- Python modules moved to lib/ directory
- AUTOPKGTEST_BASE semantics have changed slightly

Makefile
lib/Autopkgtest.py [new file with mode: 0644]
lib/VirtSubproc.py
runner/adt-run
virt-subproc/adt-virt-chroot
virt-subproc/adt-virt-null
virt-subproc/adt-virt-schroot
virt-subproc/adt-virt-xenlvm

index 75de23dc2ab7d5d35b1ec61e80a47c4bfba26a15..f346c6f6900b02d80edea6db279ea89af1b1ad02 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,8 @@ programs =    virt-subproc/adt-virt-chroot \
 examples =     runner/onepackage-config \
                runner/ubuntu-config
 
-pythonfiles =  virt-subproc/VirtSubproc.py
+pythonfiles =  lib/Autopkgtest.py \
+               lib/VirtSubproc.py
 
 all:
        cd xen && $(MAKE)
diff --git a/lib/Autopkgtest.py b/lib/Autopkgtest.py
new file mode 100644 (file)
index 0000000..59465e6
--- /dev/null
@@ -0,0 +1,28 @@
+# Autopkgtest is part of autopkgtest
+# autopkgtest is a tool for testing Debian binary packages
+#
+# autopkgtest is Copyright (C) 2006-2007 Canonical Ltd.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# See the file CREDITS for a full list of credits information (often
+# installed as /usr/share/doc/autopkgtest/CREDITS).
+
+import re as regexp
+
+_shellquote_re = regexp.compile("'")
+def shellquote_arg(s): return "'" + _shellquote_re.sub(r"'\''", s) + "'"
+def shellquote_cmdl(l): return ' '.join(map(shellquote_arg,l))
+
index f1f735d723005b4bc70daca0c7657c1c1b29b445..07ae4a594378c0056f83245ac9d3d504d0a35e7f 100644 (file)
@@ -32,6 +32,8 @@ import traceback
 import errno
 import re as regexp
 
+from Autopkgtest import *
+
 debuglevel = None
 progname = "<VirtSubproc>"
 devnull_read = file('/dev/null','r')
index 0c4a12d4c5477bbd504152a2464dbce3c6a47e2b..27b33a98f47061c63b433edc0565691999606419 100755 (executable)
@@ -40,6 +40,12 @@ import copy
 from optparse import OptionParser
 signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing
 
+try: our_base = os.environ['AUTOPKGTEST_BASE']+'/lib'
+except KeyError: our_base = '/usr/share/autopkgtest/python';
+sys.path.insert(1, our_base)
+
+from Autopkgtest import *
+
 #---------- global variables
 
 tmpdir = None          # pathstring on host
@@ -782,10 +788,6 @@ class Testbed:
        if len(pec) < 1: tb.bomb('too few results from print-execute-command')
        cmdl = map(urllib.unquote, pec[0].split(','))
 
-       shellquote_re = regexp.compile('"')
-       def shellquote_arg(s): return "'" + shellquote_re.sub(r"'\''", s) + "'"
-       def shellquote_cmdl(l): return ' '.join(map(shellquote_arg,l))
-
        tb._debug('cmdl = %s' % (`cmdl`))
 
        tb.ec_auxverbscript = TemporaryFile('satdep-auxverb')
index b722153d2d26febd0a4644c47dde6927d8f64a72..7c1b0d9ac79dc373553a97850f002963accc3029 100755 (executable)
@@ -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 = []
index 10b6b8602d286495c73910ae1d5b7e22936de08f..761d13f3de162dc648ac4f00166a88f8ba86c659 100755 (executable)
@@ -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 = []
index cb7477ddfd433566c2b9d749a1da6e9d06e8a3d7..d0473b610059be5137150276c47087600b0a4de3 100755 (executable)
@@ -30,9 +30,9 @@ import grp
 import pwd
 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 = []
index e82a35b1d2dbaf485903652ebdb787190c5fd731..7a7ced1808b29f65c6a96eacf6a5b8177fdeb8df 100755 (executable)
@@ -31,9 +31,9 @@ import fnmatch
 import signal
 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