X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fmanifest.c;h=d3245ca527fa946e98e4ae639b04331ee57d1b59;hp=762550ea4122549c00d7363b413ea657d91ae53e;hb=f359fde1b7c3ca60faebd4df710bf30a68784e27;hpb=e0529e15e0c7f9251af5465ef03f208d279affc1 diff --git a/tools/manifest.c b/tools/manifest.c index 762550ea..d3245ca5 100644 --- a/tools/manifest.c +++ b/tools/manifest.c @@ -3,6 +3,7 @@ #include "tools.h" #include #include +#include #include #include #include @@ -43,10 +44,10 @@ static struct htable_manifest *manifests; const char *get_ccan_file_contents(struct ccan_file *f) { if (!f->contents) { - f->contents = tal_grab_file(f, f->fullname, - &f->contents_size); + f->contents = grab_file(f, f->fullname); if (!f->contents) err(1, "Reading file %s", f->fullname); + f->contents_size = tal_count(f->contents) - 1; } return f->contents; } @@ -78,6 +79,8 @@ struct ccan_file *new_ccan_file(const void *ctx, const char *dir, f->fullname = path_join(f, dir, f->name); f->contents = NULL; f->simplified = NULL; + f->idempotent_cond = NULL; + return f; } @@ -109,8 +112,8 @@ static void add_files(struct manifest *m, const char *base, const char *subdir) f = new_ccan_file(m, m->dir, subdir ? path_join(m, subdir, ent->d_name) : ent->d_name); - if (lstat(f->fullname, &st) != 0) - err(1, "lstat %s", f->fullname); + if (stat(f->fullname, &st) != 0) + err(1, "stat %s", f->fullname); if (S_ISDIR(st.st_mode)) { size_t len = tal_count(subs); @@ -166,8 +169,15 @@ static void add_files(struct manifest *m, const char *base, const char *subdir) && list_empty(&m->h_files)) errx(1, "No _info, C or H files found here!"); - for (i = 0; i < tal_count(subs); i++) - add_files(m, base, subs[i]); + /* Don't enter subdirs with _info: they're separate modules. */ + for (i = 0; i < tal_count(subs); i++) { + struct stat st; + char *subinfo = path_join(subs, base, + path_join(subs, subs[i], + "_info")); + if (lstat(subinfo, &st) != 0) + add_files(m, base, subs[i]); + } } tal_free(subs); }