[PATCH] Revert "Don't override a Keep selection"
Ken Brown
kbrown@cornell.edu
Fri Oct 20 11:08:00 GMT 2017
On 10/19/2017 5:36 PM, Ken Brown wrote:
> Here's a related question. Currently if libsolv decides I should
> install something and I choose Skip instead, it will get installed
> anyway (with no problem report). Maybe we should have a taskSkip that
> generates a SOLVER_LOCK in that case, analogous to taskKeep?
A patch to do that is attached.
Ken
-------------- next part --------------
From a15334af176a4452ef6eef8d42a4de3648ed8b54 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Fri, 20 Oct 2017 06:59:54 -0400
Subject: [PATCH] Don't override a Skip selection
Introduce SolverTasks::taskSkip, and generate it when the user chooses
to Skip a package that the solver wants to install. Implement it by
sending a SOLVER_LOCK command on the package name.
---
choose.cc | 2 +-
libsolv.cc | 20 +++++++++++++++-----
libsolv.h | 2 ++
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/choose.cc b/choose.cc
index ad37639..2a7774d 100644
--- a/choose.cc
+++ b/choose.cc
@@ -420,7 +420,7 @@ ChooserPage::changeTrust(int button, bool test, bool initial)
{
// but initially we want a task list with any package changes caused by
// command line options
- // and we don't want to generate spurious Keep tasks
+ // and we don't want to generate spurious taskKeep or taskSkip tasks
for (packagedb::packagecollection::iterator p = db.packages.begin ();
p != db.packages.end (); ++p)
{
diff --git a/libsolv.cc b/libsolv.cc
index e623555..2a37a92 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -72,13 +72,19 @@ RelId2Operator(Id id)
// a wrapper around a libsolv Solvable
// ---------------------------------------------------------------------------
+Id
+SolvableVersion::name_id () const
+{
+ Solvable *solvable = pool_id2solvable(pool, id);
+ return solvable->name;
+}
+
const std::string
SolvableVersion::Name () const
{
if (!id)
return "";
- Solvable *solvable = pool_id2solvable(pool, id);
- return std::string(pool_id2str(pool, solvable->name));
+ return pool_id2str(pool, name_id());
}
const std::string
@@ -525,9 +531,8 @@ SolverTasks::setTasks()
packagemeta *pkg = p->second;
// decode UI state to action
- // skip and keep don't change dependency solution
- // except when we want to keep a version different from the one
- // chosen by the solver
+ // keep and skip need attention only when they differ from the
+ // solver's solution
if (pkg->installed != pkg->desired)
{
if (pkg->desired)
@@ -542,6 +547,9 @@ SolverTasks::setTasks()
else if (pkg->installed != pkg->default_version)
add(pkg->installed, taskKeep); // keep
}
+ else if (pkg->default_version)
+ add(pkg->default_version, taskSkip); // skip
+
// only install action makes sense for source packages
if (pkg->srcpicked())
{
@@ -714,6 +722,8 @@ SolverSolution::update(SolverTasks &tasks, updateMode update, bool use_test_pack
case SolverTasks::taskKeep:
queue_push2(&job, SOLVER_LOCK | SOLVER_SOLVABLE, sv.id);
break;
+ case SolverTasks::taskSkip:
+ queue_push2(&job, SOLVER_LOCK | SOLVER_SOLVABLE_NAME, sv.name_id());
default:
Log (LOG_PLAIN) << "unknown task " << (*i).second << endLog;
}
diff --git a/libsolv.h b/libsolv.h
index e448841..65e1610 100644
--- a/libsolv.h
+++ b/libsolv.h
@@ -97,6 +97,7 @@ class SolvableVersion
friend SolverSolution;
const PackageDepends deplist(Id keyname) const;
+ Id name_id () const;
};
// ---------------------------------------------------------------------------
@@ -183,6 +184,7 @@ class SolverTasks
taskUninstall,
taskReinstall,
taskKeep,
+ taskSkip,
};
void add(const SolvableVersion &v, task t)
{
--
2.14.2
More information about the Cygwin-apps
mailing list