Update dependencies tree write log

This commit is contained in:
Dimitris Zlatanidis 2015-07-24 17:42:26 +03:00
parent 7407857a24
commit 57988107c8
4 changed files with 26 additions and 9 deletions

View file

@ -126,6 +126,7 @@ class BinaryInstall(object):
self.tmp_path, self.install)
ins, upg = self.install_packages()
Msg().reference(ins, upg)
self.deps_tree()
write_deps(self.deps_dict)
delete(self.tmp_path, self.install)
else:
@ -134,6 +135,15 @@ class BinaryInstall(object):
print("") # new line at exit
sys.exit(0)
def deps_tree(self):
"""Update dependencies dictionary with all package
"""
for dep in self.dependencies:
deps = Utils().dimensional_list(Dependencies(
self.PACKAGES_TXT, self.repo, self.blacklist).binary(
dep, self.flag))
self.deps_dict[dep] = deps
def clear_masters(self):
"""
Clear master packages if already exist in dependencies

View file

@ -41,8 +41,7 @@ def write_deps(deps_dict):
os.mkdir(dep_path)
if os.path.isfile(dep_path + name):
os.remove(dep_path + name)
if len(dependencies) > 0:
with open(dep_path + name, "w") as f:
for dep in dependencies:
f.write(dep + "\n")
f.close()
with open(dep_path + name, "w") as f:
for dep in dependencies:
f.write(dep + "\n")
f.close()

View file

@ -113,7 +113,6 @@ class PackageManager(object):
rmv_list += self._rmv_deps(dependencies, rmv)
else:
rmv_list += self._rmv_pkg(rmv)
os.remove(self.dep_path + rmv)
else:
rmv_list += self._rmv_pkg(rmv)
# Prints all removed packages
@ -168,8 +167,7 @@ class PackageManager(object):
return dependencies
def _clean_logs(self, package):
"""Clean logs for removed packages.
THIS FUNCTION IS NOT USED
"""Clean logs for removed packages
"""
files = find_package("", self.dep_path)
for f in files:
@ -188,6 +186,9 @@ class PackageManager(object):
try:
subprocess.call("removepkg {0} {1}".format(self.flag, package),
shell=True)
if os.path.isfile(self.dep_path + package):
self._clean_logs(package)
os.remove(self.dep_path + package) # remove log
except KeyboardInterrupt:
print("")
sys.exit(0)
@ -204,7 +205,6 @@ class PackageManager(object):
find_package(dep + self.meta.sp, self.meta.pkg_path)):
self._removepkg(dep)
removes.append(dep)
os.remove(self.dep_path + package)
return removes
def _rmv_pkg(self, package):

View file

@ -132,12 +132,20 @@ class SBoInstall(object):
print("") # new line at exit
sys.exit(0)
def deps_tree(self):
"""Update dependencies dictionary with all package
"""
for dep in self.one_for_all(self.deps):
deps = Requires(self.flag).sbo(dep)
self.deps_dict[dep] = self.one_for_all(deps)
def _continue_to_install(self):
"""Continue to install ?
"""
if self.master_packages and Msg().answer() in ["y", "Y"]:
installs, upgraded = self.build_install()
Msg().reference(installs, upgraded)
self.deps_tree()
write_deps(self.deps_dict)
delete(self.build_folder)