If a full path is given to "pisi sf" we can get it from filesdb which gives a huge
time benefit.
This commit is contained in:
+5
-1
@@ -33,7 +33,7 @@ class FilesDB(lazydb.LazyDB):
|
|||||||
def init(self):
|
def init(self):
|
||||||
self.filesdb = {}
|
self.filesdb = {}
|
||||||
self.__check_filesdb()
|
self.__check_filesdb()
|
||||||
|
|
||||||
def has_file(self, path):
|
def has_file(self, path):
|
||||||
return self.filesdb.has_key(md5.new(path).digest())
|
return self.filesdb.has_key(md5.new(path).digest())
|
||||||
|
|
||||||
@@ -41,6 +41,10 @@ class FilesDB(lazydb.LazyDB):
|
|||||||
return self.filesdb[md5.new(path).digest()], path
|
return self.filesdb[md5.new(path).digest()], path
|
||||||
|
|
||||||
def search_file(self, term):
|
def search_file(self, term):
|
||||||
|
if self.has_file(term):
|
||||||
|
pkg, path = self.get_file(term)
|
||||||
|
return [(pkg,[path])]
|
||||||
|
|
||||||
installdb = pisi.db.installdb.InstallDB()
|
installdb = pisi.db.installdb.InstallDB()
|
||||||
found = []
|
found = []
|
||||||
for pkg in installdb.list_installed():
|
for pkg in installdb.list_installed():
|
||||||
|
|||||||
Reference in New Issue
Block a user