diff options
author | davidovski <david@davidovski.xyz> | 2022-01-03 17:18:22 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-01-03 17:18:22 +0000 |
commit | 954aac2b58f459b0bced68dc87608b6ba6ed45bb (patch) | |
tree | 953aac9d9952e487fa5f1d9f6fb909e0c8cbe4ac /src/verbs | |
parent | 22e6ff62931ff4388ab4bfc4abb52d9785c68e3b (diff) |
fixed issue with syncing deleted packages
Diffstat (limited to 'src/verbs')
-rw-r--r-- | src/verbs/sync.py | 14 |
1 files changed, 11 insertions, 3 deletions
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"]) |