#include <tools/ccanlint/ccanlint.h>
#include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
#include <ccan/str/str.h>
+#include <ccan/tal/path/path.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
{
struct stat st;
struct manifest *subm;
- char *dir = talloc_asprintf(m, "%s/%s", ccan_dir, dep);
+ char *dir = path_join(m, ccan_dir, dep);
/* FIXME: get_manifest has a tendency to exit. */
if (stat(dir, &st) != 0) {
- score->error
- = talloc_asprintf(m,
- "Could not stat dependency %s: %s",
- dir, strerror(errno));
+ score->error = tal_fmt(m, "Could not stat dependency %s: %s",
+ dir, strerror(errno));
return false;
}
subm = get_manifest(m, dir);
deps = get_deps(m, m->dir, "depends", true,
get_or_compile_info);
+ if (!deps) {
+ score->error = tal_fmt(m, "Could not extract dependencies");
+ return;
+ }
+
for (i = 0; deps[i]; i++) {
- if (!strstarts(deps[i], "ccan/"))
+ if (!strstarts(deps[i], "ccan/")) {
+ non_ccan_deps = true;
continue;
+ }
if (!add_dep(m, &m->deps, deps[i], score))
return;
if (!strstarts(deps[i], "ccan/"))
continue;
- /* Don't add dependency twice: we can only be on one list! */
+ /* Don't add dependency twice: we can only be on one list!
+ * Also, it's possible to have circular test depends, so drop
+ * self-refs. */
if (!have_dep(m, deps[i])
+ && !streq(deps[i] + strlen("ccan/"), m->modname)
&& !add_dep(m, &m->test_deps, deps[i], score))
return;