diff options
author | Michael Schroeder <mls@suse.de> | 2012-11-21 16:21:48 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-11-21 16:21:48 +0100 |
commit | 20ba2e3948781829e25c4c2eade4aaf73c0e1da8 (patch) | |
tree | 0905a383e5fef772641a9653465d43fa13e0efc0 | |
parent | 78bc17cb1b658e723e7855c0cc645c68f2971a6e (diff) | |
download | libsolv-20ba2e3948781829e25c4c2eade4aaf73c0e1da8.tar.gz libsolv-20ba2e3948781829e25c4c2eade4aaf73c0e1da8.tar.bz2 libsolv-20ba2e3948781829e25c4c2eade4aaf73c0e1da8.zip |
use "isemptyupdate" method to check for updates with no matching installed package
-rwxr-xr-x | examples/p5solv | 7 | ||||
-rwxr-xr-x | examples/pysolv | 7 | ||||
-rwxr-xr-x | examples/rbsolv | 7 |
3 files changed, 7 insertions, 14 deletions
diff --git a/examples/p5solv b/examples/p5solv index 8a63631..cd24602 100755 --- a/examples/p5solv +++ b/examples/p5solv @@ -600,11 +600,8 @@ if ($cmd eq 'install' || $cmd eq 'erase' || $cmd eq 'up' || $cmd eq 'dup' || $cm die("no package matched.\n") unless @jobs; for my $job (@jobs) { if ($cmd eq 'up') { - if ($job->{'how'} == $solv::Job::SOLVER_SOLVABLE_ALL || grep {$_->isinstalled()} $job->solvables()) { - $job->{'how'} |= $solv::Job::SOLVER_UPDATE; - } else { - $job->{'how'} |= $solv::Job::SOLVER_INSTALL; - } + $job->{'how'} |= $solv::Job::SOLVER_UPDATE; + $job->{'how'} ^= $solv::Job::SOLVER_UPDATE ^ $solv::Job::SOLVER_INSTALL if $job->isemptyupdate(); } elsif ($cmd eq 'install') { $job->{'how'} |= $solv::Job::SOLVER_INSTALL; } elsif ($cmd eq 'erase') { diff --git a/examples/pysolv b/examples/pysolv index 4ad4ca4..41f5cda 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -730,11 +730,10 @@ if cmd == 'install' or cmd == 'erase' or cmd == 'up' or cmd == 'dup' or cmd == ' sys.exit(1) for job in jobs: if cmd == 'up': + job.how |= Job.SOLVER_UPDATE # up magic: use install instead of update if no installed package matches - if job.how == Job.SOLVER_SOLVABLE_ALL or filter(lambda s: s.isinstalled(), job.solvables()): - job.how |= Job.SOLVER_UPDATE - else: - job.how |= Job.SOLVER_INSTALL + if job.isemptyupdate(): + job.how ^= Job.SOLVER_UPDATE ^ Job.SOLVER_INSTALL elif cmd == 'install': job.how |= Job.SOLVER_INSTALL elif cmd == 'erase': diff --git a/examples/rbsolv b/examples/rbsolv index 26e98e7..92edf8d 100755 --- a/examples/rbsolv +++ b/examples/rbsolv @@ -613,11 +613,8 @@ if cmd == 'install' || cmd == 'erase' || cmd == 'up' || cmd == 'dup' || cmd == ' abort("no package matched.") if jobs.empty? for job in jobs if cmd == 'up' - if job.how == Solv::Job::SOLVER_SOLVABLE_ALL || job.solvables.any? {|s| s.isinstalled?} - job.how |= Solv::Job::SOLVER_UPDATE - else - job.how |= Solv::Job::SOLVER_INSTALL - end + job.how |= Solv::Job::SOLVER_UPDATE + job.how ^= Solv::Job::SOLVER_UPDATE ^ Solv::Job::SOLVER_INSTALL if job.isemptyupdate? elsif cmd == 'install' job.how |= Solv::Job::SOLVER_INSTALL elsif cmd == 'erase' |