use POSIX;
use Fcntl;
use Config::IniFiles;
-use File::FnMatch;
use Data::Dumper;
use solv;
use Devel::Peek;
return undef if sysread($f, $fextcookie, 32) != 32;
}
sysseek($f, 0, Fcntl::SEEK_SET);
- $f = solv::xfopen_dup(undef, fileno($f));
+ my $fd = solv::xfopen_dup(undef, fileno($f));
my $flags = $ext ? $solv::Repo::REPO_USE_LOADING|$solv::Repo::REPO_EXTEND_SOLVABLES : 0;
$flags |= $solv::Repo::REPO_LOCALPOOL if $ext && $ext ne 'DL';
- if (!$self->{'handle'}->add_solv($f, $flags)) {
- solv::xfclose($f);
+ if (!$self->{'handle'}->add_solv($fd, $flags)) {
+ solv::xfclose($fd);
return undef;
}
- solv::xfclose($f);
+ solv::xfclose($fd);
$self->{'cookie'} = $fcookie unless $ext;
$self->{'extcookie'} = $fextcookie if $fextcookie;
utime undef, undef, $f if $mark;
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");
}
}
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;