Fixed avoid reinstall binary packages

This commit is contained in:
Dimitris Zlatanidis 2015-12-30 10:30:56 +02:00
parent 0e98b1d396
commit 4acaeb10d8

View file

@ -124,10 +124,17 @@ class BinaryInstall(object):
"space will be used.{2}".format(size[1], unit[1], "space will be used.{2}".format(size[1], unit[1],
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
print("") print("")
self.if_all_installed()
if self.msg.answer() in ["y", "Y"]: if self.msg.answer() in ["y", "Y"]:
self.install.reverse() for inst, dwn in zip(self.dep_install + self.install,
Download(self.tmp_path, self.dep_dwn + self.dwn, self.dep_dwn + self.dwn):
self.repo).start() if (not os.path.isfile(self.meta.pkg_path + inst[:-4]) or
"--download-only" in self.flag):
Download(self.tmp_path, dwn.split(), self.repo).start()
else:
self.msg.template(78)
self.msg.pkg_found(inst)
self.msg.template(78)
if "--download-only" in self.flag: if "--download-only" in self.flag:
raise SystemExit() raise SystemExit()
self.dep_install = Utils().check_downloaded( self.dep_install = Utils().check_downloaded(
@ -137,10 +144,21 @@ class BinaryInstall(object):
ins, upg = self.install_packages() ins, upg = self.install_packages()
self.msg.reference(ins, upg) self.msg.reference(ins, upg)
write_deps(self.deps_dict) write_deps(self.deps_dict)
delete_package(self.tmp_path, self.install) delete_package(self.tmp_path, self.dep_install + self.install)
else: else:
self.msg.not_found(self.is_upgrade) self.msg.not_found(self.is_upgrade)
def if_all_installed(self):
"""Check if all packages is already installed
"""
count_inst = 0
for inst in (self.dep_install + self.install):
if (os.path.isfile(self.meta.pkg_path + inst[:-4]) and
"--download-only" not in self.flag):
count_inst += 1
if count_inst == len(self.dep_install + self.install):
raise SystemExit()
def case_insensitive(self): def case_insensitive(self):
"""Matching packages distinguish between uppercase and """Matching packages distinguish between uppercase and
lowercase lowercase
@ -183,12 +201,7 @@ class BinaryInstall(object):
pkg_ver = "{0}-{1}".format(split_package(inst)[0], pkg_ver = "{0}-{1}".format(split_package(inst)[0],
split_package(inst)[1]) split_package(inst)[1])
self.checksums(inst) self.checksums(inst)
if os.path.isfile(self.meta.pkg_path + inst[:-4]): if GetFromInstalled(split_package(inst)[0]).name():
print("[ {0}reinstalling{1} ] --> {2}".format(
self.meta.color["GREEN"], self.meta.color["ENDC"], inst))
installs.append(pkg_ver)
PackageManager(package).upgrade("--reinstall")
elif GetFromInstalled(split_package(inst)[0]).name():
print("[ {0}upgrading{1} ] --> {2}".format( print("[ {0}upgrading{1} ] --> {2}".format(
self.meta.color["YELLOW"], self.meta.color["ENDC"], inst)) self.meta.color["YELLOW"], self.meta.color["ENDC"], inst))
upgraded.append(pkg_ver) upgraded.append(pkg_ver)