From cfaff6e0c14d29f07246386695bce0188ce6f44b Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Wed, 12 Feb 2014 16:32:30 +0100 Subject: Add events on pacnew/pacsave/pacorig file creation ALPM still adds a warning to the log, but doesn't emit an event about said warning, instead using a specific event to let the frontend what happened/how to inform the user. Note that there are 2 cases for installing a .pacnew file, to not overwrite user changes and because file is in NoUpgrade. In the later case the warning was a bit different: it happened before and said "extracting" instead of "installed." Now both happen after and are phrased the same. Signed-off-by: Olivier Brunel Signed-off-by: Allan McRae --- lib/libalpm/remove.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/remove.c') diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 132b30c6..5cbeeb96 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -522,6 +522,11 @@ static int unlink_file(alpm_handle_t *handle, alpm_pkg_t *oldpkg, int cmp = filehash ? strcmp(filehash, backup->hash) : 0; FREE(filehash); if(cmp != 0) { + alpm_event_pacsave_created_t event = { + .type = ALPM_EVENT_PACSAVE_CREATED, + .oldpkg = oldpkg, + .file = file + }; char *newpath; size_t len = strlen(file) + 8 + 1; MALLOC(newpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); @@ -536,7 +541,7 @@ static int unlink_file(alpm_handle_t *handle, alpm_pkg_t *oldpkg, free(newpath); return -1; } - _alpm_log(handle, ALPM_LOG_WARNING, _("%s saved as %s\n"), file, newpath); + EVENT(handle, &event); alpm_logaction(handle, ALPM_CALLER_PREFIX, "warning: %s saved as %s\n", file, newpath); free(newpath); -- cgit v1.2.3-24-g4f1b