Commit 944eae4b authored by Natanael Copa's avatar Natanael Copa

update: return failure if any mirror update failed

fixes #4040
parent 7e3f4c3d
......@@ -148,6 +148,7 @@ struct apk_database {
char *cache_remount_dir;
apk_blob_t *arch;
unsigned int local_repos, available_repos;
int repo_update_errors;
unsigned int pending_triggers;
int performing_self_update : 1;
int permanent : 1;
......
......@@ -2017,8 +2017,10 @@ static int apk_repository_update(struct apk_database *db, struct apk_repository
int r, verify = (apk_flags & APK_ALLOW_UNTRUSTED) ? APK_SIGN_NONE : APK_SIGN_VERIFY;
r = apk_cache_download(db, repo, NULL, verify, NULL, NULL);
if (r != 0)
if (r != 0) {
apk_error("%s: %s", repo->url, apk_error_str(r));
db->repo_update_errors++;
}
return r;
}
......
......@@ -20,6 +20,7 @@ static int update_main(void *ctx, struct apk_database *db, struct apk_string_arr
{
struct apk_repository *repo;
int i;
char buf[32] = "OK:";
if (apk_verbosity < 1)
return 0;
......@@ -35,10 +36,13 @@ static int update_main(void *ctx, struct apk_database *db, struct apk_string_arr
db->repos[i].url);
}
apk_message("OK: %d distinct packages available",
if (db->repo_update_errors != 0)
snprintf(buf, sizeof(buf), "%d errors;",
db->repo_update_errors);
apk_message("%s %d distinct packages available", buf,
db->available.packages.num_items);
return 0;
return db->repo_update_errors;
}
static struct apk_applet apk_update = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment