From 954aac2b58f459b0bced68dc87608b6ba6ed45bb Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 3 Jan 2022 17:18:22 +0000 Subject: fixed issue with syncing deleted packages --- src/verbs/sync.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/verbs/sync.py') diff --git a/src/verbs/sync.py b/src/verbs/sync.py index 0474bf6..f47e0db 100644 --- a/src/verbs/sync.py +++ b/src/verbs/sync.py @@ -1,6 +1,7 @@ import os import util import colors +import shutil import time CACHE_DIR = "/var/cache/xipkg" @@ -131,12 +132,16 @@ def sync(args, options, config): for source,ping in speeds.items(): file.write(f"{source} {ping}\n") + repo_dir = os.path.join(config["dir"]["packages"], repo) + if os.path.exists(repo_dir): + shutil.rmtree(repo_dir) + # find the most popular hash to use done = 0 total = len(packages.items()) for package,versions in packages.items(): info = validate_package(package, versions, repo, verbose=v) - if not save_package(package, info, os.path.join(config["dir"]["packages"], repo)): + if not save_package(package, info, repo_dir): new += 1 done += 1 util.loading_bar(done, total, f"Syncing {repo}") @@ -144,8 +149,11 @@ def sync(args, options, config): util.loading_bar(total, total, f"Synced {repo}") print(colors.RESET) - if new > 0: - util.fill_line(f"There are {new} new updates", colors.LIGHT_GREEN) + # this isnt new updates for install, this is new packages + #if new > 0: + # util.fill_line(f"There are {new} new updates", colors.LIGHT_GREEN) + + def import_key(name, url, config, verbose=False, root="/"): keychain_dir = util.add_path(root, config["dir"]["keychain"]) -- cgit v1.2.1