When hitting an unresolvable dependency, pacman will output a message like: warning: cannot resolve "glibc>=1.0-2", a dependency of "gcc-libs" This currently is repeated every time the package with the unresolvable dependency is seen during dependency resolution. Limit this to printing the output once. Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/deps.c | 13 ++++++++----- lib/libalpm/deps.h | 2 +- lib/libalpm/sync.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 6841097..d218f0b 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -715,6 +715,7 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, * transaction * @param data returns the dependency which could not be satisfied in the * event of an error + * @param quiet suppress missing dependency warnings * @return 0 on success, with [pkg] and all of its dependencies not already on * the [*packages] list added to that list, or -1 on failure due to an * unresolvable dependency, in which case the [*packages] list will be @@ -722,7 +723,7 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, */ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages, - alpm_list_t *rem, alpm_list_t **data) + alpm_list_t *rem, alpm_list_t **data, int quiet) { int ret = 0; alpm_list_t *j; @@ -763,7 +764,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, /* find a satisfier package in the given repositories */ spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0); } - if(spkg && _alpm_resolvedeps(handle, localpkgs, spkg, preferred, packages, rem, data) == 0) { + if(spkg && _alpm_resolvedeps(handle, localpkgs, spkg, preferred, packages, rem, data, 1) == 0) { _alpm_log(handle, ALPM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n", spkg->name, pkg->name); @@ -773,9 +774,11 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, } else { handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; char *missdepstring = alpm_dep_compute_string(missdep); - _alpm_log(handle, ALPM_LOG_WARNING, - _("cannot resolve \"%s\", a dependency of \"%s\"\n"), - missdepstring, pkg->name); + if(!quiet) { + _alpm_log(handle, ALPM_LOG_WARNING, + _("cannot resolve \"%s\", a dependency of \"%s\"\n"), + missdepstring, pkg->name); + } free(missdepstring); if(data) { *data = alpm_list_add(*data, miss); diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h index c8e1bc3..7470ea1 100644 --- a/lib/libalpm/deps.h +++ b/lib/libalpm/deps.h @@ -34,7 +34,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int r int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit); int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove, - alpm_list_t **data); + alpm_list_t **data, int quiet); alpm_depend_t *_alpm_splitdep(const char *depstring); int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep); int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index ca6b507..634d7cd 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -409,7 +409,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) for(i = trans->add; i; i = i->next) { alpm_pkg_t *pkg = i->data; if(_alpm_resolvedeps(handle, localpkgs, pkg, trans->add, - &resolved, remove, data) == -1) { + &resolved, remove, data, 0) == -1) { unresolvable = alpm_list_add(unresolvable, pkg); } /* Else, [resolved] now additionally contains [pkg] and all of its -- 1.7.12