summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2013-11-05 11:29:55 -0500
committerAllan McRae <allan@archlinux.org>2013-11-15 11:02:27 +1000
commitd78f45ae0c11fb19a1a0bf30728386e9febe0705 (patch)
tree18f10fbb3f48b328bbfbd15ea172f1371913c086 /lib/libalpm
parentea6aeef8bae01d934cb4aab6d915e0e3e8276df1 (diff)
downloadpacman-d78f45ae0c11fb19a1a0bf30728386e9febe0705.tar.xz
log important events from the backend
This ensures that important events will be logged and consistent regardless of the frontend. The need for global context in the event callback is also removed. The event is logged before any post_* scripts run, so this also moves the post_* script output underneath the event in the log. Fixes FS#36504 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c22
-rw-r--r--lib/libalpm/remove.c5
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index ac4e36a6..ee29a127 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -649,6 +649,28 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
PROGRESS(handle, event, newpkg->name, 100, pkg_count, pkg_current);
+ switch(done) {
+ case ALPM_EVENT_ADD_DONE:
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "installed %s (%s)\n",
+ newpkg->name, newpkg->version);
+ break;
+ case ALPM_EVENT_DOWNGRADE_DONE:
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "downgraded %s (%s -> %s)\n",
+ newpkg->name, oldpkg->version, newpkg->version);
+ break;
+ case ALPM_EVENT_REINSTALL_DONE:
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "reinstalled %s (%s)\n",
+ newpkg->name, newpkg->version);
+ break;
+ case ALPM_EVENT_UPGRADE_DONE:
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "upgraded %s (%s -> %s)\n",
+ newpkg->name, oldpkg->version, newpkg->version);
+ break;
+ default:
+ /* we should never reach here */
+ break;
+ }
+
/* run the post-install script if it exists */
if(alpm_pkg_has_scriptlet(newpkg)
&& !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 7237a567..e745d89f 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -687,6 +687,11 @@ int _alpm_remove_single_package(alpm_handle_t *handle,
remove_package_files(handle, oldpkg, newpkg, targ_count, pkg_count);
}
+ if(!newpkg) {
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "removed %s (%s)\n",
+ oldpkg->name, oldpkg->version);
+ }
+
/* run the post-remove script if it exists */
if(!newpkg && alpm_pkg_has_scriptlet(oldpkg) &&
!(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {