mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-31 10:26:39 +01:00
Fix matching binary packages
This commit is contained in:
parent
fac2e67770
commit
ed3f5ca56c
2 changed files with 35 additions and 18 deletions
|
@ -173,6 +173,14 @@ class BinaryInstall(object):
|
||||||
PackageManager(package).upgrade("--install-new")
|
PackageManager(package).upgrade("--install-new")
|
||||||
return [installs, upgraded]
|
return [installs, upgraded]
|
||||||
|
|
||||||
|
def find_installed(self, pkg):
|
||||||
|
"""Return installed package name
|
||||||
|
"""
|
||||||
|
find = find_package(pkg + "-", self.meta.pkg_path)
|
||||||
|
if find:
|
||||||
|
return split_package(find[0])[0]
|
||||||
|
return ""
|
||||||
|
|
||||||
def checksums(self, install):
|
def checksums(self, install):
|
||||||
"""
|
"""
|
||||||
Checksums before install
|
Checksums before install
|
||||||
|
@ -205,23 +213,23 @@ class BinaryInstall(object):
|
||||||
# fix repositories align
|
# fix repositories align
|
||||||
repo = self.repo + (" " * (6 - (len(self.repo))))
|
repo = self.repo + (" " * (6 - (len(self.repo))))
|
||||||
for pkg, comp in zip(install, comp_sum):
|
for pkg, comp in zip(install, comp_sum):
|
||||||
pkg_split = split_package(pkg[:-4])
|
pkg_repo = split_package(pkg[:-4])
|
||||||
if find_package(pkg[:-4], self.meta.pkg_path):
|
if find_package(pkg[:-4], self.meta.pkg_path):
|
||||||
pkg_sum += 1
|
pkg_sum += 1
|
||||||
COLOR = self.meta.color["GREEN"]
|
COLOR = self.meta.color["GREEN"]
|
||||||
elif find_package(pkg_split[0] + self.meta.sp, self.meta.pkg_path):
|
elif pkg_repo[0] == self.find_installed(pkg_repo[0]):
|
||||||
COLOR = self.meta.color["YELLOW"]
|
COLOR = self.meta.color["YELLOW"]
|
||||||
upg_sum += 1
|
upg_sum += 1
|
||||||
else:
|
else:
|
||||||
COLOR = self.meta.color["RED"]
|
COLOR = self.meta.color["RED"]
|
||||||
uni_sum += 1
|
uni_sum += 1
|
||||||
ver = get_installed_version(pkg_split[0])
|
ver = get_installed_version(pkg_repo[0])
|
||||||
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
|
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
|
||||||
COLOR, pkg_split[0] + ver, self.meta.color["ENDC"],
|
COLOR, pkg_repo[0] + ver, self.meta.color["ENDC"],
|
||||||
" " * (23-len(pkg_split[0] + ver)), pkg_split[1],
|
" " * (23-len(pkg_repo[0] + ver)), pkg_repo[1],
|
||||||
" " * (18-len(pkg_split[1])), pkg_split[2],
|
" " * (18-len(pkg_repo[1])), pkg_repo[2],
|
||||||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
" " * (8-len(pkg_repo[2])), pkg_repo[3],
|
||||||
" " * (7-len(pkg_split[3])), repo,
|
" " * (7-len(pkg_repo[3])), repo,
|
||||||
comp, " K")).rstrip()
|
comp, " K")).rstrip()
|
||||||
return [pkg_sum, upg_sum, uni_sum]
|
return [pkg_sum, upg_sum, uni_sum]
|
||||||
|
|
||||||
|
|
|
@ -158,19 +158,28 @@ class Patches(object):
|
||||||
Views packages
|
Views packages
|
||||||
"""
|
"""
|
||||||
for upg, size in sorted(zip(self.upgrade_all, self.comp_sum)):
|
for upg, size in sorted(zip(self.upgrade_all, self.comp_sum)):
|
||||||
pkg_split = split_package(upg[:-4])
|
pkg_repo = split_package(upg[:-4])
|
||||||
color = self.meta.color["YELLOW"]
|
|
||||||
if not find_package(pkg_split[0], self.meta.pkg_path):
|
|
||||||
color = self.meta.color["RED"]
|
color = self.meta.color["RED"]
|
||||||
ver = get_installed_version(pkg_split[0])
|
pkg_inst = self.find_installed(pkg_repo[0])
|
||||||
|
if pkg_repo[0] == pkg_inst:
|
||||||
|
color = self.meta.color["YELLOW"]
|
||||||
|
ver = get_installed_version(pkg_repo[0])
|
||||||
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format(
|
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format(
|
||||||
color, pkg_split[0] + ver, self.meta.color["ENDC"],
|
color, pkg_repo[0] + ver, self.meta.color["ENDC"],
|
||||||
" " * (23-len(pkg_split[0] + ver)), pkg_split[1],
|
" " * (23-len(pkg_repo[0] + ver)), pkg_repo[1],
|
||||||
" " * (18-len(pkg_split[1])), pkg_split[2],
|
" " * (18-len(pkg_repo[1])), pkg_repo[2],
|
||||||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
" " * (8-len(pkg_repo[2])), pkg_repo[3],
|
||||||
" " * (7-len(pkg_split[3])), "Slack",
|
" " * (7-len(pkg_repo[3])), "Slack",
|
||||||
size, " K")).rstrip()
|
size, " K")).rstrip()
|
||||||
|
|
||||||
|
def find_installed(self, pkg):
|
||||||
|
"""Return installed package name
|
||||||
|
"""
|
||||||
|
find = find_package(pkg + "-", self.meta.pkg_path)
|
||||||
|
if find:
|
||||||
|
return split_package(find[0])[0]
|
||||||
|
return ""
|
||||||
|
|
||||||
def upgrade(self):
|
def upgrade(self):
|
||||||
"""
|
"""
|
||||||
Upgrade packages
|
Upgrade packages
|
||||||
|
|
Loading…
Reference in a new issue