diff --git a/libraries/entropy.py b/libraries/entropy.py index df793a887..35c1ede06 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -579,35 +579,34 @@ class EquoInterface(TextInterface): packagesMatched = set() # now search packages that contain the found libs - repo_order = etpRepositoriesOrder + if not reagent: + # match libraries + for repoid in etpRepositoriesOrder: + self.updateProgress( + blue("Repository id: ")+darkgreen(repoid), + importance = 1, + type = "info", + header = red(" @@ ") + ) + if reagent: + rdbconn = dbconn + else: + rdbconn = self.openRepositoryDatabase(repoid) + libsfound = set() + for lib in brokenlibs: + packages = rdbconn.searchBelongs(file = "%"+lib, like = True, branch = etpConst['branch']) + if packages: + for idpackage in packages: + # retrieve content and really look if library is in ldpath + mycontent = rdbconn.retrieveContent(idpackage) + matching_libs = [x for x in mycontent if x.endswith(lib) and (os.path.dirname(x) in ldpaths)] + libsfound.add(lib) + if matching_libs: + packagesMatched.add((idpackage,repoid,lib)) + brokenlibs.difference_update(libsfound) + if reagent: - repo_order = [etpConst['officialrepositoryid']] - - # match libraries - for repoid in repo_order: - self.updateProgress( - blue("Repository id: ")+darkgreen(repoid), - importance = 1, - type = "info", - header = red(" @@ ") - ) - if reagent: - rdbconn = dbconn - else: - rdbconn = self.openRepositoryDatabase(repoid) - libsfound = set() - for lib in brokenlibs: - packages = rdbconn.searchBelongs(file = "%"+lib, like = True, branch = etpConst['branch']) - if packages: - for idpackage in packages: - # retrieve content and really look if library is in ldpath - mycontent = rdbconn.retrieveContent(idpackage) - matching_libs = [x for x in mycontent if x.endswith(lib) and (os.path.dirname(x) in ldpaths)] - libsfound.add(lib) - if matching_libs: - packagesMatched.add((idpackage,repoid,lib)) - brokenlibs.difference_update(libsfound) - + return packagesMatched,brokenexecs,-1 return packagesMatched,brokenlibs,0 def move_to_branch(self, branch, pretend = False): diff --git a/libraries/reagentTools.py b/libraries/reagentTools.py index d5269fe7e..ceffc78e7 100644 --- a/libraries/reagentTools.py +++ b/libraries/reagentTools.py @@ -359,7 +359,7 @@ def librariesTest(listfiles = False): # load db dbconn = Entropy.databaseTools.openServerDatabase(readOnly = True, noUpload = True) - packagesMatched, brokenlibs, status = Entropy.libraries_test(dbconn = dbconn, reagent = True) + packagesMatched, brokenexecs, status = Entropy.libraries_test(dbconn = dbconn, reagent = True) if status != 0: return 1 @@ -368,27 +368,21 @@ def librariesTest(listfiles = False): print x return 0 - if (not brokenlibs) and (not packagesMatched): - if (not etpUi['quiet']): print_info(red(" @@ ")+blue("System is healthy.")) + if (not brokenexecs) and (not packagesMatched): + print_info(red(" @@ ")+blue("System is healthy.")) return 0 atomsdata = set() - if (not etpUi['quiet']): - print_info(red(" @@ ")+blue("Libraries statistics:")) - if brokenlibs: - print_info(brown(" ## ")+red("Not matched:")) - for lib in brokenlibs: - print_info(darkred(" => ")+red(lib)) - print_info(darkgreen(" ## ")+red("Matched:")) - for packagedata in packagesMatched: - myatom = dbconn.retrieveAtom(packagedata[0]) - atomsdata.add((packagedata[0],packagedata[1])) - print_info(" "+red(packagedata[2])+" => "+brown(myatom)+" ["+red(packagedata[1])+"]") - else: - for packagedata in packagesMatched: - myatom = dbconn.retrieveAtom(packagedata[0]) - atomsdata.add((packagedata[0],packagedata[1])) - print myatom + + print_info(red(" @@ ")+blue("Matching libraries with Portage:")) + qfile_exec = "/usr/bin/qfile" + qfile_opts = " -q " + if not os.access(qfile_exec,os.X_OK): + print_error(red(" * ")+blue("You need portage-utils installed !")) + return 1 + for brokenexec in brokenexecs: + print_info(red(" : ")+darkgreen(brokenexec)) + os.system(qfile_exec+qfile_opts+" "+brokenexec) return 0