From b425dae063d75919bea4be8cd83305490779dcb1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 13 Oct 2006 18:58:40 +0100 Subject: [PATCH] WIP adt-virt-xenlvm --- Makefile | 5 +- debian/changelog | 3 +- {virt-chroot => virt-subproc}/VirtSubproc.py | 0 {virt-chroot => virt-subproc}/adt-virt-chroot | 0 .../adt-virt-chroot.1 | 0 virt-subproc/adt-virt-xenlvm | 76 +++++++++++++++++++ 6 files changed, 81 insertions(+), 3 deletions(-) rename {virt-chroot => virt-subproc}/VirtSubproc.py (100%) rename {virt-chroot => virt-subproc}/adt-virt-chroot (100%) rename {virt-chroot => virt-subproc}/adt-virt-chroot.1 (100%) create mode 100755 virt-subproc/adt-virt-xenlvm diff --git a/Makefile b/Makefile index c9f0a22..bec1576 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,11 @@ include settings.make -programs = virt-chroot/adt-virt-chroot \ +programs = virt-subproc/adt-virt-chroot \ + virt-subproc/adt-virt-xenlvm \ runner/adt-run -pythonfiles = virt-chroot/VirtSubproc.py +pythonfiles = virt-subproc/VirtSubproc.py all: cd xen && $(MAKE) diff --git a/debian/changelog b/debian/changelog index 838f543..d87f0c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,9 @@ autopkgtest (0.6.2~iwj) unstable; urgency=low for adt-virt-xenlvm. * Concatenate arguments to dchroot et al, to stop them looking inside the args and getting confused. + * New adt-virt-xenlvm WIP - -- Ian Jackson Thu, 12 Oct 2006 19:18:40 +0100 + -- autopkgtest (0.6.1) edgy; urgency=low diff --git a/virt-chroot/VirtSubproc.py b/virt-subproc/VirtSubproc.py similarity index 100% rename from virt-chroot/VirtSubproc.py rename to virt-subproc/VirtSubproc.py diff --git a/virt-chroot/adt-virt-chroot b/virt-subproc/adt-virt-chroot similarity index 100% rename from virt-chroot/adt-virt-chroot rename to virt-subproc/adt-virt-chroot diff --git a/virt-chroot/adt-virt-chroot.1 b/virt-subproc/adt-virt-chroot.1 similarity index 100% rename from virt-chroot/adt-virt-chroot.1 rename to virt-subproc/adt-virt-chroot.1 diff --git a/virt-subproc/adt-virt-xenlvm b/virt-subproc/adt-virt-xenlvm new file mode 100755 index 0000000..40e7afa --- /dev/null +++ b/virt-subproc/adt-virt-xenlvm @@ -0,0 +1,76 @@ +#!/usr/bin/python2.4 +# +# adt-virt-xenlvm is part of autopkgtest +# autopkgtest is a tool for testing Debian binary packages +# +# autopkgtest is Copyright (C) 2006 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 sys +import os + +try: our_base = os.environ['AUTOPKGTEST_BASE'] +except KeyError: our_base = '/usr/share/autopkgtest'; +sys.path.insert(1, our_base+'/python') + +import string +from optparse import OptionParser +import VirtSubproc as vsp + +def parse_args(): + global down, debuglevel + + usage = "%prog []" + + + + + (opts,args) = parser.parse_args() + if len(args) != 1: pe("need exactly one arg, xenlvm specification") + + vsp.debuglevel = opts.debug + + xenlvm_arg = args[0] + if not xenlvm_arg: pe("xenlvm specification may not be empty") + if xenlvm_arg == '=': down = ['dxenlvm','-q'] + elif xenlvm_arg == '=': down = ['dxenlvm','-q'] + elif xenlvm_arg[0] == '=': down = ['dxenlvm','-q','-c',xenlvm_arg[1:]] + elif xenlvm_arg[0] == '/': down = ['xenlvm',xenlvm_arg,'--'] + else: pe("xenlvm spec must be =[DXENLVM] or /PATH/TO/XENLVM") + + if opts.gain_root != None: down = opts.gain_root.split() + down + + vsp.debug("down = %s" % string.join(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 + +def hook_stop(): + vsp.execute('rm -rf --', c[1:2]) + os.mkdir(c[1]) + +def hook_cleanup(): + vsp.execute('rm -rf --', [downtmp], downp=True) + +parse_args() +vsp.main() -- 2.30.2