summaryrefslogtreecommitdiff
path: root/src/upgrade.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-06-15 18:33:16 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-06-15 18:34:03 +0300
commit2dd7ad9a9b9d34bb577da4365569f4f56256d0e5 (patch)
treefdb1f0e79f43f7728dc8605698d48179a897534a /src/upgrade.c
parente706f63eda1f62314f25987ab52e35f91f29dd78 (diff)
downloadapk-tools-2dd7ad9a9b9d34bb577da4365569f4f56256d0e5.tar.gz
apk-tools-2dd7ad9a9b9d34bb577da4365569f4f56256d0e5.tar.bz2
apk-tools-2dd7ad9a9b9d34bb577da4365569f4f56256d0e5.tar.xz
apk-tools-2dd7ad9a9b9d34bb577da4365569f4f56256d0e5.zip
upgrade: warn (do not fail) on missing top-level package names
We we can upgrade rest of system just fine then.
Diffstat (limited to 'src/upgrade.c')
-rw-r--r--src/upgrade.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/upgrade.c b/src/upgrade.c
index 2d7fd39..b54d6c0 100644
--- a/src/upgrade.c
+++ b/src/upgrade.c
@@ -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)
{
struct apk_state *state = NULL;
+ struct apk_name_array *missing;
int i, r = 0;
apk_flags |= APK_UPGRADE;
+ apk_name_array_init(&missing);
state = apk_state_new(db);
if (state == NULL)
goto err;
@@ -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->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);
- else
+ } else
apk_state_print_errors(state);
err:
if (state != NULL)
apk_state_unref(state);
+ apk_name_array_free(&missing);
return r;
}