summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-06-06 17:58:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-06-27 11:57:12 +0200
commit8d1cb6da6e21302c654da3f09de3975af7e4a11f (patch)
treeeb859b40742234e02d00f44f1b26702c538220eb
parent91abb30f1c46287d386b646cef8cb42eadcaa250 (diff)
eipp: add Allow-Temporary-Remove-of-Essentials
A rather special need option, but the internal planer supports this and we have a testcase for it & sometimes it is hit (as a bug through). The option itself mostly serves as a reminder for implementors that they should be careful with removes and especially temporary removes if they perform any.
-rw-r--r--apt-pkg/edsp.cc4
-rw-r--r--apt-pkg/edsp.h1
-rw-r--r--apt-pkg/packagemanager.cc2
-rw-r--r--cmdline/apt-internal-planer.cc1
-rw-r--r--doc/external-installation-planer-protocol.txt14
5 files changed, 19 insertions, 3 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index e79bb804c..1c6be8afe 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -1155,6 +1155,8 @@ bool EIPP::WriteRequest(pkgDepCache &Cache, FileFd &output, /*{{{*/
WriteOkay(Okay, output, "Immediate-Configuration: yes\n");
else if ((flags & Request::NO_IMMEDIATE_CONFIGURATION) != 0)
WriteOkay(Okay, output, "Immediate-Configuration: no\n");
+ else if ((flags & Request::ALLOW_TEMPORARY_REMOVE_OF_ESSENTIALS) != 0)
+ WriteOkay(Okay, output, "Allow-Temporary-Remove-of-Essentials: yes\n");
return WriteOkay(Okay, output, "\n");
}
/*}}}*/
@@ -1389,6 +1391,8 @@ bool EIPP::ReadRequest(int const input, std::list<std::pair<std::string,PKG_ACTI
else
flags |= Request::NO_IMMEDIATE_CONFIGURATION;
}
+ else if (ReadFlag(flags, line, "Allow-Temporary-Remove-of-Essentials:", Request::ALLOW_TEMPORARY_REMOVE_OF_ESSENTIALS))
+ ;
else
_error->Warning("Unknown line in EIPP Request stanza: %s", line.c_str());
diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h
index e1ffdf598..4adfc95e9 100644
--- a/apt-pkg/edsp.h
+++ b/apt-pkg/edsp.h
@@ -245,6 +245,7 @@ namespace EIPP /*{{{*/
{
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! */
};
}
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index d5afceb6d..a61c5f7a9 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1045,6 +1045,8 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
flags |= EIPP::Request::NO_IMMEDIATE_CONFIGURATION;
else if (_config->FindB("APT::Immediate-Configure-All", false))
flags |= EIPP::Request::IMMEDIATE_CONFIGURATION_ALL;
+ else if (_config->FindB("APT::Force-LoopBreak", false))
+ flags |= EIPP::Request::ALLOW_TEMPORARY_REMOVE_OF_ESSENTIALS;
if (EIPP::OrderInstall(planer.c_str(), this, flags, nullptr))
return Completed;
diff --git a/cmdline/apt-internal-planer.cc b/cmdline/apt-internal-planer.cc
index c83dba8b1..56d4f8afd 100644
--- a/cmdline/apt-internal-planer.cc
+++ b/cmdline/apt-internal-planer.cc
@@ -152,6 +152,7 @@ int main(int argc,const char *argv[]) /*{{{*/
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);
+ _config->Set("APT::Force-LoopBreak", (flags & EIPP::Request::ALLOW_TEMPORARY_REMOVE_OF_ESSENTIALS) != 0);
EDSP::WriteProgress(5, "Read scenario…", output);
diff --git a/doc/external-installation-planer-protocol.txt b/doc/external-installation-planer-protocol.txt
index 7760ecf60..2a0bdbee3 100644
--- a/doc/external-installation-planer-protocol.txt
+++ b/doc/external-installation-planer-protocol.txt
@@ -162,14 +162,22 @@ The following **preference fields** are supported in request stanzas:
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
+- **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`).
+- **Allow-Temporary-Remove-of-Essentials** (optional, defaults to `no`).
+ A boolean value allowing the planer (if set to yes) to temporarily
+ remove an essential package. Associated with the APT::Force-LoopBreak
+ configuration option its main use is highlighting that planers who do
+ temporary removes must take special care in terms of essentials. Legit
+ uses of this option by users is very uncommon, traditionally
+ a situation in which it is needed indicates a packaging error.
+
#### Package universe