diff options
author | Timo Teräs <timo.teras@iki.fi> | 2022-12-28 14:42:23 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2022-12-28 14:57:38 +0200 |
commit | 60f8d520898bafcd9ce831b04ea4aee9c206fd1d (patch) | |
tree | 35d64b8d743a3c5380474618b9a04736c6de13e6 /src/app_cache.c | |
parent | c24dc49a72155da2e35203cc3a3d3dba8efde220 (diff) | |
download | apk-tools-60f8d520898bafcd9ce831b04ea4aee9c206fd1d.tar.gz apk-tools-60f8d520898bafcd9ce831b04ea4aee9c206fd1d.tar.bz2 apk-tools-60f8d520898bafcd9ce831b04ea4aee9c206fd1d.tar.xz apk-tools-60f8d520898bafcd9ce831b04ea4aee9c206fd1d.zip |
cache, upgrade: do not continue if repositories have issues
There are subtle issues where solving fails with --available,
and install_if rules if the repository indexes are not available.
Also it can be considered upgrade failure if index update failed.
Abort cache download, cache sync and upgrade operations early
in the above mentioned cases.
Also document side effects of --simulate that might affect upgrade.
fixes #10726, #10764
Diffstat (limited to 'src/app_cache.c')
-rw-r--r-- | src/app_cache.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/app_cache.c b/src/app_cache.c index 9f526cc..8a91dba 100644 --- a/src/app_cache.c +++ b/src/app_cache.c @@ -201,11 +201,19 @@ static int cache_main(void *ctx, struct apk_ctx *ac, struct apk_string_array *ar return -EINVAL; if (!apk_db_cache_active(db)) { - apk_err(out, "Package cache is not enabled.\n"); + apk_err(out, "Package cache is not enabled."); r = 2; goto err; } + if ((actions & CACHE_DOWNLOAD) && (cctx->solver_flags || cctx->add_dependencies)) { + if (db->repositories.stale || db->repositories.unavailable) { + apk_err(out, "Not continuing due to stale/unavailable repositories."); + r = 3; + goto err; + } + } + if (r == 0 && (actions & CACHE_CLEAN)) r = cache_clean(db); if (r == 0 && (actions & CACHE_DOWNLOAD)) |