From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps@cygwin.com
Subject: Re: setup libsolv UI: Silently install dependencies?
Date: Mon, 15 Jan 2018 17:31:00 -0000 [thread overview]
Message-ID: <dff26d0d-bb3e-3d84-0519-36bcb3338103@cornell.edu> (raw)
In-Reply-To: <11d9690d-ea39-9547-e3b3-e42697f12849@dronecode.org.uk>
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
On 1/9/2018 8:32 AM, Jon Turney wrote:
> I'm not sure it's ideal to make a text report of this, though.
> Displaying it in the chooser somehow seems a better fit.
>
> (i.e. after you've made your selections, you get something like the
> "pending" view in the chooser again, showing what will be done, which
> you can either confirm or go back from)
Here's another attempt, lightly tested, which might still need some
improvements. It goes back to the chooser, but it doesn't set the
pending view. I'm not sure how to do that without a lot of refactoring,
but maybe I'm missing something easy.
Ken
[-- Attachment #2: 0001-Let-the-user-review-added-dependencies.patch --]
[-- Type: text/plain, Size: 2464 bytes --]
From d183ee53ff0471f22fe2412381e8507e4c109b1e Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Mon, 15 Jan 2018 12:18:30 -0500
Subject: [PATCH] Let the user review added dependencies
If the solver finds no problems but added packages to resolve
dependencies, give the user a chance to go back to the chooser and
review what's about to happen.
---
prereq.cc | 46 ++++++++++++++++++++++++++++++++++++++++------
1 file changed, 40 insertions(+), 6 deletions(-)
diff --git a/prereq.cc b/prereq.cc
index a03e79b..4053373 100644
--- a/prereq.cc
+++ b/prereq.cc
@@ -140,13 +140,18 @@ PrereqPage::whatNext ()
return IDD_INSTATUS;
}
-long
-PrereqPage::OnBack ()
+static void
+prepBack ()
{
// Reset the package database to correspond to the solver's solution
packagedb db;
db.solution.trans2db();
+}
+long
+PrereqPage::OnBack ()
+{
+ prepBack ();
return IDD_CHOOSE;
}
@@ -213,6 +218,23 @@ PrereqChecker::getUnmetString (std::string &s)
// progress page glue
// ---------------------------------------------------------------------------
+static bool
+added_deps ()
+{
+ packagedb db;
+ const SolverTransactionList & trans = db.solution.transactions ();
+ for (SolverTransactionList::const_iterator i = trans.begin ();
+ i != trans.end (); i++)
+ if (i->type == SolverTransaction::transInstall)
+ {
+ packageversion pv = i->version;
+ packagemeta *pkg = db.findBinary (PackageSpecification (pv.Name ()));
+ if (!pkg->desired)
+ return true;
+ }
+ return false;
+}
+
static int
do_prereq_check_thread(HINSTANCE h, HWND owner)
{
@@ -223,11 +245,23 @@ do_prereq_check_thread(HINSTANCE h, HWND owner)
{
p.finalize();
- if (source == IDC_SOURCE_LOCALDIR)
- Progress.SetActivateTask (WM_APP_START_INSTALL); // install
+ if (added_deps () && !unattended_mode
+ && MessageBox (owner, "Packages were added to resolve dependencies. "
+ "Do you want to review them before proceeding?",
+ "Added Dependencies",
+ MB_YESNO | MB_DEFBUTTON2) == IDYES)
+ {
+ prepBack ();
+ retval = IDD_CHOOSE;
+ }
else
- Progress.SetActivateTask (WM_APP_START_DOWNLOAD); // start download
- retval = IDD_INSTATUS;
+ {
+ if (source == IDC_SOURCE_LOCALDIR)
+ Progress.SetActivateTask (WM_APP_START_INSTALL); // install
+ else
+ Progress.SetActivateTask (WM_APP_START_DOWNLOAD); // start download
+ retval = IDD_INSTATUS;
+ }
}
else
{
--
2.15.1
next prev parent reply other threads:[~2018-01-15 17:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-24 23:23 Ken Brown
2017-12-25 19:18 ` Ken Brown
2018-01-09 13:25 ` Jon Turney
2018-01-05 15:49 ` Jon Turney
2018-01-05 16:04 ` Ken Brown
2018-01-09 13:32 ` Jon Turney
2018-01-09 15:40 ` Ken Brown
2018-01-15 17:31 ` Ken Brown [this message]
2018-01-22 17:36 ` 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=dff26d0d-bb3e-3d84-0519-36bcb3338103@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).