]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
Allow user to refuse the default problem solutions
authorKen Brown <kbrown@cornell.edu>
Sat, 16 Sep 2017 15:39:40 +0000 (11:39 -0400)
committerJon Turney <jon.turney@dronecode.org.uk>
Sun, 28 Jan 2018 15:10:44 +0000 (15:10 +0000)
Add new method SolverSolution::db2trans to change the solver's
transaction list to reflect the package database.  Use it if the user
refuses the default problem solutions.  Reinstate warning that this
could cause breakage.

Remove PrereqPage::OnMessageCmd, which is no longer needed (and which
disallows clicking Next if the "Accept default problem solutions" box
is unchecked).

v2:
Tweak MessageBox text

libsolv.cc
libsolv.h
prereq.cc
prereq.h

index be3dae7386cb774493b498cdae1791fa751d9794..6d91642059a70aa33f7f33c80d3ce759882ee167 100644 (file)
@@ -582,6 +582,35 @@ SolverSolution::trans2db() const
     }
 }
 
+void
+SolverSolution::db2trans()
+{
+  trans.clear();
+  packagedb db;
+
+  for (packagedb::packagecollection::iterator p = db.packages.begin ();
+       p != db.packages.end (); ++p)
+    {
+      packagemeta *pkg = p->second;
+      if (pkg->desired && pkg->picked()) // install/upgrade/reinstall
+        {
+          trans.push_back(SolverTransaction(pkg->desired, SolverTransaction::transInstall));
+          if (pkg->installed)
+            trans.push_back(SolverTransaction(pkg->installed, SolverTransaction::transErase));
+        }
+      else if (!pkg->desired && pkg->installed) // uninstall
+        trans.push_back(SolverTransaction(pkg->installed, SolverTransaction::transErase));
+
+      if (pkg->srcpicked())
+        {
+          if (pkg->desired)
+            trans.push_back(SolverTransaction(pkg->desired.sourcePackage(), SolverTransaction::transInstall));
+          else
+            trans.push_back(SolverTransaction(pkg->installed.sourcePackage(), SolverTransaction::transInstall));
+        }
+    }
+}
+
 static
 std::ostream &operator<<(std::ostream &stream,
                          SolverTransaction::transType type)
index f270e87216181c650856e6ab1636aefb2387d15b..e9530ea36e60219a0f72be1dbd641a0529c66e95 100644 (file)
--- a/libsolv.h
+++ b/libsolv.h
@@ -232,6 +232,9 @@ class SolverSolution
   /* Reset package database to correspond to trans */
   void trans2db() const;
 
+  /* Reset transaction list to correspond to package database */
+  void db2trans();
+
   bool update(SolverTasks &tasks, bool update, bool use_test_packages, bool include_source);
   std::string report() const;
 
index 6f3d1d7220a4b6b7cf8fb1fde352fbbe872d62ac..df4671e6f006b0d0db67c41f53b5e9ca260c9772 100644 (file)
--- a/prereq.cc
+++ b/prereq.cc
@@ -93,7 +93,25 @@ PrereqPage::OnNext ()
 
   if (!IsDlgButtonChecked (h, IDC_PREREQ_CHECK))
     {
-      return -1;
+      // breakage imminent!  danger, danger
+      int res = MessageBox (h,
+          "We strongly recommend that you accept the default solutions. "
+          "Some packages may not work properly if you don't."
+          "\r\n\r\n"
+          "Are you sure you want to proceed?",
+          "WARNING - Unsolved Problems",
+          MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2);
+      if (res == IDNO)
+        return -1;
+      else
+        {
+          Log (LOG_PLAIN) <<
+            "NOTE!  User refused the default solutions!  "
+            "Expect some packages to give errors or not function at all." << endLog;
+          // Change the solver's transaction list to reflect the user's choices.
+          packagedb db;
+          db.solution.db2trans();
+        }
     }
 
   return whatNext();
@@ -136,18 +154,6 @@ PrereqPage::OnUnattended ()
   return whatNext();
 }
 
-bool
-PrereqPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
-{
-  if ((code == BN_CLICKED) && (id == IDC_PREREQ_CHECK))
-    {
-      GetOwner ()->SetButtons (PSWIZB_BACK | (IsButtonChecked (id) ? PSWIZB_NEXT : 0));
-      return true;
-    }
-
-  return false;
-}
-
 // ---------------------------------------------------------------------------
 // implements class PrereqChecker
 // ---------------------------------------------------------------------------
index 1c0e05b746ab187ea77329303cfe858d7bae3a44..1ddb6849361f2956a5351d968f7b80f595beaa42 100644 (file)
--- a/prereq.h
+++ b/prereq.h
@@ -27,7 +27,6 @@ public:
   virtual long OnNext ();
   virtual long OnBack ();
   virtual long OnUnattended ();
-  virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code);
 private:
   long whatNext ();
 };
This page took 0.035307 seconds and 5 git commands to generate.