Prompt to delete invalid package
This commit is contained in:
parent
386125fc89
commit
62095d916b
1 changed files with 8 additions and 2 deletions
|
@ -1127,7 +1127,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
|
|||
{
|
||||
size_t current = 0, current_bytes = 0;
|
||||
int errors = 0;
|
||||
alpm_list_t *i;
|
||||
alpm_list_t *i, *delete = NULL;
|
||||
alpm_event_t event;
|
||||
|
||||
/* load packages from disk now that they are known-valid */
|
||||
|
@ -1150,6 +1150,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
|
|||
filepath = _alpm_filecache_find(handle, spkg->filename);
|
||||
|
||||
if(!filepath) {
|
||||
FREELIST(delete);
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("%s: could not find package in cache\n"), spkg->name);
|
||||
RET_ERR(handle, ALPM_ERR_PKG_NOT_FOUND, -1);
|
||||
|
@ -1170,7 +1171,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
|
|||
if(error != 0) {
|
||||
errors++;
|
||||
*data = alpm_list_add(*data, strdup(spkg->filename));
|
||||
free(filepath);
|
||||
delete = alpm_list_add(delete, filepath);
|
||||
_alpm_pkg_free(pkgfile);
|
||||
continue;
|
||||
}
|
||||
|
@ -1194,6 +1195,11 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
|
|||
EVENT(handle, &event);
|
||||
|
||||
if(errors) {
|
||||
for(i = delete; i; i = i->next) {
|
||||
prompt_to_delete(handle, i->data, ALPM_ERR_PKG_INVALID);
|
||||
}
|
||||
FREELIST(delete);
|
||||
|
||||
if(handle->pm_errno == ALPM_ERR_OK) {
|
||||
RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue