mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-05 08:46:20 +01:00
Merge functions into class
This commit is contained in:
parent
109cdbe5dc
commit
a908cf0c37
4 changed files with 13 additions and 29 deletions
|
@ -173,14 +173,6 @@ class BinaryInstall(object):
|
|||
PackageManager(package).upgrade("--install-new")
|
||||
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):
|
||||
"""
|
||||
Checksums before install
|
||||
|
@ -217,7 +209,7 @@ class BinaryInstall(object):
|
|||
if find_package(pkg[:-4], self.meta.pkg_path):
|
||||
pkg_sum += 1
|
||||
COLOR = self.meta.color["GREEN"]
|
||||
elif pkg_repo[0] == self.find_installed(pkg_repo[0]):
|
||||
elif pkg_repo[0] == GetFromInstalled(pkg_repo[0]).name():
|
||||
COLOR = self.meta.color["YELLOW"]
|
||||
upg_sum += 1
|
||||
else:
|
||||
|
|
|
@ -37,7 +37,7 @@ class GetFromInstalled(object):
|
|||
self.meta = _meta_
|
||||
|
||||
def version(self):
|
||||
"""Get version from installed packages
|
||||
"""Return version from installed packages
|
||||
"""
|
||||
find = find_package(self.package + self.meta.sp, _meta_.pkg_path)
|
||||
if find:
|
||||
|
@ -45,3 +45,11 @@ class GetFromInstalled(object):
|
|||
if self.package == name:
|
||||
return self.meta.sp + split_package(find[0])[1]
|
||||
return ""
|
||||
|
||||
def name(self):
|
||||
"""Return installed package name
|
||||
"""
|
||||
find = find_package(self.package + self.meta.sp, self.meta.pkg_path)
|
||||
if find:
|
||||
return split_package(find[0])[0]
|
||||
return ""
|
||||
|
|
|
@ -224,7 +224,7 @@ class SBoInstall(object):
|
|||
"""
|
||||
# split sbo name with version and get name
|
||||
sbo_name = "-".join(sbo.split("-")[:-1])
|
||||
find = self.find_installed(sbo_name)
|
||||
find = GetFromInstalled(sbo_name).name()
|
||||
if find_package(sbo, self.meta.pkg_path):
|
||||
paint = self.meta.color["GREEN"]
|
||||
count_ins += 1
|
||||
|
@ -265,14 +265,6 @@ class SBoInstall(object):
|
|||
binary.append(search)
|
||||
return binary
|
||||
|
||||
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 build_install(self):
|
||||
"""Searches the package name and version in /tmp to
|
||||
install. If find two or more packages e.g. to build
|
||||
|
@ -313,7 +305,7 @@ class SBoInstall(object):
|
|||
except ValueError:
|
||||
Msg().build_FAILED(sbo_url, prgnam)
|
||||
sys.exit(0)
|
||||
find = self.find_installed(pkg)
|
||||
find = GetFromInstalled(pkg).name()
|
||||
if find == pkg:
|
||||
print("[ {0}Upgrading{1} ] --> {2}".format(
|
||||
self.meta.color["YELLOW"],
|
||||
|
|
|
@ -160,7 +160,7 @@ class Patches(object):
|
|||
for upg, size in sorted(zip(self.upgrade_all, self.comp_sum)):
|
||||
pkg_repo = split_package(upg[:-4])
|
||||
color = self.meta.color["RED"]
|
||||
pkg_inst = self.find_installed(pkg_repo[0])
|
||||
pkg_inst = GetFromInstalled(pkg_repo[0]).name()
|
||||
if pkg_repo[0] == pkg_inst:
|
||||
color = self.meta.color["YELLOW"]
|
||||
ver = GetFromInstalled(pkg_repo[0]).version()
|
||||
|
@ -172,14 +172,6 @@ class Patches(object):
|
|||
" " * (7-len(pkg_repo[3])), "Slack",
|
||||
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):
|
||||
"""
|
||||
Upgrade packages
|
||||
|
|
Loading…
Add table
Reference in a new issue