X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/43c71fad3a51d841132ba15a7a5930e1ee4126ed..15e1ed52a741ff82deb0a4cd6150cf10e23b7368:/apt-pkg/edsp.h diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h index 9e92e59d9..ed49ac28c 100644 --- a/apt-pkg/edsp.h +++ b/apt-pkg/edsp.h @@ -18,6 +18,7 @@ #include #include +#include #ifndef APT_8_CLEANER_HEADERS #include @@ -71,7 +72,7 @@ namespace EDSP /*{{{*/ * it doesn't make sense from an APT resolver point of view like versions * with a negative pin to enable the solver to propose even that as a * solution or at least to be able to give a hint what can be done to - * statisfy a request. + * satisfy a request. * * \param Cache is the known package universe * \param output is written to this "file" @@ -98,7 +99,7 @@ namespace EDSP /*{{{*/ * \return true if universe was composed successfully, otherwise false */ bool WriteLimitedScenario(pkgDepCache &Cache, FileFd &output, - APT::PackageSet const &pkgset, + std::vector const &pkgset, OpProgress *Progress = NULL); bool WriteLimitedScenario(pkgDepCache &Cache, FILE* output, APT::PackageSet const &pkgset, @@ -108,8 +109,9 @@ namespace EDSP /*{{{*/ * * This method takes care of interpreting whatever the solver sends * through the standard output like a solution, progress or an error. - * The main thread should handle his control over to this method to - * wait for the solver to finish the given task + * The main thread should hand his control over to this method to + * wait for the solver to finish the given task. The file descriptor + * used as input is completely consumed and closed by the method. * * \param input file descriptor with the response from the solver * \param Cache the solution should be applied on if any @@ -157,20 +159,20 @@ namespace EDSP /*{{{*/ std::list const &remove, pkgDepCache &Cache); - /** \brief encodes the changes in the Cache as a EDSP solution + /** \brief formats a solution stanza for the given version * - * The markers in the Cache are observed and send to given - * file. The solution isn't checked for consistency or alike, - * so even broken solutions can be written successfully, - * but the front-end revicing it will properly fail then. + * EDSP uses a simple format for reporting solutions: + * A single required field name with an ID as value. + * Additional fields might appear as debug aids. * - * \param Cache which represents the solution - * \param output to write the stanzas forming the solution to + * \param output to write the stanza forming the solution to + * \param Type of the stanza, used as field name + * \param Ver this stanza applies to * - * \return true if solution could be written, otherwise false + * \return true if stanza could be written, otherwise false */ - bool WriteSolution(pkgDepCache &Cache, FileFd &output); - bool WriteSolution(pkgDepCache &Cache, FILE* output) APT_DEPRECATED_MSG("Use FileFd-based interface instead"); + bool WriteSolutionStanza(FileFd &output, char const * const Type, pkgCache::VerIterator const &Ver); + bool WriteSolution(pkgDepCache &Cache, FILE* output) APT_DEPRECATED_MSG("Use FileFd-based single-stanza interface instead"); /** \brief sends a progress report * @@ -234,4 +236,41 @@ namespace EDSP /*{{{*/ bool const autoRemove, OpProgress *Progress = NULL); } /*}}}*/ +class pkgPackageManager; +namespace EIPP /*{{{*/ +{ + namespace Request + { + enum Flags + { + IMMEDIATE_CONFIGURATION_ALL = (1 << 0), /*!< try to keep the least amount of packages unconfigured as possible at all times */ + NO_IMMEDIATE_CONFIGURATION = (1 << 1), /*!< do not perform immediate configuration at all */ + ALLOW_TEMPORARY_REMOVE_OF_ESSENTIALS = (1 << 2), /*!< just as the name suggests, very special case and dangerous! */ + }; + } + + APT_HIDDEN bool WriteRequest(pkgDepCache &Cache, FileFd &output, + unsigned int const flags, OpProgress * const Progress); + APT_HIDDEN bool WriteScenario(pkgDepCache &Cache, FileFd &output, + OpProgress * const Progress); + + APT_HIDDEN bool OrderInstall(char const * const planner, pkgPackageManager * const PM, + unsigned int const version, OpProgress * const Progress); + APT_HIDDEN bool ReadResponse(int const input, pkgPackageManager * const PM, + OpProgress * const Progress); + + enum class PKG_ACTION + { + NOOP, + INSTALL, + REINSTALL, + REMOVE + }; + bool ReadRequest(int const input, + std::list> &actions, + unsigned int &flags); + bool ApplyRequest(std::list> &actions, + pkgDepCache &Cache); +} + /*}}}*/ #endif