public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* setup libsolv UI: Silently install dependencies?
@ 2017-12-24 23:23 Ken Brown
  2017-12-25 19:18 ` Ken Brown
  2018-01-05 15:49 ` Jon Turney
  0 siblings, 2 replies; 9+ messages in thread
From: Ken Brown @ 2017-12-24 23:23 UTC (permalink / raw)
  To: cygwin-apps

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

Currently the libsolv version of setup silently installs added 
dependencies.  The user gets a chance to review them first only if 
libsolv finds problems and has to display the prerequisite page.

I'm not sure if this was a deliberate design decision, though I 
personally like it.  On the other hand, I suspect that some users won't 
like it because they're used to seeing a report about missing 
dependencies.  So I think we should make this behavior optional.

The attached patch is a start in that direction.  But it needs a 
followup patch to implement the mechanism for selecting the option.  One 
possibility is a checkbox on the chooser page, which then gets saved in 
setup.rc as a user option.  Are there other suggestions?

Ken

[-- Attachment #2: 0001-Let-the-user-review-added-dependencies.patch --]
[-- Type: text/plain, Size: 2388 bytes --]

From e3c5d8ac0970d8a6bcb870aff2e6fe0e00ab5b44 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Sun, 24 Dec 2017 16:05:33 -0500
Subject: [PATCH setup libsolv] Let the user review added dependencies

If libsolv finds no problems but there were added dependencies,
optionally activate the prerequisite page so that the user can go back
and see what was added.

This uses a new helper function prereq.cc:added_deps().

The option is contolled by a new bool data member
PrereqChecker::report_added_deps.  At the moment this is always
'true', for consistency with the currently released setup, but a
future commit will enable a way for the user to set the option.
---
 prereq.cc | 23 +++++++++++++++++++++--
 prereq.h  |  1 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/prereq.cc b/prereq.cc
index bf7661a..0c06a32 100644
--- a/prereq.cc
+++ b/prereq.cc
@@ -157,8 +157,26 @@ PrereqPage::OnUnattended ()
 // implements class PrereqChecker
 // ---------------------------------------------------------------------------
 
-// instantiate the static member
+// instantiate the static members
 bool PrereqChecker::use_test_packages;
+bool PrereqChecker::report_added_deps = true;
+
+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;
+}
 
 bool
 PrereqChecker::isMet ()
@@ -174,7 +192,8 @@ PrereqChecker::isMet ()
   q.setTasks();
 
   // apply solver to those tasks and global state (use test, include source)
-  return db.solution.update(q, SolverSolution::keep, use_test_packages, IncludeSource);
+  return db.solution.update(q, SolverSolution::keep, use_test_packages, IncludeSource)
+    && !(report_added_deps && added_deps ());
 }
 
 /* Formats problems and solutions as a string for display to the user.  */
diff --git a/prereq.h b/prereq.h
index 5ae9323..a14789a 100644
--- a/prereq.h
+++ b/prereq.h
@@ -44,6 +44,7 @@ public:
 
 private:
   static bool use_test_packages;
+  static bool report_added_deps;
 };
 
 #endif /* SETUP_PREREQ_H */
-- 
2.15.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-22 17:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-24 23:23 setup libsolv UI: Silently install dependencies? 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
2018-01-22 17:36         ` Ken Brown

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).