From 52f1d6e6a5b0e0faca2d397114e107900b01b97d Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 24 Nov 2021 21:47:15 +0000 Subject: fully fixed package install --- src/verbs/install.py | 18 +++++++++++++----- src/verbs/sync.py | 1 - 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/verbs') diff --git a/src/verbs/install.py b/src/verbs/install.py index 713f849..0531110 100644 --- a/src/verbs/install.py +++ b/src/verbs/install.py @@ -6,6 +6,8 @@ import time import requests import hashlib +from verbs.sync import sync + def get_best_source(available, sources_list="/var/lib/xipkg/sources"): source_speeds = {} with open(sources_list, "r") as file: @@ -187,13 +189,13 @@ def find_all_dependencies(package_names, options, config): for dep in deps: if not dep in all_deps: if is_installed(dep, config, options["r"]): - print(colors.YELLOW + f"Package {query} has already been installed") + if options["v"]: print(colors.YELLOW + f"Package {dep} has already been installed") else: to_check.append(dep) elif options["v"]: - util.print_reset(colors.CLEAR_LINE + colors.RED + f"Failed to retrieve info for {query}") + util.print_reset(colors.CLEAR_LINE + colors.RED + f"Failed to retrieve info for {dep}") else: - util.print_reset(colors.CLEAR_LINE + colors.RED + f"Failed to find package {dep}") + if options["v"]: util.print_reset(colors.CLEAR_LINE + colors.RED + f"Failed to find package {dep}") if len(all_deps) > 0: util.loading_bar(len(all_deps), len(all_deps) + len(to_check), "Resolved dependencies") @@ -228,7 +230,7 @@ def save_installed_info(package_name, package_info, util.mkdir(installed_dir) name = package_info["NAME"] - description = package_info["DESCRIPTION"] + description = package_info["DESCRIPTION"] if "DESCRIPTION" in package_info else "" installed_checksum = package_info["CHECKSUM"] build_date = package_info["DATE"] version = package_info["VER_HASH"] @@ -252,6 +254,9 @@ def save_installed_info(package_name, package_info, def install(args, options, config): + if not options["l"]: + sync(args, options, config) + sources = config["sources"] repos = config["repos"] @@ -261,7 +266,10 @@ def install(args, options, config): packages_dir = config["dir"]["packages"] to_install = args if options["n"] else find_all_dependencies(args, options, config) + if len(to_install) > 0: + + print(colors.BLUE + "The following packages will be installed:") print(end="\t") for d in to_install: @@ -286,7 +294,7 @@ def install(args, options, config): install_package(package, package_path, info, repo, sources[source], key, config, root=options["r"]) - print(colors.CYAN + f"Installed {package}") + print(colors.BG_CYAN + colors.LIGHT_BLACK + f"Installed {package}" + colors.RESET) else: print(colors.RED + "Action cancelled by user") else: diff --git a/src/verbs/sync.py b/src/verbs/sync.py index 8dde22d..e71109d 100644 --- a/src/verbs/sync.py +++ b/src/verbs/sync.py @@ -23,7 +23,6 @@ def sync_packages(repo, sources, verbose=False): speeds = {} for source,url in sources.items(): - listed, speed = list_packages(url + repo if url[-1] == "/" else f"/{repo}") if speed > 0: -- cgit v1.2.1