From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 11/11] Ensure we only set user_picked when appropriate
Date: Thu, 01 Aug 2019 16:10:00 -0000 [thread overview]
Message-ID: <20190801160519.32745-12-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20190801160519.32745-1-jon.turney@dronecode.org.uk>
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
next prev parent reply other threads:[~2019-08-01 16:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 16:05 [PATCH setup 00/11] Improve handling of specifying an obsolete package to be installed on the command line Jon Turney
2019-08-01 16:05 ` [PATCH setup 02/11] Remove unused packagemeta::key Jon Turney
2019-08-01 16:05 ` [PATCH setup 01/11] Remove 'Bin?' column Jon Turney
2019-08-01 16:06 ` [PATCH setup 03/11] Make packagemeta::message private Jon Turney
2019-08-01 16:07 ` [PATCH setup 04/11] Rename 'Default' packagemeta action to 'NoChange' for clarity Jon Turney
2019-08-01 16:07 ` [PATCH setup 06/11] Use packagemeta::set_action() to update action Jon Turney
2019-08-01 16:07 ` [PATCH setup 05/11] Store the requested action in packagemeta::set_action() Jon Turney
2019-08-01 16:08 ` [PATCH setup 07/11] Use stored action in setting up solver Jon Turney
2019-08-01 16:08 ` [PATCH setup 08/11] Allow better handling of an obsolete package specified on command line Jon Turney
2019-08-01 16:08 ` [PATCH setup 09/11] Use stored action in packagemeta::list_actions() Jon Turney
2019-08-01 16:09 ` [PATCH setup 10/11] Use stored action in packagemeta::action_caption() Jon Turney
2019-08-01 16:10 ` Jon Turney [this message]
2019-12-01 19:32 ` [PATCH setup 00/11] Improve handling of specifying an obsolete package to be installed on the command line Ken Brown
2019-12-03 20:44 ` Jon Turney
2019-12-03 21:16 ` 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=20190801160519.32745-12-jon.turney@dronecode.org.uk \
--to=jon.turney@dronecode.org.uk \
--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).