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 setup 00/14] Use libsolv, solve all our problems... (WIP)
Date: Wed, 30 Aug 2017 21:47:00 -0000	[thread overview]
Message-ID: <8a919cd0-a36a-7b42-4e02-ded7f00ac8f5@cornell.edu> (raw)
In-Reply-To: <fe425591-33fb-a070-a389-73f5f2288800@cornell.edu>

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

On 8/29/2017 9:37 AM, Ken Brown wrote:
> On 5/31/2017 6:50 AM, Jon Turney wrote:
>> ... solve some problems, perhaps add some new ones, I guess.  I'm not 
>> 100%
>> sure this is the right approach to take, but I wrote it, so here it is.
> [...]
>> - As implemented, selecting "Current" overrides "Keep".  This is 
>> wrong, and a
>> change from current behaviour, but is probably a symptom of some deeper
>> confusion in the picker UI I'm not sure how to address
> 
> I think the problem might be the following lines in the definition of 
> SolverSolution::update:
> 
>    if (update)
>      queue_push2(&job, SOLVER_UPDATE | SOLVER_SOLVABLE_ALL, 0);
> 
> When the prerequisite checker calls SolverSolution::update, doesn't this 
> cause the upgrading of old versions that we want to keep (assuming 
> "Current" has been selected)?  As a quick test, I commented out those 
> lines and found that setup.exe let me keep an old version of a package.
> 
> Maybe you need to add a DISABLE_UPDATE command to the solver task list 
> to implement "Keep" for packages that would otherwise be updated.

DISABLE_UPDATE is not a command.  But SOLVER_LOCK seems to do the job. 
Jon, I'm attaching a patch that should apply to the libsolv branch of 
your github cygwin-setup repo.  So far I've only tested it very lightly, 
enough to verify that it lets me keep an old version of a package.

Ken


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

From 26231d3c83c392e6fa267bcea9135f2b5e5af1ca Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 30 Aug 2017 17:36:13 -0400
Subject: [PATCH] Don't override a Keep selection

---
 libsolv.cc     |  3 +++
 libsolv.h      |  3 ++-
 package_db.cc  |  2 +-
 package_meta.h |  2 ++
 prereq.cc      | 12 ++++++++----
 5 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/libsolv.cc b/libsolv.cc
index f509617..67b99b2 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -526,6 +526,9 @@ SolverSolution::update(SolverTasks &tasks, bool update, bool use_test_packages,
           // we don't know how to ask solver for this, so we just add the erase
           // and install later
           break;
+	case SolverTasks::taskKeep:
+	  queue_push2(&job, SOLVER_LOCK | SOLVER_SOLVABLE, sv.id);
+	  break;
         default:
           Log (LOG_PLAIN) << "unknown task " << (*i).second << endLog;
         }
diff --git a/libsolv.h b/libsolv.h
index be518e9..7768128 100644
--- a/libsolv.h
+++ b/libsolv.h
@@ -165,7 +165,8 @@ class SolverTasks
   {
     taskInstall,
     taskUninstall,
-    taskReinstall
+    taskReinstall,
+    taskKeep,
   };
   void add(const SolvableVersion &v, task t)
   {
diff --git a/package_db.cc b/package_db.cc
index 9f9e0a6..d7ec043 100644
--- a/package_db.cc
+++ b/package_db.cc
@@ -522,7 +522,7 @@ packagedb::defaultTrust (trusts trust)
             || pkg.categories.find ("Base") != pkg.categories.end ()
             || pkg.categories.find ("Orphaned") != pkg.categories.end ())
         {
-          pkg.desired = pkg.trustp (true, trust);
+          pkg.desired = pkg.default_version = pkg.trustp (true, trust);
           if (pkg.desired)
             pkg.pick (pkg.desired.accessible() && pkg.desired != pkg.installed);
         }
diff --git a/package_meta.h b/package_meta.h
index b6faab8..d91f7c9 100644
--- a/package_meta.h
+++ b/package_meta.h
@@ -131,6 +131,8 @@ public:
   packageversion curr;
   /* ditto for "test" (experimental) */
   packageversion exp;
+  /* which one is the default according to the chooser global state */
+  packageversion default_version;
   /* Now for the user stuff :] */
   /* What version does the user want ? */
   packageversion desired;
diff --git a/prereq.cc b/prereq.cc
index 49fbd77..8922cc6 100644
--- a/prereq.cc
+++ b/prereq.cc
@@ -170,6 +170,7 @@ PrereqChecker::isMet ()
 
       // decode UI state to action
       // skip and keep don't change dependency solution
+      // except when we want to keep an old version
       if (pkg->installed != pkg->desired)
         {
           if (pkg->desired)
@@ -177,10 +178,13 @@ PrereqChecker::isMet ()
           else
             q.add(pkg->installed, SolverTasks::taskUninstall); // uninstall
         }
