summaryrefslogtreecommitdiff
path: root/src/fix.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-09-16 17:10:50 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-09-16 17:10:50 +0300
commit51999c97dabf9fbbe352ca3ead02851a982fcade (patch)
treeec1033d2d1079b24691246c23137e65d517c5b9b /src/fix.c
parentbcd0d45a49c89fd809f0a028012196f5a9527c99 (diff)
downloadapk-tools-51999c97dabf9fbbe352ca3ead02851a982fcade.tar.gz
apk-tools-51999c97dabf9fbbe352ca3ead02851a982fcade.tar.bz2
apk-tools-51999c97dabf9fbbe352ca3ead02851a982fcade.tar.xz
apk-tools-51999c97dabf9fbbe352ca3ead02851a982fcade.zip
solver: inheritable solver flags
allow per-name solver flags to be inheritable, and use them in self-upgrade, add -u and the fix applet. this gives more familiar behaviour for the upgrades.
Diffstat (limited to 'src/fix.c')
-rw-r--r--src/fix.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fix.c b/src/fix.c
index fa3b744..4798ebe 100644
--- a/src/fix.c
+++ b/src/fix.c
@@ -20,6 +20,7 @@
struct fix_ctx {
unsigned short solver_flags;
+ int fix_depends : 1;
};
static int fix_parse(void *pctx, struct apk_db_options *dbopts,
@@ -27,6 +28,9 @@ static int fix_parse(void *pctx, struct apk_db_options *dbopts,
{
struct fix_ctx *ctx = (struct fix_ctx *) pctx;
switch (optch) {
+ case 'd':
+ ctx->fix_depends = 1;
+ break;
case 'u':
ctx->solver_flags |= APK_SOLVERF_UPGRADE;
break;
@@ -76,7 +80,10 @@ static int fix_main(void *pctx, struct apk_database *db, int argc, char **argv)
apk_error("%s is not installed", name->name);
goto err;
}
- apk_solver_set_name_flags(name, ctx->solver_flags);
+ apk_solver_set_name_flags(
+ name,
+ ctx->solver_flags,
+ ctx->fix_depends ? ctx->solver_flags : 0);
}
r = apk_solver_commit(db, 0, db->world);
@@ -85,6 +92,7 @@ err:
}
static struct apk_option fix_options[] = {
+ { 'd', "depends", "Fix all dependencies too" },
{ 'u', "upgrade", "Upgrade package if possible" },
{ 'r', "reinstall", "Reinstall the package" },
};