#!/usr/bin/python2.4 # # adt-run 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 signal import optparse import tempfile import sys import subprocess import traceback import urllib import string import re as regexp import os import errno import fnmatch import shutil import copy from optparse import OptionParser signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing #---------- global variables tmpdir = None # pathstring on host testbed = None # Testbed errorcode = 0 # exit status that we are going to use binaries = None # Binaries (.debs we have registered) #---------- errors we define class Quit: def __init__(q,ec,m): q.ec = ec; q.m = m def bomb(m, se=''): print >>sys.stderr, se raise Quit(20, "unexpected error: %s" % m) def badpkg(m, se=''): print >>sys.stderr, se print 'blame: ', ' '.join(testbed.blamed) raise Quit(12, "erroneous package: %s" % m) def report(tname, result): print '%-20s %s' % (tname, result) class Unsupported: def __init__(u, lno, m): if lno >= 0: u.m = '%s (control line %d)' % (m, lno) else: u.m = m def report(u, tname): global errorcode errorcode != 2 report(tname, 'SKIP %s' % u.m) def debug(m): global opts if not opts.debug: return for l in m.rstrip('\n').split('\n'): print >>sys.stderr, 'atd-run: debug:', l def rmtree(what, pathname): debug('/ %s rmtree %s' % (what, pathname)) shutil.rmtree(pathname) def debug_subprocess(what, cmdl=None, script=None): o = '$ '+what+':' if cmdl is not None: ol = [] for x in cmdl: if x is script: x = '