mirror of
https://github.com/moparisthebest/pacman
synced 2025-02-28 17:31:52 -05:00
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>
This commit is contained in:
parent
7c75564af9
commit
574e45df28
@ -177,18 +177,28 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
|
|
||||||
trans->state = STATE_COMMITING;
|
trans->state = STATE_COMMITING;
|
||||||
|
|
||||||
|
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction started\n");
|
||||||
|
|
||||||
if(trans->add == NULL) {
|
if(trans->add == NULL) {
|
||||||
if(_alpm_remove_packages(handle, 1) == -1) {
|
if(_alpm_remove_packages(handle, 1) == -1) {
|
||||||
/* pm_errno is set by _alpm_remove_packages() */
|
/* pm_errno is set by _alpm_remove_packages() */
|
||||||
|
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(_alpm_sync_commit(handle, data) == -1) {
|
if(_alpm_sync_commit(handle, data) == -1) {
|
||||||
/* pm_errno is set by _alpm_sync_commit() */
|
/* pm_errno is set by _alpm_sync_commit() */
|
||||||
|
alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n");
|
||||||
return -1;
|
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;
|
trans->state = STATE_COMMITED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user