]> git.saurik.com Git - apt.git/commitdiff
eipp: implement Immediate-Configuration flag
authorDavid Kalnischkies <david@kalnischkies.de>
Mon, 6 Jun 2016 13:04:42 +0000 (15:04 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Mon, 27 Jun 2016 09:57:12 +0000 (11:57 +0200)
APT has 3 modes: no immediate configuration, all packages are configured
immediately and its default mode of configuring essentials and
pseudo-essentials immediately only. While this seems like a job of
different planers at first, it might be handy to have it as an option,
too, in case a planer (like apts internal one) supports different modes
where the introduction of individual planers would be counter intuitive.

apt-pkg/edsp.cc
apt-pkg/edsp.h
apt-pkg/packagemanager.cc
cmdline/apt-internal-planer.cc
doc/external-installation-planer-protocol.txt

index 21f7f360722e94b8c09f7e626055d6609dbd63f3..e79bb804c60bd41b1317a227033d5593086cb9f2 100644 (file)
@@ -1112,7 +1112,6 @@ bool EIPP::WriteRequest(pkgDepCache &Cache, FileFd &output,               /*{{{*/
                        unsigned int const flags,
                        OpProgress * const Progress)
 {
                        unsigned int const flags,
                        OpProgress * const Progress)
 {
-   (void)(flags);
    if (Progress != NULL)
       Progress->SubProgress(Cache.Head().PackageCount, _("Send request to planer"));
    unsigned long p = 0;
    if (Progress != NULL)
       Progress->SubProgress(Cache.Head().PackageCount, _("Send request to planer"));
    unsigned long p = 0;
@@ -1152,6 +1151,10 @@ bool EIPP::WriteRequest(pkgDepCache &Cache, FileFd &output,              /*{{{*/
    if (reinst.empty() == false)
       WriteOkay(Okay, output, "ReInstall:", reinst, "\n");
    WriteOkay(Okay, output, "Planer: ", _config->Find("APT::Planer", "internal"), "\n");
    if (reinst.empty() == false)
       WriteOkay(Okay, output, "ReInstall:", reinst, "\n");
    WriteOkay(Okay, output, "Planer: ", _config->Find("APT::Planer", "internal"), "\n");
+   if ((flags & Request::IMMEDIATE_CONFIGURATION_ALL) != 0)
+      WriteOkay(Okay, output, "Immediate-Configuration: yes\n");
+   else if ((flags & Request::NO_IMMEDIATE_CONFIGURATION) != 0)
+      WriteOkay(Okay, output, "Immediate-Configuration: no\n");
    return WriteOkay(Okay, output, "\n");
 }
                                                                        /*}}}*/
    return WriteOkay(Okay, output, "\n");
 }
                                                                        /*}}}*/
@@ -1379,6 +1382,13 @@ bool EIPP::ReadRequest(int const input, std::list<std::pair<std::string,PKG_ACTI
            _config->Set("APT::Architectures", SubstVar(line, " ", ","));
         else if (LineStartsWithAndStrip(line, "Planer:"))
            ; // purely informational line
            _config->Set("APT::Architectures", SubstVar(line, " ", ","));
         else if (LineStartsWithAndStrip(line, "Planer:"))
            ; // purely informational line
+        else if (LineStartsWithAndStrip(line, "Immediate-Configuration:"))
+        {
+           if (localStringToBool(line, true))
+              flags |= Request::IMMEDIATE_CONFIGURATION_ALL;
+           else
+              flags |= Request::NO_IMMEDIATE_CONFIGURATION;
+        }
         else
            _error->Warning("Unknown line in EIPP Request stanza: %s", line.c_str());
 
         else
            _error->Warning("Unknown line in EIPP Request stanza: %s", line.c_str());
 
index 271cbb6a83e3401f189266baac01d11de2c2fa01..e1ffdf59807bdfa4818bb3933c74751149b5051f 100644 (file)
@@ -239,8 +239,17 @@ namespace EDSP                                                             /*{{{*/
 class pkgPackageManager;
 namespace EIPP                                                         /*{{{*/
 {
 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 */
+      };
+   }
+
    APT_HIDDEN bool WriteRequest(pkgDepCache &Cache, FileFd &output,
    APT_HIDDEN bool WriteRequest(pkgDepCache &Cache, FileFd &output,
-        unsigned int const version, OpProgress * const Progress);
+        unsigned int const flags, OpProgress * const Progress);
    APT_HIDDEN bool WriteScenario(pkgDepCache &Cache, FileFd &output,
         OpProgress * const Progress);
 
    APT_HIDDEN bool WriteScenario(pkgDepCache &Cache, FileFd &output,
         OpProgress * const Progress);
 
index 173fa80857d3cd56e3873ef61b8a86a01eab41a2..d5afceb6dc6a7824252e9f096d822755040ea8a8 100644 (file)
@@ -1040,7 +1040,13 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
    std::string const planer = _config->Find("APT::Planer", "internal");
    if (planer != "internal")
    {
    std::string const planer = _config->Find("APT::Planer", "internal");
    if (planer != "internal")
    {
-      if (EIPP::OrderInstall(planer.c_str(), this, 0, nullptr))
+      unsigned int flags = 0;
+      if (_config->FindB("APT::Immediate-Configure", true) == false)
+        flags |= EIPP::Request::NO_IMMEDIATE_CONFIGURATION;
+      else if (_config->FindB("APT::Immediate-Configure-All", false))
+        flags |= EIPP::Request::IMMEDIATE_CONFIGURATION_ALL;
+
+      if (EIPP::OrderInstall(planer.c_str(), this, flags, nullptr))
         return Completed;
       else
         return Failed;
         return Completed;
       else
         return Failed;
index 676d84001731370b01a30a713d1cfc42a0c3d76c..0657be3b2ac8dfc769f8962e4d0f9f315e156416 100644 (file)
@@ -150,6 +150,8 @@ int main(int argc,const char *argv[])                                       /*{{{*/
        unsigned int flags;
        if (EIPP::ReadRequest(input, actions, flags) == false)
                DIE("Parsing the request failed!");
        unsigned int flags;
        if (EIPP::ReadRequest(input, actions, flags) == false)
                DIE("Parsing the request failed!");
+       _config->Set("APT::Immediate-Configure", (flags & EIPP::Request::NO_IMMEDIATE_CONFIGURATION) == 0);
+       _config->Set("APT::Immediate-Configure-All", (flags & EIPP::Request::IMMEDIATE_CONFIGURATION_ALL) != 0);
 
        EDSP::WriteProgress(5, "Read scenario…", output);
 
 
        EDSP::WriteProgress(5, "Read scenario…", output);
 
index 028c4249ffff50afca35bceb4945da1176eab1d0..7760ecf60d3fcc5d7087770ed3cb8accf7c4ea05 100644 (file)
@@ -162,6 +162,14 @@ The following **preference fields** are supported in request stanzas:
   informational string specifying to which planer this request was send
   initially.
 
   informational string specifying to which planer this request was send
   initially.
 
+- *Immediate-Configuration:** (option, unset by default) A boolean value
+  defining if the planer should try to configure all packages as quickly
+  as possible (true) or shouldn't perform any kind of immediate
+  configuration at all (false). If not explicitly set with this field
+  the planer is free to pick either mode or implementing e.g. a mode
+  which configures only packages immediately if they are flagged as
+  `Essential` (or are dependencies of packages marked as `Essential`).
+
 
 #### Package universe
 
 
 #### Package universe