From 6e701a09cd6ad98a6f7151872b24a44e1f27b9ce Mon Sep 17 00:00:00 2001 From: Cyril Brulebois Date: Mon, 5 Mar 2012 11:53:46 +0000 Subject: [PATCH] britney: Print the current package to stderr when AIEEEing. Signed-off-by: Cyril Brulebois --- britney.py | 14 ++++++++++---- lib/britney-py.c | 5 +++-- lib/dpkg.c | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/britney.py b/britney.py index 604e7ab..b2c55ef 100755 --- a/britney.py +++ b/britney.py @@ -2093,7 +2093,7 @@ class Britney(object): nuninst_arch = None if not (skip_archall and binaries[arch][0][p][ARCHITECTURE] == 'all'): nuninst_arch = nuninst[arch] - self._installability_test(systems[arch], p, broken, to_check, nuninst_arch) + self._installability_test(systems[arch], p, broken, to_check, nuninst_arch, pkg) # broken packages (second round, reverse dependencies of the first round) while to_check: @@ -2105,7 +2105,7 @@ class Britney(object): nuninst_arch = None if not (skip_archall and binaries[arch][0][p][ARCHITECTURE] == 'all'): nuninst_arch = nuninst[arch] - self._installability_test(systems[arch], p, broken, to_check, nuninst_arch) + self._installability_test(systems[arch], p, broken, to_check, nuninst_arch, pkg) # if we are processing hints, go ahead if hint: @@ -2721,7 +2721,7 @@ class Britney(object): self.__output.close() - def _installability_test(self, system, p, broken, to_check, nuninst_arch): + def _installability_test(self, system, p, broken, to_check, nuninst_arch, current_pkg): """Test for installability of a package on an architecture p is the package to check and system does the actual check. @@ -2733,9 +2733,15 @@ class Britney(object): If nuninst_arch is not None then it also updated in the same way as broken is. + + current_pkg is the package currently being tried, mainly used + to print where an AIEEE is coming from. """ r = system.is_installable(p) - if not r: + if r <= 0: + # AIEEE: print who's responsible for it + if r == -1: + sys.stderr.write("AIEEE triggered by: %s\n" % current_pkg) # not installable if p not in broken: broken.add(p) diff --git a/lib/britney-py.c b/lib/britney-py.c index df0f9f7..5332a57 100644 --- a/lib/britney-py.c +++ b/lib/britney-py.c @@ -46,9 +46,10 @@ static void dpkgpackages_dealloc(dpkgpackages *self) { static PyObject *dpkgpackages_isinstallable(dpkgpackages *self, PyObject *args) { char *pkgname; + int r; if (!PyArg_ParseTuple(args, "s", &pkgname)) return NULL; - if (checkinstallable2(self->pkgs, pkgname)) { - return Py_BuildValue("i", 1); + if ((r=checkinstallable2(self->pkgs, pkgname))) { + return Py_BuildValue("i", r); } else { return Py_BuildValue(""); } diff --git a/lib/dpkg.c b/lib/dpkg.c index d368715..513dfb3 100644 --- a/lib/dpkg.c +++ b/lib/dpkg.c @@ -909,7 +909,8 @@ static int checkinstallable(dpkg_packages *pkgs, collpackagelist *instoneof) { } fprintf(stderr, ".\n"); free_instonelist(list); - return 0; + /* let the caller know we hit a bad failure */ + return -1; } if (pointer == NULL) {