summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-11-19 17:32:07 +0100
committerMichael Schroeder <mls@suse.de>2012-11-19 17:32:07 +0100
commit5a7ca4eb2349deafecbe366f15c043cb50a08ac7 (patch)
treedf1e4e1edeec21c9022b84d92800c75ce8fdbf9c
parent3c0edb72aaff99dfc2dd932e69f61f6e19c72dc5 (diff)
downloadlibsolv-5a7ca4eb2349deafecbe366f15c043cb50a08ac7.tar.gz
libsolv-5a7ca4eb2349deafecbe366f15c043cb50a08ac7.tar.bz2
libsolv-5a7ca4eb2349deafecbe366f15c043cb50a08ac7.zip
implement '--best' in solv demo
-rw-r--r--examples/solv.c10
-rw-r--r--ext/testcase.c1
2 files changed, 11 insertions, 0 deletions
diff --git a/examples/solv.c b/examples/solv.c
index beb5bd3..d1857fa 100644
--- a/examples/solv.c
+++ b/examples/solv.c
@@ -2426,6 +2426,7 @@ main(int argc, char **argv)
Queue addedfileprovides_inst;
Queue repofilter;
int cleandeps = 0;
+ int forcebest = 0;
char *rootdir = 0;
argc--;
@@ -2500,6 +2501,12 @@ main(int argc, char **argv)
argc--;
argv++;
}
+ else if (argc > 1 && !strcmp(argv[1], "--best"))
+ {
+ forcebest = 1;
+ argc--;
+ argv++;
+ }
else
break;
}
@@ -2782,6 +2789,8 @@ main(int argc, char **argv)
job.elements[i] ^= SOLVER_UPDATE ^ SOLVER_INSTALL;
if (cleandeps)
job.elements[i] |= SOLVER_CLEANDEPS;
+ if (forcebest)
+ job.elements[i] |= SOLVER_FORCEBEST;
}
// multiversion test
@@ -2805,6 +2814,7 @@ rerunsolver:
solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1);
if (mainmode == MODE_ERASE)
solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1); /* don't nag */
+ solver_set_flag(solv, SOLVER_FLAG_BEST_OBEY_POLICY, 1);
if (!solver_solve(solv, &job))
break;
diff --git a/ext/testcase.c b/ext/testcase.c
index d834654..da9734c 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -92,6 +92,7 @@ static struct solverflags2str {
{ SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, "addalreadyrecommended", 0 },
{ SOLVER_FLAG_NO_INFARCHCHECK, "noinfarchcheck", 0 },
{ SOLVER_FLAG_KEEP_EXPLICIT_OBSOLETES, "keepexplicitobsoletes", 0 },
+ { SOLVER_FLAG_BEST_OBEY_POLICY, "bestobeypolicy", 0 },
{ 0, 0, 0 }
};