mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
resolvedeps: return the depmiss info to the frontend in case of failure
This commit is contained in:
parent
2d08e902ef
commit
fc8be93314
@ -354,7 +354,6 @@ extern enum __pmerrno_t {
|
|||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
PM_ERR_UNSATISFIED_DEPS,
|
PM_ERR_UNSATISFIED_DEPS,
|
||||||
PM_ERR_CONFLICTING_DEPS,
|
PM_ERR_CONFLICTING_DEPS,
|
||||||
PM_ERR_UNRESOLVABLE_DEPS,
|
|
||||||
PM_ERR_FILE_CONFLICTS,
|
PM_ERR_FILE_CONFLICTS,
|
||||||
/* Misc */
|
/* Misc */
|
||||||
PM_ERR_USER_ABORT,
|
PM_ERR_USER_ABORT,
|
||||||
|
@ -510,7 +510,8 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
|
|||||||
*
|
*
|
||||||
* make sure *list and *trail are already initialized
|
* 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 *i, *j;
|
||||||
PMList *targ;
|
PMList *targ;
|
||||||
@ -571,7 +572,16 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
|
|||||||
if(sync == NULL) {
|
if(sync == NULL) {
|
||||||
_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)",
|
_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)",
|
||||||
miss->target, miss->depend.name);
|
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;
|
goto error;
|
||||||
}
|
}
|
||||||
if(pkg_isin(sync->name, list)) {
|
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) {
|
if(usedep) {
|
||||||
trail = pm_list_add(trail, sync);
|
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;
|
goto error;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
|
_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);
|
list = pm_list_add(list, sync);
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target);
|
_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;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,7 +43,8 @@ PMList *sortbydeps(PMList *targets, int mode);
|
|||||||
PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
|
PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
|
||||||
int splitdep(char *depstr, pmdepend_t *depend);
|
int splitdep(char *depstr, pmdepend_t *depend);
|
||||||
PMList *removedeps(pmdb_t *db, PMList *targs);
|
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 */
|
#endif /* _ALPM_DEPS_H */
|
||||||
|
|
||||||
|
@ -102,8 +102,6 @@ char *alpm_strerror(int err)
|
|||||||
return "could not satisfy dependencies";
|
return "could not satisfy dependencies";
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case PM_ERR_CONFLICTING_DEPS:
|
||||||
return "conflicting dependencies";
|
return "conflicting dependencies";
|
||||||
case PM_ERR_UNRESOLVABLE_DEPS:
|
|
||||||
return "could not resolve dependencies";
|
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
return "conflicting files";
|
return "conflicting files";
|
||||||
/* Miscellaenous */
|
/* Miscellaenous */
|
||||||
|
@ -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");
|
_alpm_log(PM_LOG_FLOW1, "resolving targets dependencies");
|
||||||
for(i = trans->packages; i; i = i->next) {
|
for(i = trans->packages; i; i = i->next) {
|
||||||
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg;
|
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 */
|
/* pm_errno is set by resolvedeps */
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user