summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-04-06 11:04:18 -0400
committerAllan McRae <allan@archlinux.org>2014-08-04 14:23:58 +1000
commit574e45df28769b4919c0c7e5c7cb10d521066adc (patch)
tree9484606b13cb144e7c33fe85570ba78e94a458bb /lib/libalpm
parent7c75564af933ad5258b2e2bee6ce63b9bcbf6561 (diff)
downloadpacman-574e45df28769b4919c0c7e5c7cb10d521066adc.tar.xz
trans_commit: log beginning and end of transaction
This makes it clear whether a transaction successfully completed and allows log parsers to group related actions. 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/trans.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 68f6633d..4a176086 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -177,18 +177,28 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
trans->state = STATE_COMMITING;
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction started\n");
+
if(trans->add == NULL) {
if(_alpm_remove_packages(handle, 1) == -1) {
/* pm_errno is set by _alpm_remove_packages() */
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
return -1;
}
} else {
if(_alpm_sync_commit(handle, data) == -1) {
/* pm_errno is set by _alpm_sync_commit() */
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
return -1;
}
}
+ if(trans->state == STATE_INTERRUPTED) {
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction interrupted\n");
+ } else {
+ alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction completed\n");
+ }
+
trans->state = STATE_COMMITED;
return 0;