From 2caadbef01d144de6531358872b9fef68fda9b0b Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 1 Jun 2009 18:03:49 +0200 Subject: [PATCH] entropy.db: extend resolveNeeded capabilities to match entropy.qa requirements --- libraries/entropy/db.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/libraries/entropy/db.py b/libraries/entropy/db.py index 38a8202e8..cf13a98d2 100644 --- a/libraries/entropy/db.py +++ b/libraries/entropy/db.py @@ -3182,20 +3182,33 @@ class LocalRepository: return True return False - def resolveNeeded(self, needed, elfclass = -1): + def resolveNeeded(self, needed, elfclass = -1, extended = False): args = [needed] elfclass_txt = '' - if elfclass != -1: - elfclass_txt = ' AND elfclass = (?)' - args.append(elfclass) - self.cursor.execute(""" - SELECT idpackage FROM neededlibraryidpackages - WHERE library = (?) - """ + elfclass_txt, args) - - return self.fetchall2set(self.cursor.fetchall()) + if extended: + if elfclass != -1: + elfclass_txt = ' AND neededlibraryidpackages.elfclass = (?)' + args.append(elfclass) + self.cursor.execute(""" + SELECT neededlibraryidpackages.idpackage, + neededlibrarypaths.path + FROM neededlibraryidpackages, neededlibrarypaths + WHERE neededlibraryidpackages.library = (?) AND + neededlibraryidpackages.library = neededlibrarypaths.library AND + neededlibraryidpackages.elfclass = neededlibrarypaths.elfclass + """ + elfclass_txt, args) + return self.cursor.fetchall() + else: + if elfclass != -1: + elfclass_txt = ' AND elfclass = (?)' + args.append(elfclass) + self.cursor.execute(""" + SELECT idpackage FROM neededlibraryidpackages + WHERE library = (?) + """ + elfclass_txt, args) + return self.fetchall2set(self.cursor.fetchall()) def isSourceAvailable(self, source): self.cursor.execute('SELECT idsource FROM sourcesreference WHERE source = (?)', (source,))