X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fmanifest.c;h=b4db234f67501bf72525dec54aa549c8218c66d2;hb=aabf300e324f7da5134d7ad45afba11225045c24;hp=e41c7abc371b8d1b80dcf41ab67b126b09fbcf93;hpb=d8c9fdc0e6b70ab4fced949ee6488dc585a711f4;p=ccan diff --git a/tools/manifest.c b/tools/manifest.c index e41c7abc..b4db234f 100644 --- a/tools/manifest.c +++ b/tools/manifest.c @@ -7,24 +7,21 @@ #include #include #include -#include #include #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); @@ -47,7 +44,8 @@ static struct htable_manifest *manifests; const char *get_ccan_file_contents(struct ccan_file *f) { if (!f->contents) { - f->contents = grab_file(f, f->fullname, &f->contents_size); + f->contents = talloc_grab_file(f, f->fullname, + &f->contents_size); if (!f->contents) err(1, "Reading file %s", f->fullname); } @@ -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, "");