X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fmanifest.c;h=cf4c987e956a261ea42772d16e3f1a5faab8d682;hp=e41c7abc371b8d1b80dcf41ab67b126b09fbcf93;hb=10e5e329a1a8804ff6461e1724071364cf6be572;hpb=d8c9fdc0e6b70ab4fced949ee6488dc585a711f4 diff --git a/tools/manifest.c b/tools/manifest.c index e41c7abc..cf4c987e 100644 --- a/tools/manifest.c +++ b/tools/manifest.c @@ -12,19 +12,17 @@ #include #include #include +#include #include #include #include #include -#include #include #include #include #include #include -const char *ccan_dir; - static size_t dir_hash(const char *name) { return hash(name, strlen(name), 0); @@ -239,7 +237,9 @@ struct manifest *get_manifest(const void *ctx, const char *dir) list_head_init(&m->examples); list_head_init(&m->mangled_examples); list_head_init(&m->deps); + list_head_init(&m->test_deps); + /* Trim trailing /. */ len = strlen(m->dir); while (len && m->dir[len-1] == '/') m->dir[--len] = '\0'; @@ -249,20 +249,8 @@ struct manifest *get_manifest(const void *ctx, const char *dir) errx(1, "I don't expect to be run from the root directory"); m->basename++; - /* We expect the ccan dir to be two levels above module dir. */ - if (!ccan_dir) { - char *p, *dir; - dir = talloc_strdup(NULL, m->dir); - p = strrchr(dir, '/'); - if (!p) - errx(1, "I expect the ccan root directory in ../.."); - *p = '\0'; - p = strrchr(dir, '/'); - if (!p) - errx(1, "I expect the ccan root directory in ../.."); - *p = '\0'; - ccan_dir = dir; - } + assert(strstarts(m->dir, find_ccan_dir(m->dir))); + m->modname = m->dir + strlen(find_ccan_dir(m->dir)) + strlen("ccan/"); add_files(m, "");