mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-19 10:27:07 +01:00
update source
This commit is contained in:
parent
460d0d6554
commit
6573bb1f0e
1 changed files with 53 additions and 37 deletions
|
@ -59,6 +59,7 @@ def sbo_install(name):
|
||||||
"UNTESTED"
|
"UNTESTED"
|
||||||
]
|
]
|
||||||
sbo_ver, pkg_arch, = [], []
|
sbo_ver, pkg_arch, = [], []
|
||||||
|
count_installed = count_upgraded = 0
|
||||||
dependencies_list = sbo_dependencies_pkg(name)
|
dependencies_list = sbo_dependencies_pkg(name)
|
||||||
try:
|
try:
|
||||||
if dependencies_list or sbo_search_pkg(name) is not None:
|
if dependencies_list or sbo_search_pkg(name) is not None:
|
||||||
|
@ -82,6 +83,7 @@ def sbo_install(name):
|
||||||
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
|
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
|
||||||
(PKG_COLOR, ARCH_COLOR, count_installed,
|
(PKG_COLOR, ARCH_COLOR, count_installed,
|
||||||
count_upgraded) = color_tags(master_pkg, pkg, pkg_arch[-1],
|
count_upgraded) = color_tags(master_pkg, pkg, pkg_arch[-1],
|
||||||
|
count_installed, count_upgraded,
|
||||||
UNST)
|
UNST)
|
||||||
print("\nThe following packages will be automatically installed "
|
print("\nThe following packages will be automatically installed "
|
||||||
"or upgraded")
|
"or upgraded")
|
||||||
|
@ -96,16 +98,17 @@ def sbo_install(name):
|
||||||
pkg_arch[:-1]):
|
pkg_arch[:-1]):
|
||||||
dep_pkg = ("{0}-{1}".format(dep, ver))
|
dep_pkg = ("{0}-{1}".format(dep, ver))
|
||||||
(DEP_COLOR, ARCH_COLOR, count_installed,
|
(DEP_COLOR, ARCH_COLOR, count_installed,
|
||||||
count_upgraded) = color_tags(dep_pkg, dep, dep_arch, UNST)
|
count_upgraded) = color_tags(dep_pkg, dep, dep_arch,
|
||||||
|
count_installed, count_upgraded,
|
||||||
|
UNST)
|
||||||
sbo_packages_view(DEP_COLOR, dep, ver, ARCH_COLOR, dep_arch)
|
sbo_packages_view(DEP_COLOR, dep, ver, ARCH_COLOR, dep_arch)
|
||||||
msg_upg = msg_ins = "package"
|
msg_ins, msg_upg, total_msg = msg_packages(dependencies,
|
||||||
if count_installed > 1:
|
count_installed,
|
||||||
msg_ins = msg_ins + "s"
|
count_upgraded)
|
||||||
if count_upgraded > 1:
|
|
||||||
msg_upg = msg_upg + "s"
|
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(GREY, len(dependencies), msg_ins))
|
print("{0}Total {1} {2}.".format(GREY, len(dependencies),
|
||||||
|
total_msg))
|
||||||
print("{0} {1} will be installed, {2} allready installed and "
|
print("{0} {1} will be installed, {2} allready installed and "
|
||||||
"{3} {4}".format(count_installed, msg_ins, pkg_sum,
|
"{3} {4}".format(count_installed, msg_ins, pkg_sum,
|
||||||
count_upgraded, msg_upg))
|
count_upgraded, msg_upg))
|
||||||
|
@ -123,27 +126,9 @@ def sbo_install(name):
|
||||||
if read == "Y" or read == "y":
|
if read == "Y" or read == "y":
|
||||||
installs, upgraded, versions = install(dependencies, sbo_ver,
|
installs, upgraded, versions = install(dependencies, sbo_ver,
|
||||||
pkg_arch)
|
pkg_arch)
|
||||||
# Reference list with packages installed
|
|
||||||
# and upgraded.
|
|
||||||
if len(installs) > 1:
|
if len(installs) > 1:
|
||||||
template(78)
|
reference(installs, upgraded, count_installed,
|
||||||
print("| Total {0} {1} installed and {2} {3} "
|
count_upgraded, versions, msg_ins, msg_upg)
|
||||||
"upgraded".format(count_installed, msg_ins,
|
|
||||||
count_upgraded, msg_upg))
|
|
||||||
template(78)
|
|
||||||
for pkg, ver in zip(installs, versions):
|
|
||||||
installed = ("{0}-{1}".format(pkg, ver))
|
|
||||||
if find_package(installed, pkg_path):
|
|
||||||
if pkg in upgraded:
|
|
||||||
print("| Package {0} upgraded "
|
|
||||||
"successfully".format(installed))
|
|
||||||
else:
|
|
||||||
print("| Package {0} installed "
|
|
||||||
"successfully".format(installed))
|
|
||||||
else:
|
|
||||||
print("| Package {0} NOT installed".format(
|
|
||||||
installed))
|
|
||||||
template(78)
|
|
||||||
write_deps(name, dependencies)
|
write_deps(name, dependencies)
|
||||||
else:
|
else:
|
||||||
ins = uns = index = 0
|
ins = uns = index = 0
|
||||||
|
@ -179,19 +164,14 @@ def sbo_install(name):
|
||||||
else:
|
else:
|
||||||
sbo_packages_view(RED, match, ver, ARCH_COLOR, march)
|
sbo_packages_view(RED, match, ver, ARCH_COLOR, march)
|
||||||
uns += 1
|
uns += 1
|
||||||
total_msg = ins_msg = uns_msg = "package"
|
msg_ins, msg_ins, total_msg = msg_packages(sbo_matching, ins,
|
||||||
if len(sbo_matching) > 1:
|
uns)
|
||||||
total_msg = total_msg + "s"
|
|
||||||
if ins > 1:
|
|
||||||
ins_msg = ins_msg + "s"
|
|
||||||
if uns > 1:
|
|
||||||
uns_msg = uns_msg + "s"
|
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total found {1} matching {2}.".format(
|
print("{0}Total found {1} matching {2}.".format(
|
||||||
GREY, len(sbo_matching), total_msg))
|
GREY, len(sbo_matching), total_msg))
|
||||||
print("{0} installed {1} and {2} uninstalled {3}.{4}\n".format(
|
print("{0} installed {1} and {2} uninstalled {3}.{4}\n".format(
|
||||||
ins, ins_msg, uns, uns_msg, ENDC))
|
ins, msg_ins, uns, msg_ins, ENDC))
|
||||||
else:
|
else:
|
||||||
message = "No matching"
|
message = "No matching"
|
||||||
pkg_not_found("\n", name, message, "\n")
|
pkg_not_found("\n", name, message, "\n")
|
||||||
|
@ -200,6 +180,42 @@ def sbo_install(name):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def msg_packages(pkgs, ins, uns):
|
||||||
|
total_msg = msg_ins = msg_uns = "package"
|
||||||
|
if len(pkgs) > 1:
|
||||||
|
total_msg = total_msg + "s"
|
||||||
|
if ins > 1:
|
||||||
|
msg_ins = msg_ins + "s"
|
||||||
|
if uns > 1:
|
||||||
|
msg_ins = msg_ins + "s"
|
||||||
|
return msg_ins, msg_uns, total_msg
|
||||||
|
|
||||||
|
|
||||||
|
def reference(installs, upgraded, count_installed, count_upgraded, versions,
|
||||||
|
msg_ins, msg_upg):
|
||||||
|
'''
|
||||||
|
Reference list with packages installed
|
||||||
|
and upgraded.
|
||||||
|
'''
|
||||||
|
template(78)
|
||||||
|
print("| Total {0} {1} installed and {2} {3} "
|
||||||
|
"upgraded".format(count_installed, msg_ins,
|
||||||
|
count_upgraded, msg_upg))
|
||||||
|
template(78)
|
||||||
|
for pkg, ver in zip(installs, versions):
|
||||||
|
installed = ("{0}-{1}".format(pkg, ver))
|
||||||
|
if find_package(installed, pkg_path):
|
||||||
|
if pkg in upgraded:
|
||||||
|
print("| Package {0} upgraded "
|
||||||
|
"successfully".format(installed))
|
||||||
|
else:
|
||||||
|
print("| Package {0} installed "
|
||||||
|
"successfully".format(installed))
|
||||||
|
else:
|
||||||
|
print("| Package {0} NOT installed".format(installed))
|
||||||
|
template(78)
|
||||||
|
|
||||||
|
|
||||||
def build_deps(name, dependencies_list):
|
def build_deps(name, dependencies_list):
|
||||||
'''
|
'''
|
||||||
Returns the dependencies in the correct order
|
Returns the dependencies in the correct order
|
||||||
|
@ -284,12 +300,12 @@ def top_template():
|
||||||
template(78)
|
template(78)
|
||||||
|
|
||||||
|
|
||||||
def color_tags(pkg_name_version, pkg_name, arch, UNST):
|
def color_tags(pkg_name_version, pkg_name, arch, count_installed,
|
||||||
|
count_upgraded, UNST):
|
||||||
'''
|
'''
|
||||||
Tag with color if packages installed or
|
Tag with color if packages installed or
|
||||||
upgraded and if package unsupport arch
|
upgraded and if package unsupport arch
|
||||||
'''
|
'''
|
||||||
count_installed = count_upgraded = 0
|
|
||||||
color_pkg, color_arch = "", ""
|
color_pkg, color_arch = "", ""
|
||||||
if find_package(pkg_name_version, pkg_path):
|
if find_package(pkg_name_version, pkg_path):
|
||||||
color_pkg = GREEN
|
color_pkg = GREEN
|
||||||
|
|
Loading…
Reference in a new issue