commit 18b43921d6c1158f1ed31fd19d19523d8cfbff85 Author: Sebastian Nowicki Date: Sun Apr 10 17:51:35 2011 +0800 Add more information in conflicts question In addition to the names of the conflicting packages, the origin and versions will be displayed to the user. This introduces an API change in the PM_TRANS_CONV_CONFLICT_PKG conversation callback. All three arguments were strings. The first two arguments are now pmpkg_t structures (sync and local, respectively). Fixes FS#12536 diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 5428e40..4b54969 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -486,8 +486,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync pmpkg_t *sync = _alpm_pkg_find(trans->add, conflict->package1); pmpkg_t *local = _alpm_db_get_pkgfromcache(db_local, conflict->package2); int doremove = 0; - QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, conflict->package1, - conflict->package2, conflict->reason, &doremove); + QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, sync, local, + conflict->reason, &doremove); if(doremove) { /* append to the removes list */ _alpm_log(PM_LOG_DEBUG, "electing '%s' for removal\n", conflict->package2); diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 08c1cf3..b253546 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -266,19 +266,30 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2, alpm_pkg_get_name(data2)); break; case PM_TRANS_CONV_CONFLICT_PKG: - /* data parameters: target package, local package, conflict (strings) */ + /* data parameters: target package, local package (pmpkg_t), conflict (string) */ /* print conflict only if it contains new information */ - if(strcmp(data1, data3) == 0 || strcmp(data2, data3) == 0) { - *response = noyes(_(":: %s and %s are in conflict. Remove %s?"), - (char *)data1, - (char *)data2, - (char *)data2); + if(strcmp(alpm_pkg_get_name(data1), data3) == 0 + || strcmp(alpm_pkg_get_name(data2), data3) == 0) { + *response = noyes(_(":: %s%s%s-%s and %s-%s are in conflict. Remove %s?"), + /* The db will be NULL if the package was read from file. */ + alpm_pkg_get_db(data1) == NULL ? "" : alpm_db_get_name(alpm_pkg_get_db(data1)), + alpm_pkg_get_db(data1) == NULL ? "" : "/", + alpm_pkg_get_name(data1), + alpm_pkg_get_version(data1), + alpm_pkg_get_name(data2), + alpm_pkg_get_version(data2), + alpm_pkg_get_name(data2)); } else { - *response = noyes(_(":: %s and %s are in conflict (%s). Remove %s?"), - (char *)data1, - (char *)data2, + *response = noyes(_(":: %s%s%s-%s and %s-%s are in conflict (%s). Remove %s?"), + /* The db will be NULL if the package was read from file. */ + alpm_pkg_get_db(data1) == NULL ? "" : alpm_db_get_name(alpm_pkg_get_db(data1)), + alpm_pkg_get_db(data1) == NULL ? "" : "/", + alpm_pkg_get_name(data1), + alpm_pkg_get_version(data1), + alpm_pkg_get_name(data2), + alpm_pkg_get_version(data2), (char *)data3, - (char *)data2); + alpm_pkg_get_name(data2)); } break; case PM_TRANS_CONV_REMOVE_PKGS: