diff options
author | Michael Schroeder <mls@suse.de> | 2012-01-10 17:45:50 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-01-10 17:45:50 +0100 |
commit | 893369ba813883756509df77d083ab005a8bea89 (patch) | |
tree | 4e8628da974bbaf784189583c632070fb0e1aad8 | |
parent | 31b3b6e70b8129382c0830215de4ada3bbe454d5 (diff) | |
download | libsolv-893369ba813883756509df77d083ab005a8bea89.tar.gz libsolv-893369ba813883756509df77d083ab005a8bea89.tar.bz2 libsolv-893369ba813883756509df77d083ab005a8bea89.zip |
- change splitprovides so that they only work on packages that are to be updated.
Thus, the splitprovides flag can always be set and splitprovides also work
with 'zypper dup --from'.
-rwxr-xr-x | examples/p5solv | 4 | ||||
-rwxr-xr-x | examples/pysolv | 4 | ||||
-rwxr-xr-x | examples/rbsolv | 4 | ||||
-rw-r--r-- | examples/solv.c | 4 | ||||
-rw-r--r-- | src/solver.c | 14 |
5 files changed, 15 insertions, 15 deletions
diff --git a/examples/p5solv b/examples/p5solv index bf3dd67..4de66cc 100755 --- a/examples/p5solv +++ b/examples/p5solv @@ -755,14 +755,12 @@ if ($cmd eq 'install' || $cmd eq 'erase' || $cmd eq 'up' || $cmd eq 'dup' || $cm while (1) { $solver = $pool->Solver(); $solver->set_flag($solv::Solver::SOLVER_FLAG_IGNORE_ALREADY_RECOMMENDED, 1); + $solver->set_flag($solv::Solver::SOLVER_FLAG_SPLITPROVIDES, 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; diff --git a/examples/pysolv b/examples/pysolv index 1422027..a63c5e4 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -849,15 +849,13 @@ if cmd == 'install' or cmd == 'erase' or cmd == 'up' or cmd == 'dup' or cmd == ' while True: solver = pool.Solver() solver.set_flag(Solver.SOLVER_FLAG_IGNORE_ALREADY_RECOMMENDED, 1); + solver.set_flag(Solver.SOLVER_FLAG_SPLITPROVIDES, 1); if cmd == 'erase': solver.set_flag(Solver.SOLVER_FLAG_ALLOW_UNINSTALL, 1); if cmd == 'dup' and len(jobs) == 1 and jobs[0].how == (Job.SOLVER_DISTUPGRADE | Job.SOLVER_SOLVABLE_ALL): solver.set_flag(Solver.SOLVER_FLAG_ALLOW_DOWNGRADE, 1); solver.set_flag(Solver.SOLVER_FLAG_ALLOW_VENDORCHANGE, 1); solver.set_flag(Solver.SOLVER_FLAG_ALLOW_ARCHCHANGE, 1); - solver.set_flag(Solver.SOLVER_FLAG_SPLITPROVIDES, 1); - if cmd == 'up' and len(jobs) == 1 and jobs[0].how == (Job.SOLVER_UPDATE | Job.SOLVER_SOLVABLE_ALL): - solver.set_flag(Solver.SOLVER_FLAG_SPLITPROVIDES, 1); problems = solver.solve(jobs) if not problems: break diff --git a/examples/rbsolv b/examples/rbsolv index d12b8a1..ef6f021 100755 --- a/examples/rbsolv +++ b/examples/rbsolv @@ -757,14 +757,12 @@ if cmd == 'install' || cmd == 'erase' || cmd == 'up' || cmd == 'dup' || cmd == ' while true solver = pool.Solver solver.set_flag(Solv::Solver::SOLVER_FLAG_IGNORE_ALREADY_RECOMMENDED, 1) + solver.set_flag(Solv::Solver::SOLVER_FLAG_SPLITPROVIDES, 1) solver.set_flag(Solv::Solver::SOLVER_FLAG_ALLOW_UNINSTALL, 1) if cmd == 'erase' if cmd == 'up' && jobs.length == 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_VENDORCHANGE, 1) solver.set_flag(Solv::Solver::SOLVER_FLAG_ALLOW_ARCHCHANGE, 1) - solver.set_flag(Solv::Solver::SOLVER_FLAG_SPLITPROVIDES, 1) - elsif cmd == 'up' && jobs.length == 1 && jobs[0].how == (Solv::Job::SOLVER_UPDATE | Solv::Job::SOLVER_SOLVABLE_ALL) - solver.set_flag(Solv::Solver::SOLVER_FLAG_SPLITPROVIDES, 1) end problems = solver.solve(jobs) break if problems.empty? diff --git a/examples/solv.c b/examples/solv.c index bf6a622..004a85d 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -2958,14 +2958,12 @@ rerunsolver: solv = solver_create(pool); solver_set_flag(solv, SOLVER_FLAG_IGNORE_ALREADY_RECOMMENDED, 1); - if (allpkgs && !repofilter && mainmode == MODE_UPDATE) - solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1); + solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1); if (mainmode == MODE_DISTUPGRADE && allpkgs && !repofilter) { solver_set_flag(solv, SOLVER_FLAG_ALLOW_DOWNGRADE, 1); solver_set_flag(solv, SOLVER_FLAG_ALLOW_ARCHCHANGE, 1); solver_set_flag(solv, SOLVER_FLAG_ALLOW_VENDORCHANGE, 1); - solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1); } if (mainmode == MODE_ERASE || mainmode == MODE_ERASECLEAN) solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1); /* don't nag */ diff --git a/src/solver.c b/src/solver.c index 9e39643..d11e63b 100644 --- a/src/solver.c +++ b/src/solver.c @@ -35,8 +35,13 @@ /*------------------------------------------------------------------- * handle split provides + * + * a splitprovides dep looks like + * namespace:splitprovides(pkg REL_WITH path) + * and is only true if pkg is installed and contains the specified path. + * we also make sure that pkg is selected for an update, otherwise the + * update would always be forced onto the user. */ - int solver_splitprovides(Solver *solv, Id dep) { @@ -45,7 +50,7 @@ solver_splitprovides(Solver *solv, Id dep) Reldep *rd; Solvable *s; - if (!solv->dosplitprovides || !solv->installed) + if (!solv->dosplitprovides || !solv->installed || (!solv->updatemap_all && !solv->updatemap.size)) return 0; if (!ISRELDEP(dep)) return 0; @@ -54,8 +59,11 @@ solver_splitprovides(Solver *solv, Id dep) return 0; FOR_PROVIDES(p, pp, dep) { + /* here we have packages that provide the correct name and contain the path, + * now do extra filtering */ s = pool->solvables + p; - if (s->repo == solv->installed && s->name == rd->name) + if (s->repo == solv->installed && s->name == rd->name && + (solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, p - solv->installed->start)))) return 1; } return 0; |