implement '--best' in solv demo
authorMichael Schroeder <mls@suse.de>
Mon, 19 Nov 2012 16:32:07 +0000 (17:32 +0100)
committerMichael Schroeder <mls@suse.de>
Mon, 19 Nov 2012 16:32:07 +0000 (17:32 +0100)
examples/solv.c
ext/testcase.c

index beb5bd3b8c0c99e992b51b88b9685b4dfd70d657..d1857fa0f0c5f5150f6a58abc303541a54ed2162 100644 (file)
@@ -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;
index d8346545c9dde943f54b1d99b8d63b2bb535e58f..da9734c9690323b15335cd4794253650425b2f1c 100644 (file)
@@ -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 }
 };