fulldeptree: return a proper error if deps can't be resolved.

xbps_get_pkg_fulldeptree() now returns NULL and sets errno to ENODEV
when there are missing dependencies, rather than assert()ing.

Added another test case to check returned error codes.

Signed-off-by: Juan RP <xtraeme@gmail.com>
This commit is contained in:
Juan RP
2019-06-15 17:53:02 +02:00
parent 3a70495ba6
commit a9a889c54d
5 changed files with 61 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2010-2015 Juan Romero Pardines.
* Copyright (c) 2010-2019 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -470,6 +470,13 @@ create_dot_graph(struct xbps_handle *xhp,
} else {
rdeps = xbps_pkgdb_get_pkg_fulldeptree(xhp, pkgver);
}
if (rdeps == NULL) {
if (errno == ENODEV)
die("package depends on missing dependencies\n");
else
die("package dependencies couldn't be resolved (error %d)\n", errno);
}
process_fulldeptree(xhp, f, plistd, rdeps, repomode);
} else {
/*