summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-11-01 20:42:01 -0500
committerAllan McRae <allan@archlinux.org>2015-11-04 14:50:57 +1000
commit08b0b6de96243a67b6db095f760e0c2b22ef4536 (patch)
treee3ea8518b42894a5420d09c8779eda9fa216f50c /src
parent556c56d4d573655023bb26c47c57fddbb1a36477 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/remove.c3
-rw-r--r--src/pacman/sync.c27
2 files changed, 24 insertions, 6 deletions
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 069f2363..e41e7f52 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -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);
}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 2a0f4b55..b13f76af 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -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: