From e3c5d8ac0970d8a6bcb870aff2e6fe0e00ab5b44 Mon Sep 17 00:00:00 2001 From: Ken Brown 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