1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-21 23:38:49 -05:00

add detail to broken dependency errors

The difference between a sync target having an unmet dependency and
breaking a dependency for an installed package is a common source of
confusion.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2015-11-01 20:42:01 -05:00 committed by Allan McRae
parent 556c56d4d5
commit 08b0b6de96
2 changed files with 24 additions and 6 deletions

View File

@ -122,7 +122,8 @@ int pacman_remove(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
alpm_depmissing_t *miss = i->data;
char *depstring = alpm_dep_compute_string(miss->depend);
colon_printf(_("%s: requires %s\n"), miss->target, depstring);
colon_printf(_("%s: removing %s breaks dependency '%s'\n"),
miss->target, miss->causingpkg, depstring);
free(depstring);
alpm_depmissing_free(miss);
}

View File

@ -707,6 +707,26 @@ static int sync_trans(alpm_list_t *targets)
return sync_prepare_execute();
}
static void print_broken_dep(alpm_depmissing_t *miss)
{
char *depstring = alpm_dep_compute_string(miss->depend);
alpm_list_t *trans_add = alpm_trans_get_add(config->handle);
alpm_pkg_t *pkg;
if(miss->causingpkg == NULL) {
/* package being installed/upgraded has unresolved dependency */
colon_printf(_("%s: requires %s\n"), miss->target, depstring);
} else if((pkg = alpm_pkg_find(trans_add, miss->causingpkg))) {
/* upgrading a package breaks a local dependency */
colon_printf(_("%s: installing %s (%s) breaks dependency '%s'\n"),
miss->target, miss->causingpkg, alpm_pkg_get_version(pkg), depstring);
} else {
/* removing a package breaks a local dependency */
colon_printf(_("%s: removing %s breaks dependency '%s'\n"),
miss->target, miss->causingpkg, depstring);
}
free(depstring);
}
int sync_prepare_execute(void)
{
alpm_list_t *i, *packages, *data = NULL;
@ -727,11 +747,8 @@ int sync_prepare_execute(void)
break;
case ALPM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
alpm_depmissing_t *miss = i->data;
char *depstring = alpm_dep_compute_string(miss->depend);
colon_printf(_("%s: requires %s\n"), miss->target, depstring);
free(depstring);
alpm_depmissing_free(miss);
print_broken_dep(i->data);
alpm_depmissing_free(i->data);
}
break;
case ALPM_ERR_CONFLICTING_DEPS: