Fix #43 (xbps-install: unhelpful message for invalid dependency)

If a package that is going to be installed or updated contains invalid
dependencies return ENXIO and XBPS_STATE_INVALID_DEP xbps state to clients.

This improves the error messages returned to the clients when such
condition happens.
This commit is contained in:
Juan RP
2014-07-02 10:59:25 +02:00
parent 21f32a75c5
commit e60677116d
5 changed files with 35 additions and 6 deletions

View File

@@ -159,8 +159,12 @@ state_cb(struct xbps_state_cb_data *xscd, void *cbdata _unused)
}
break;
default:
xbps_dbg_printf(xscd->xhp,
"%s: unknown state %d\n", xscd->arg, xscd->state);
if (xscd->desc)
xbps_error_printf("%s\n", xscd->desc);
else
xbps_dbg_printf(xscd->xhp,
"%s: unknown state %d\n", xscd->arg, xscd->state);
break;
}

View File

@@ -224,6 +224,8 @@ install_new_pkg(struct xbps_handle *xhp, const char *pkg, bool reinstall)
} else if (rv == ENOTSUP) {
fprintf(stderr, "No repositories "
"currently registered!\n");
} else if (rv == ENXIO) {
fprintf(stderr, "Package `%s' contains invalid dependencies, exiting.\n", pkg);
} else {
fprintf(stderr, "Unexpected error: %s\n",
strerror(rv));