1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-16 04:45:10 +03:00

pmb.helpers.repo.update: refactor cache code (!1726)

Change the cache format from args.cache["offline_msg_shown"] to
args.cache["pmb.helpers.repo.update"]["offline_msg_shown"]. This is in
preparation for saving more data in the cache of
pmb.helpers.repo.update in the next commit.
This commit is contained in:
Oliver Smith 2018-12-11 07:40:43 +01:00
parent a874baa037
commit fa7860c8f6
2 changed files with 6 additions and 4 deletions

View file

@ -120,10 +120,11 @@ def update(args, arch=None, force=False, existing_only=False):
:returns: True when files have been downloaded, False otherwise
"""
# Skip in offline mode, only show once
cache_key = "pmb.helpers.repo.update"
if args.offline:
if not args.cache["offline_msg_shown"]:
if not args.cache[cache_key]["offline_msg_shown"]:
logging.info("NOTE: skipping package index update (offline mode)")
args.cache["offline_msg_shown"] = True
args.cache[cache_key]["offline_msg_shown"] = True
return False
# Architectures and retention time