Commit 2dd7ad9a authored by Timo Teräs's avatar Timo Teräs

upgrade: warn (do not fail) on missing top-level package names

We we can upgrade rest of system just fine then.
parent e706f63e
...@@ -33,10 +33,12 @@ static int upgrade_parse(void *ctx, struct apk_db_options *dbopts, ...@@ -33,10 +33,12 @@ static int upgrade_parse(void *ctx, struct apk_db_options *dbopts,
static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **argv) static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **argv)
{ {
struct apk_state *state = NULL; struct apk_state *state = NULL;
struct apk_name_array *missing;
int i, r = 0; int i, r = 0;
apk_flags |= APK_UPGRADE; apk_flags |= APK_UPGRADE;
apk_name_array_init(&missing);
state = apk_state_new(db); state = apk_state_new(db);
if (state == NULL) if (state == NULL)
goto err; goto err;
...@@ -47,15 +49,33 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg ...@@ -47,15 +49,33 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg
dep->result_mask = APK_VERSION_EQUAL | APK_VERSION_LESS | APK_VERSION_GREATER; dep->result_mask = APK_VERSION_EQUAL | APK_VERSION_LESS | APK_VERSION_GREATER;
dep->version = NULL; dep->version = NULL;
} }
r |= apk_state_lock_dependency(state, dep); if (dep->name->pkgs->num != 0)
r |= apk_state_lock_dependency(state, dep);
else
*apk_name_array_add(&missing) = dep->name;
} }
if (r == 0) if (r == 0) {
for (i = 0; i < missing->num; i++) {
struct apk_indent indent;
struct apk_name *name = missing->item[i];
if (i == 0) {
apk_warning("The following package names no longer exists in repository:");
indent.x = 0;
indent.indent = 2;
}
apk_print_indented(&indent, APK_BLOB_STR(name->name));
}
if (i != 0)
printf("\n");
r = apk_state_commit(state, db); r = apk_state_commit(state, db);
else } else
apk_state_print_errors(state); apk_state_print_errors(state);
err: err:
if (state != NULL) if (state != NULL)
apk_state_unref(state); apk_state_unref(state);
apk_name_array_free(&missing);
return r; return r;
} }
......
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