-      else
-        if (pkg->picked())
-          q.add(pkg->installed, SolverTasks::taskReinstall); // reinstall
-
+      else if (pkg->installed)
+	{
+	  if (pkg->picked())
+	    q.add(pkg->installed, SolverTasks::taskReinstall); // reinstall
+	  else if (upgrade && pkg->installed < pkg->default_version)
+	    q.add(pkg->installed, SolverTasks::taskKeep); // keep
+	}
       // only install action makes sense for source packages
       if (pkg->srcpicked())
         {
-- 
2.14.1


  reply	other threads:[~2017-08-30 21:47 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 10:53 Jon Turney
2017-05-31 10:53 ` [PATCH setup 02/14] Factor out reading installed.db Jon Turney
2017-05-31 10:53 ` [PATCH setup 01/14] Opaque how PackageDepends is stored Jon Turney
2017-05-31 10:53 ` [PATCH setup 03/14] Hoist addScript() etc. up from packageversion to packagemeta Jon Turney
2017-05-31 10:53 ` [PATCH setup 05/14] Hoist uninstall up to Installer::uninstallOne() Jon Turney
2017-05-31 10:53 ` [PATCH setup 04/14] Hoist pick() up to packagemeta Jon Turney
2017-05-31 10:57 ` [PATCH setup 07/14] Store package stability in class packageversion Jon Turney
2017-05-31 10:57 ` [PATCH setup 06/14] Hoist scan() up from packageversion to packagemeta Jon Turney
2017-05-31 10:57 ` [PATCH setup 08/14] Change to using a libsolv pool for storing package information Jon Turney
2017-05-31 10:57 ` [PATCH setup 09/14] Remove cygpackage class Jon Turney
2017-05-31 10:57 ` [PATCH setup 10/14] Remove packageversion class Jon Turney
2017-05-31 11:05 ` [PATCH setup 11/14] Drop in SolvableVersion as a replacement for packageversion Jon Turney
2017-05-31 11:05   ` [PATCH setup 14/14] Add obsoletes: support Jon Turney
2017-05-31 11:05   ` [PATCH setup 12/14] Use solver to check for problems and produce a list of package transactions Jon Turney
2017-05-31 11:05   ` [PATCH setup 13/14] Download/checksum/install/uninstall what transaction wants Jon Turney
2017-08-29 13:37 ` [PATCH setup 00/14] Use libsolv, solve all our problems... (WIP) Ken Brown
2017-08-30 21:47   ` Ken Brown [this message]
2017-09-01 15:01 ` Ken Brown
2017-09-02 16:57   ` Ken Brown
2017-09-05 13:34     ` Jon Turney
2017-09-05 18:40       ` Achim Gratz
2017-09-06  2:52         ` Ken Brown
2017-11-23 18:10           ` Jon Turney
2017-11-23 20:32             ` Ken Brown
2017-11-23 20:54             ` Achim Gratz
2017-09-08 18:54 ` Ken Brown
2017-09-11 20:40   ` Ken Brown
2017-09-13 19:17     ` Achim Gratz
2017-09-13 21:16       ` Ken Brown
2017-09-14 17:26         ` Achim Gratz
2017-09-14 20:46           ` Ken Brown
2017-09-15 19:24             ` Jon Turney
2017-09-16 16:21               ` Ken Brown
2017-09-19 12:24                 ` Ken Brown
2017-09-19 16:46                   ` Jon Turney
2017-09-19 16:58                     ` Ken Brown
2017-12-05 14:32             ` Jon Turney
2017-12-05 17:36               ` Ken Brown
2017-12-13 17:31               ` Ken Brown
2017-12-13 18:06                 ` Achim Gratz
2017-12-13 22:31                   ` Ken Brown
2017-12-14 14:12                     ` Ken Brown
2017-12-24 15:00                     ` Ken Brown
2018-01-09 13:25                       ` Jon Turney
2018-01-09 15:37                         ` Ken Brown
2018-01-09 15:49                           ` Ken Brown
2018-01-13 14:14                             ` Jon Turney
2018-01-13 19:56                               ` Ken Brown
2018-01-13 21:29                                 ` Brian Inglis
2018-01-13 22:55                                   ` Ken Brown
2018-01-14  0:00                                     ` Ken Brown
2018-01-14  1:52                                       ` Brian Inglis
2018-01-14  2:37                                         ` Ken Brown
2018-01-15 19:02                                 ` Jon Turney
2018-01-15 21:50                                   ` Ken Brown
2018-01-18 19:14                                     ` Jon Turney
2017-09-15 15:15   ` Jon Turney
2017-09-15 16:53     ` Ken Brown
2017-09-15 20:56       ` cyg Simple
2017-09-17 16:02         ` Ken Brown
2017-09-26 14:50       ` Jon Turney
2017-09-26 16:07         ` Ken Brown
2017-09-27 19:14           ` Jon Turney
2017-09-27 20:33             ` Ken Brown
2017-09-29 17:38               ` Jon Turney
2017-09-29 20:34                 ` Ken Brown
2017-10-02 14:07                   ` Jon Turney
2017-10-02 15:17                     ` Marco Atzeri
2017-10-04 14:43                       ` Jon Turney
2017-10-10 11:18                   ` Ken Brown
2017-10-10 15:49                     ` Jon Turney
2017-10-17 12:45                     ` Ken Brown
2017-10-17 18:47                       ` Jon Turney
2017-10-18 15:28                         ` Ken Brown
2017-10-18 15:57                           ` Ken Brown

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=8a919cd0-a36a-7b42-4e02-ded7f00ac8f5@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).