[pacman-dev] [PATCH v2] Give the frontend control over responses for print
Connor Behan
connor.behan at gmail.com
Tue Mar 19 06:01:29 EDT 2013
There are currently 8 questions that libalpm may ask the user. Each of
them has a "pacman default" and a "libalpm default". The pacman default
is the response that gets used if the user presses enter without typing
anything. Equivalently it is the response when --noconfirm is passed.
The libalpm default is what happens when --print is passed and the
question callback never even executes. This commit forces pacman to
specify responses for --print and therefore never rely on the libalpm
default. The following states how each question is handled:
ALPM_QUESTION_INSTALL_IGNOREPKG: The pacman default is 1 and the libalpm
default is 0. The latter was agreed to be a bug so we return 1 on print.
ALPM_QUESTION_REPLACE_PKG: The pacman default is 1 and the libalpm
default is 0. We return 0 on print.
ALPM_QUESTION_CONFLICT_PKG: The pacman default is 0 and the libalpm
default is 0. We return 0 on print even though print should not
encounter this.
ALPM_QUESTION_REMOVE_PKGS: The pacman default is 0 and the libalpm
default is 0. We return 0 on print.
ALPM_QUESTION_SELECT_PROVIDER: The pacman default is 0 and the libalpm
default is 0. We return 0 on print.
ALPM_QUESTION_LOCAL_NEWER: The pacman default is 1 and this is dead code
so there is no libalpm default. We return 1 on print.
ALPM_QUESTION_CORRUPTED_PKG: The pacman default is 1 and the libalpm
default is 0. We return 0 on print even though print should not
encounter this.
ALPM_QUESTION_IMPORT_KEY: The pacman default is 1 and this is dead code
so there is no libalpm default. We return 1 on print.
Signed-off-by: Connor Behan <connor.behan at gmail.com>
---
src/pacman/callback.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 71d9d04..66721f5 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -309,6 +309,15 @@ void cb_question(alpm_question_t event, void *data1, void *data2,
void *data3, int *response)
{
if(config->print) {
+ switch(event) {
+ case ALPM_QUESTION_INSTALL_IGNOREPKG:
+ case ALPM_QUESTION_LOCAL_NEWER:
+ case ALPM_QUESTION_IMPORT_KEY:
+ *response = 1;
+ break;
+ default:
+ *response = 0;
+ }
return;
}
switch(event) {
--
1.8.1.5
More information about the pacman-dev
mailing list