From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69877 invoked by alias); 1 Aug 2019 16:08:35 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 69799 invoked by uid 89); 1 Aug 2019 16:08:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=tasks, installation X-HELO: rgout0806.bt.lon5.cpcloud.co.uk Received: from rgout0806.bt.lon5.cpcloud.co.uk (HELO rgout0806.bt.lon5.cpcloud.co.uk) (65.20.0.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Aug 2019 16:08:33 +0000 X-OWM-Source-IP: 31.51.206.148 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-SNCR-VADESECURE: CLEAN Received: from localhost.localdomain (31.51.206.148) by rgout08.bt.lon5.cpcloud.co.uk (9.0.019.26-1) (authenticated as jonturney@btinternet.com) id 5BC47A871A4DF6D4; Thu, 1 Aug 2019 17:08:32 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 08/11] Allow better handling of an obsolete package specified on command line Date: Thu, 01 Aug 2019 16:08:00 -0000 Message-Id: <20190801160519.32745-9-jon.turney@dronecode.org.uk> In-Reply-To: <20190801160519.32745-1-jon.turney@dronecode.org.uk> References: <20190801160519.32745-1-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-08/txt/msg00008.txt.bz2 Now we have the flexibilty to record a package as explicitly required to be installed, rather than merely installed because the desired version is different to the installed version, we can record packages selected for installation on the command line as distinct from choosing a specific version of that package via the picker. Use this to allow the solver to make a better choice of what provides a package name specified on the command line. (Note that we need to use SOLVER_SOLVABLE_PROVIDES rather than SOLVER_SOLVABLE_NAME to allow the solver to take packages which provide and obsolete the named package into account.) Only turn this behaviour on when --upgrade-also is specified. e.g. setup -q -g -P python3-lxml currently gets you an (empty) python3-lxml package, which is replaced by python36-lxml (which obsoletes it) on the next setup run. After this change, python36-lxml is installed instead. See also the dicusssion at https://cygwin.com/ml/cygwin-apps/2017-10/msg00092.html et seq. --- choose.cc | 2 +- libsolv.cc | 8 +++++++- libsolv.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/choose.cc b/choose.cc index 7f6e332..be08627 100644 --- a/choose.cc +++ b/choose.cc @@ -299,7 +299,7 @@ ChooserPage::applyCommandLinePackageSelection() bool uninstall = (!(wanted || base) && (deleted || PruneInstallOption)) || (orphaned && CleanOrphansOption); if (install) - pkg.set_action (packagemeta::Install_action, pkg.curr); + pkg.set_action (packagemeta::Install_action, UpgradeAlsoOption ? packageversion () : pkg.curr); else if (reinstall) pkg.set_action (packagemeta::Reinstall_action, pkg.curr); else if (uninstall) diff --git a/libsolv.cc b/libsolv.cc index cbc651b..d7a9d01 100644 --- a/libsolv.cc +++ b/libsolv.cc @@ -653,7 +653,10 @@ SolverTasks::setTasks() break; case packagemeta::Install_action: - add(pkg->desired, taskInstall); // install/upgrade + if (pkg->desired) + add(pkg->desired, taskInstall); // install/upgrade + else + add(pkg->curr, taskInstallAny); // install break; case packagemeta::Uninstall_action: @@ -829,6 +832,9 @@ SolverSolution::tasksToJobs(SolverTasks &tasks, updateMode update, Queue &job) case SolverTasks::taskInstall: queue_push2(&job, SOLVER_INSTALL | SOLVER_SOLVABLE, sv.id); break; + case SolverTasks::taskInstallAny: + queue_push2(&job, SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES, sv.name_id()); + break; case SolverTasks::taskUninstall: queue_push2(&job, SOLVER_ERASE | SOLVER_SOLVABLE, sv.id); break; diff --git a/libsolv.h b/libsolv.h index 4fd6d61..43f7269 100644 --- a/libsolv.h +++ b/libsolv.h @@ -197,6 +197,7 @@ class SolverTasks taskKeep, taskSkip, taskForceDistUpgrade, + taskInstallAny, }; void add(const SolvableVersion &v, task t) { -- 2.21.0