Commit 47bac8c2 authored by Natanael Copa's avatar Natanael Copa

upgrade: reset versioned deps in world when doing upgrade -a

Doing "apk add file.apk" adds a versioned dependency to allow
downgrading, and sticky version. Most often this is to install
single packages from newer repository. So it would make sense
to reset them to non-versioned if doing:

 apk upgrade -a

fixes #346
parent 87420aaf
......@@ -41,10 +41,15 @@ static int upgrade_main(void *ctx, struct apk_database *db, int argc, char **arg
goto err;
for (i = 0; i < db->world->num; i++) {
r = apk_state_lock_dependency(state, &db->world->item[i]);
struct apk_dependency *dep = &db->world->item[i];
if (dep->version && (apk_flags & APK_PREFER_AVAILABLE)) {
dep->result_mask = APK_VERSION_EQUAL | APK_VERSION_LESS | APK_VERSION_GREATER;
dep->version = NULL;
}
r = apk_state_lock_dependency(state, dep);
if (r != 0) {
apk_error("Unable to upgrade '%s'",
db->world->item[i].name->name);
dep->name->name);
goto err;
}
}
......
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