mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Be smarter about running ldconfig during removal transactions
1. Don't run it if something failed in package removal- this mirrors what we already do in sync transactions. 2. Don't run it if we are invoking it for the replaces removal bit of a sync transaction- it doesn't make sense to run ldconfig halfway through a sync install; we should only run it once at the end. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a94ad29740
commit
e1899cbc64
@ -475,7 +475,7 @@ db:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_remove_packages(alpm_handle_t *handle)
|
int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig)
|
||||||
{
|
{
|
||||||
alpm_list_t *targ;
|
alpm_list_t *targ;
|
||||||
size_t pkg_count, targ_count;
|
size_t pkg_count, targ_count;
|
||||||
@ -489,23 +489,25 @@ int _alpm_remove_packages(alpm_handle_t *handle)
|
|||||||
alpm_pkg_t *pkg = targ->data;
|
alpm_pkg_t *pkg = targ->data;
|
||||||
|
|
||||||
if(trans->state == STATE_INTERRUPTED) {
|
if(trans->state == STATE_INTERRUPTED) {
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_alpm_remove_single_package(handle, pkg, NULL,
|
if(_alpm_remove_single_package(handle, pkg, NULL,
|
||||||
targ_count, pkg_count) == -1) {
|
targ_count, pkg_count) == -1) {
|
||||||
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
|
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
|
||||||
|
/* running ldconfig at this point could possibly screw system */
|
||||||
|
run_ldconfig = 0;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
targ_count++;
|
targ_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run ldconfig if it exists */
|
if(run_ldconfig) {
|
||||||
_alpm_ldconfig(handle);
|
/* run ldconfig if it exists */
|
||||||
|
_alpm_ldconfig(handle);
|
||||||
|
}
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
|
|
||||||
int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data);
|
int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data);
|
||||||
int _alpm_remove_packages(alpm_handle_t *handle);
|
int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig);
|
||||||
|
|
||||||
int _alpm_remove_single_package(alpm_handle_t *handle,
|
int _alpm_remove_single_package(alpm_handle_t *handle,
|
||||||
alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg,
|
alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg,
|
||||||
|
@ -1042,7 +1042,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
if(replaces) {
|
if(replaces) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "removing conflicting and to-be-replaced packages\n");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "removing conflicting and to-be-replaced packages\n");
|
||||||
/* we want the frontend to be aware of commit details */
|
/* we want the frontend to be aware of commit details */
|
||||||
if(_alpm_remove_packages(handle) == -1) {
|
if(_alpm_remove_packages(handle, 0) == -1) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not commit removal transaction\n"));
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not commit removal transaction\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
trans->state = STATE_COMMITING;
|
trans->state = STATE_COMMITING;
|
||||||
|
|
||||||
if(trans->add == NULL) {
|
if(trans->add == NULL) {
|
||||||
if(_alpm_remove_packages(handle) == -1) {
|
if(_alpm_remove_packages(handle, 1) == -1) {
|
||||||
/* pm_errno is set by _alpm_remove_commit() */
|
/* pm_errno is set by _alpm_remove_commit() */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user