summaryrefslogtreecommitdiff
path: root/examples/p5solv
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-01-09 14:35:26 +0100
committerMichael Schroeder <mls@suse.de>2012-01-09 14:35:26 +0100
commit4c6908cd35063f06478338d66072b6823ff1ac17 (patch)
treecd10837d64a8ebb76636ad7ba859d2e3fbf6e6d0 /examples/p5solv
parent80445cc0bda870adb1c44aae2a85a2755526de4a (diff)
downloadlibsolv-4c6908cd35063f06478338d66072b6823ff1ac17.tar.gz
libsolv-4c6908cd35063f06478338d66072b6823ff1ac17.tar.bz2
libsolv-4c6908cd35063f06478338d66072b6823ff1ac17.zip
- hide solver internals
Diffstat (limited to 'examples/p5solv')
-rwxr-xr-xexamples/p5solv24
1 files changed, 11 insertions, 13 deletions
diff --git a/examples/p5solv b/examples/p5solv
index 804b864..bf3dd67 100755
--- a/examples/p5solv
+++ b/examples/p5solv
@@ -728,9 +728,9 @@ if ($cmd eq 'list' || $cmd eq 'info') {
if ($cmd eq 'install' || $cmd eq 'erase' || $cmd eq 'up' || $cmd eq 'dup' || $cmd eq 'verify') {
if (!@jobs) {
- if ($cmd eq 'up' || $cmd eq 'verify') {
+ if ($cmd eq 'up' || $cmd eq 'verify' || $cmd eq 'dup') {
push @jobs, $pool->Job($solv::Job::SOLVER_SOLVABLE_ALL, 0);
- } elsif ($cmd ne 'dup') {
+ } else {
die("no package matched.\n");
}
}
@@ -754,17 +754,15 @@ if ($cmd eq 'install' || $cmd eq 'erase' || $cmd eq 'up' || $cmd eq 'dup' || $cm
my $solver;
while (1) {
$solver = $pool->Solver();
- $solver->{'ignorealreadyrecommended'} = 1;
- $solver->{'allowuninstall'} = 1 if $cmd eq 'erase';
- if ($cmd eq 'dup' && !@jobs) {
- $solver->{'distupgrade'} = 1;
- $solver->{'updatesystem'} = 1;
- $solver->{'allowdowngrade'} = 1;
- $solver->{'allowvendorchange'} = 1;
- $solver->{'allowarchchange'} = 1;
- $solver->{'dosplitprovides'} = 1;
- } elsif ($cmd eq 'up' and @jobs == 1 and $jobs[0]->{'how'} == ($solv::Job::SOLVER_UPDATE | $solv::Job::SOLVER_SOLVABLE_ALL)) {
- $solver->{'dosplitprovides'} = 1;
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_IGNORE_ALREADY_RECOMMENDED, 1);
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_ALLOW_UNINSTALL, 1) if $cmd eq 'erase';
+ if ($cmd eq 'dup' && @jobs == 1 $jobs[0]->{'how'} == ($solv::Job::SOLVER_DISTUPGRADE | $solv::Job::SOLVER_SOLVABLE_ALL)) {
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_ALLOW_DOWNGRADE, 1);
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_ALLOW_VENDERCHANGE, 1);
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_ALLOW_ARCHCHANGE, 1);
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_SPLITPROVIDES, 1);
+ } elsif ($cmd eq 'up' && @jobs == 1 && $jobs[0]->{'how'} == ($solv::Job::SOLVER_UPDATE | $solv::Job::SOLVER_SOLVABLE_ALL)) {
+ $solver->set_flag($solv::Solver::SOLVER_FLAG_SPLITPROVIDES, 1);
}
my @problems = $solver->solve(\@jobs);
last unless @problems;