From 7615eb8d3fa12388aec0e9de1423939053c6b07a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lallement Date: Tue, 29 Oct 2013 18:09:21 +0100 Subject: [PATCH] * Remove packages from the request file that are not valid for testing i.e excuse.run_autopkgtest = False. --- autopkgtest.py | 21 ++++++++++++++++++++- britney.py | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/autopkgtest.py b/autopkgtest.py index a8416e3..0db5b0e 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -128,7 +128,10 @@ class AutoPackageTest(object): command.extend(args) subprocess.check_call(command) - def request(self, packages): + def request(self, packages, excludes=None): + if excludes is None: + excludes = [] + self._ensure_rc_file() request_path = self._request_path if os.path.exists(request_path): @@ -140,6 +143,22 @@ class AutoPackageTest(object): print("%s %s" % (src, ver), file=request_file) request_file.flush() self._adt_britney("request", "-O", request_path, request_file.name) + + # Remove packages that have been identified as invalid candidates for + # testing from the request file i.e run_autopkgtest = False + with open(request_path, 'r') as request_file: + lines = request_file.readlines() + with open(request_path, 'w') as request_file: + for line in lines: + src = line.split()[0] + if not src in excludes: + request_file.write(line) + else: + if self.britney.options.verbose: + print("I: [%s] - Requested autopkgtest for %s but " + "run_autopkgtest set to False" % + (time.asctime(), src)) + for linebits in self._parse(request_path): # Make sure that there's an entry in pkgcauses for each new # request, so that results() gives useful information without diff --git a/britney.py b/britney.py index 890a988..85ba029 100755 --- a/britney.py +++ b/britney.py @@ -1684,8 +1684,10 @@ class Britney(object): self, self.options.adt_series, debug=adt_debug) autopkgtest_packages = [] autopkgtest_excuses = [] + autopkgtest_excludes = [] for e in self.excuses: if not e.run_autopkgtest: + autopkgtest_excludes.append(e.name) continue # skip removals, binary-only candidates, and proposed-updates if e.name.startswith("-") or "/" in e.name or "_" in e.name: @@ -1694,7 +1696,7 @@ class Britney(object): continue autopkgtest_excuses.append(e) autopkgtest_packages.append((e.name, e.ver[1])) - autopkgtest.request(autopkgtest_packages) + autopkgtest.request(autopkgtest_packages, autopkgtest_excludes) if not self.options.dry_run: autopkgtest.submit() autopkgtest.collect()