summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-21 19:28:38 +0100
committerAurelien Foret <aurelien@archlinux.org>2006-01-21 19:28:38 +0100
commitfc8be933144b5f4552c300afc40e967504222555 (patch)
treec7451c1b084ed12c9e7abf00ac9be8f9fc478412 /lib/libalpm
parent2d08e902ef07b4a888fa3daf2d5a658dd04dac4e (diff)
downloadpacman-fc8be933144b5f4552c300afc40e967504222555.tar.gz
pacman-fc8be933144b5f4552c300afc40e967504222555.tar.xz
resolvedeps: return the depmiss info to the frontend in case of failure
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.h1
-rw-r--r--lib/libalpm/deps.c27
-rw-r--r--lib/libalpm/deps.h3
-rw-r--r--lib/libalpm/error.c2
-rw-r--r--lib/libalpm/sync.c2
5 files changed, 26 insertions, 9 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index a237fe36..c3255f66 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -354,7 +354,6 @@ extern enum __pmerrno_t {
/* Dependencies */
PM_ERR_UNSATISFIED_DEPS,
PM_ERR_CONFLICTING_DEPS,
- PM_ERR_UNRESOLVABLE_DEPS,
PM_ERR_FILE_CONFLICTS,
/* Misc */
PM_ERR_USER_ABORT,
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 41e1b46d..36eeb517 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -510,7 +510,8 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
*
* make sure *list and *trail are already initialized
*/
-int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list, PMList *trail, pmtrans_t *trans)
+int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
+ PMList *trail, pmtrans_t *trans, PMList **data)
{
PMList *i, *j;
PMList *targ;
@@ -571,7 +572,16 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
if(sync == NULL) {
_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)",
miss->target, miss->depend.name);
- pm_errno = PM_ERR_UNRESOLVABLE_DEPS;
+ if(data) {
+ if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+ FREELIST(*data);
+ pm_errno = PM_ERR_MEMORY;
+ goto error;
+ }
+ *miss = *(pmdepmissing_t *)i->data;
+ *data = pm_list_add(*data, miss);
+ }
+ pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
}
if(pkg_isin(sync->name, list)) {
@@ -593,7 +603,7 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
}
if(usedep) {
trail = pm_list_add(trail, sync);
- if(resolvedeps(local, dbs_sync, sync, list, trail, trans)) {
+ if(resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
goto error;
}
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
@@ -601,7 +611,16 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
list = pm_list_add(list, sync);
} else {
_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target);
- pm_errno = PM_ERR_UNRESOLVABLE_DEPS;
+ if(data) {
+ if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+ FREELIST(*data);
+ pm_errno = PM_ERR_MEMORY;
+ goto error;
+ }
+ *miss = *(pmdepmissing_t *)i->data;
+ *data = pm_list_add(*data, miss);
+ }
+ pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
}
} else {
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index 9451d8b4..fbbd6438 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -43,7 +43,8 @@ PMList *sortbydeps(PMList *targets, int mode);
PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
int splitdep(char *depstr, pmdepend_t *depend);
PMList *removedeps(pmdb_t *db, PMList *targs);
-int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list, PMList *trail, pmtrans_t *trans);
+int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
+ PMList *trail, pmtrans_t *trans, PMList **data);
#endif /* _ALPM_DEPS_H */
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 609e598f..54220e0b 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -102,8 +102,6 @@ char *alpm_strerror(int err)
return "could not satisfy dependencies";
case PM_ERR_CONFLICTING_DEPS:
return "conflicting dependencies";
- case PM_ERR_UNRESOLVABLE_DEPS:
- return "could not resolve dependencies";
case PM_ERR_FILE_CONFLICTS:
return "conflicting files";
/* Miscellaenous */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 1c88b978..9e23bb31 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -376,7 +376,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
_alpm_log(PM_LOG_FLOW1, "resolving targets dependencies");
for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg;
- if(resolvedeps(db_local, dbs_sync, spkg, list, trail, trans) == -1) {
+ if(resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) {
/* pm_errno is set by resolvedeps */
goto error;
}