public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps@cygwin.com
Subject: Re: [PATCH] Revert "Don't override a Keep selection"
Date: Fri, 20 Oct 2017 11:08:00 -0000	[thread overview]
Message-ID: <45147a59-77fb-7dce-723f-df356f722cc8@cornell.edu> (raw)
In-Reply-To: <956a35ef-e577-a0ef-a758-f920b73a30eb@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

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


[-- Attachment #2: 0001-Don-t-override-a-Skip-selection.patch --]
[-- Type: text/plain, Size: 3419 bytes --]

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


  reply	other threads:[~2017-10-20 11:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 19:13 Ken Brown
2017-10-17 18:43 ` Jon Turney
2017-10-17 19:32   ` Ken Brown
2017-10-19  3:01     ` Ken Brown
2017-10-19 15:05       ` Ken Brown
2017-10-19 21:36         ` Ken Brown
2017-10-20 11:08           ` Ken Brown [this message]
2017-10-23 12:17             ` Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45147a59-77fb-7dce-723f-df356f722cc8@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).