improve libtest on reagent

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1156 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2008-02-06 22:38:58 +00:00
parent 2201532fd9
commit 418aaa4cc1
2 changed files with 40 additions and 47 deletions
+27 -28
View File
@@ -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):
+13 -19
View File
@@ -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