From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75949 invoked by alias); 1 Aug 2019 16:10:32 -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 75933 invoked by uid 89); 1 Aug 2019 16:10:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 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= X-HELO: rgout08.bt.lon5.cpcloud.co.uk Received: from rgout08.bt.lon5.cpcloud.co.uk (HELO rgout08.bt.lon5.cpcloud.co.uk) (65.20.0.185) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Aug 2019 16:10:30 +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 5BC47A871A4E011D; Thu, 1 Aug 2019 17:10:28 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 11/11] Ensure we only set user_picked when appropriate Date: Thu, 01 Aug 2019 16:10:00 -0000 Message-Id: <20190801160519.32745-12-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/msg00011.txt.bz2 Add an optional parameter to set_action(), to indicate the action is the result of user action, and only set user_picked then. Set that parameter when installing from the command line. All other user actions come through select_action(), so also set that parameter there. --- choose.cc | 2 +- package_meta.cc | 14 +++++++------- package_meta.h | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/choose.cc b/choose.cc index be08627..4fa0c74 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, UpgradeAlsoOption ? packageversion () : pkg.curr); + pkg.set_action (packagemeta::Install_action, UpgradeAlsoOption ? packageversion () : pkg.curr, true); else if (reinstall) pkg.set_action (packagemeta::Reinstall_action, pkg.curr); else if (uninstall) diff --git a/package_meta.cc b/package_meta.cc index b417fb0..940f69a 100644 --- a/package_meta.cc +++ b/package_meta.cc @@ -462,12 +462,8 @@ packagemeta::select_action (int id, trusts const deftrust) if (id == packagemeta::NoChange_action) set_action((packagemeta::_actions)id, installed); else - set_action((packagemeta::_actions)id, trustp (true, deftrust)); + set_action((packagemeta::_actions)id, trustp (true, deftrust), true); } - - /* Memorize the fact that the user picked at least once. */ - if (!installed) - user_picked = true; } // toggle between the currently installed version (or uninstalled, if not @@ -526,7 +522,8 @@ packagemeta::list_actions(trusts const trust) // Set a particular type of action. void -packagemeta::set_action (_actions action, packageversion const &default_version) +packagemeta::set_action (_actions action, packageversion const &default_version, + bool useraction) { if (action == NoChange_action) { @@ -557,7 +554,10 @@ packagemeta::set_action (_actions action, packageversion const &default_version) if (desired != installed) if (desired.accessible ()) { - user_picked = true; + /* Memorize the fact that the user picked to install this package at least once. */ + if (useraction) + user_picked = true; + pick (true); srcpick (false); } diff --git a/package_meta.h b/package_meta.h index e2144ad..1f4f3be 100644 --- a/package_meta.h +++ b/package_meta.h @@ -60,7 +60,8 @@ public: }; static const char *action_caption (_actions value); - void set_action (_actions, packageversion const & default_version); + void set_action (_actions, packageversion const & default_version, + bool useraction = false); ActionList *list_actions(trusts const trust); void select_action (int id, trusts const deftrust); void toggle_action (); -- 2.21.0