summaryrefslogtreecommitdiff
path: root/src/upgrade.c
diff options
context:
space:
mode:
authornrybowski <nicolas.rybowski@student.uclouvain.be>2019-12-10 02:14:49 +0100
committerTimo Teräs <timo.teras@iki.fi>2019-12-12 13:47:11 +0200
commit695a2f8231f11f690ba96d6c4b537e22dd6571fd (patch)
tree4ebffd0f2221d09ef40857937a11138a13f92d8b /src/upgrade.c
parentcfa8b736f897b9bf8906dd38538f6058a5ad2ba6 (diff)
downloadapk-tools-695a2f8231f11f690ba96d6c4b537e22dd6571fd.tar.gz
apk-tools-695a2f8231f11f690ba96d6c4b537e22dd6571fd.tar.bz2
apk-tools-695a2f8231f11f690ba96d6c4b537e22dd6571fd.tar.xz
apk-tools-695a2f8231f11f690ba96d6c4b537e22dd6571fd.zip
upgrade: implement --ignore to exclude some packages from upgrade
Diffstat (limited to 'src/upgrade.c')
-rw-r--r--src/upgrade.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/upgrade.c b/src/upgrade.c
index 6c3eafa..d1ec36c 100644
--- a/src/upgrade.c
+++ b/src/upgrade.c
@@ -22,6 +22,7 @@ struct upgrade_ctx {
unsigned short solver_flags;
int no_self_upgrade : 1;
int self_upgrade_only : 1;
+ int ignore : 1;
};
static int option_parse_applet(void *ctx, struct apk_db_options *dbopts, int optch, const char *optarg)
@@ -35,6 +36,9 @@ static int option_parse_applet(void *ctx, struct apk_db_options *dbopts, int opt
case 0x10001:
uctx->self_upgrade_only = 1;
break;
+ case 0x10002:
+ uctx->ignore = 1;
+ break;
case 'a':
uctx->solver_flags |= APK_SOLVERF_AVAILABLE;
break;
@@ -59,6 +63,8 @@ static const struct apk_option options_applet[] = {
{ 0x10000, "no-self-upgrade",
"Do not do early upgrade of 'apk-tools' package" },
{ 0x10001, "self-upgrade-only", "Only do self-upgrade" },
+ { 0x10002, "ignore", "Ignore the upgrade of PACKAGE. Partial "
+ "upgrades not supported, this might break your system."},
};
static const struct apk_option_group optgroup_applet = {
@@ -158,6 +164,15 @@ static int upgrade_main(void *ctx, struct apk_database *db, struct apk_string_ar
if (uctx->self_upgrade_only)
return 0;
+ if (uctx->ignore) {
+ char **pkg_name;
+ struct apk_name *name;
+ foreach_array_item(pkg_name, args) {
+ name = apk_db_get_name(db, APK_BLOB_STR(*pkg_name));
+ apk_solver_set_name_flags(name, solver_flags | APK_SOLVERF_IGNORE_UPGRADE, 0);
+ }
+ }
+
if (solver_flags & APK_SOLVERF_AVAILABLE) {
apk_dependency_array_copy(&world, db->world);
foreach_array_item(dep, world) {