Kaydet (Commit) 380bc562 authored tarafından ğ's avatar ğ

AdvancedList integration for integration check and dependency calculation. Speedup %300

üst d30bd070
......@@ -30,7 +30,7 @@ class PGraph:
def __init__(self, packagedb=None, installdb=None):
self.packagedb = packagedb
self.installdb = installdb
self.packages = []
self.packages = inary.util.AdvancedList(2)
self.vertic = []
self.checked = []
self.reinstall = False
......@@ -48,7 +48,8 @@ class PGraph:
return self.packagedb
def topological_sort(self):
return inary.util.unique_list(self.packages)
print(self.packages.all())
return inary.util.unique_list(self.packages.all())
def check_package(self, pkg=None, reverse=False):
if pkg not in self.checked:
......@@ -56,30 +57,30 @@ class PGraph:
else:
return
if pkg in self.packages:
if self.packages.exists(pkg):
return
else:
if reverse:
if pkg not in self.packages:
self.packages.append(pkg)
if not self.packages.exists(pkg):
self.packages(pkg)
for (dep, depinfo) in self.installdb.get_rev_deps(pkg):
if dep not in self.packages:
if not self.packages.exists(dep):
self.check_package(dep, reverse)
if self.installdb.has_package(dep):
self.packages.append(dep)
self.packages.add(dep)
else:
if self.installdb.has_package(pkg):
if self.packagedb.get_package(pkg).release == self.installdb.get_package(pkg).release:
if not self.reinstall:
return
if pkg not in self.packages:
self.packages.append(pkg)
if not self.packages.exists(pkg):
self.packages.add(pkg)
for dep in self.packagedb.get_package(pkg).runtimeDependencies():
if dep not in self.packages:
if not self.packages.exists(dep):
self.check_package(dep.package, reverse)
if not self.installdb.has_package(dep.package):
self.packages.append(dep.package)
self.packages.add(dep.package)
def add_package(self, package):
self.check_package(package, False)
......@@ -88,9 +89,9 @@ class PGraph:
self.check_package(package, True)
def add_package_file(self, pkg):
self.packages.append(pkg)
self.packages.add(pkg)
for dep in self.installdb.get_package(pkg).runtimeDependencies():
if dep not in self.packages:
if not self.packages.exists(dep):
self.check_package(dep.package)
def vertices(self):
......
......@@ -124,7 +124,7 @@ def install_pkg_names(A, reinstall=False, extra=False):
if conflicts:
operations.remove.remove_conflicting_packages(conflicts)
install_files = {}
install_files = util.AdvancedList()
file_conflicts = []
for path in paths:
pkg = inary.package.Package(path)
......@@ -135,15 +135,12 @@ def install_pkg_names(A, reinstall=False, extra=False):
"} / {} ] => {}").format(paths.index(path) +
1, len(paths), pkg.metadata.package.name), color="yellow")
for file in pkg.files.list:
sha = util.sha1_data(file.path)[0:5]
if sha not in install_files:
install_files[sha] = []
if file not in install_files[sha]:
install_files[sha].append(file)
else:
if install_files.exists(file):
file_conflicts.append(file)
else:
install_files.add(file)
ctx.ui.info(
_("Current {} / Total {} files counted.").format(len(pkg.files.list), len(install_files)))
_("Current {} / Total {} files counted.").format(len(pkg.files.list), install_files.length()))
if len(file_conflicts) > 0:
ctx.ui.warning(_("Integration check error detected."))
for path in file_conflicts:
......
......@@ -30,6 +30,7 @@ from inary.util.process import *
from inary.util.strings import *
from inary.util.terminal import *
from inary.util.cpuinfo import *
from inary.util.list import *
# Gettext Library
import gettext
......
......@@ -60,7 +60,7 @@ class AdvancedList:
def exists(self,element):
"""check element available in list"""
path = self.__get_path(element)
return element in self.__liststore[path]
return path in self.__liststore and element in self.__liststore[path]
def length(self):
"""return list length"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment