]> git.ozlabs.org Git - ccan/commitdiff
ccanlint: make sure fullname is always full path name.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 7 Jun 2010 07:04:15 +0000 (16:34 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 7 Jun 2010 07:04:15 +0000 (16:34 +0930)
tools/ccanlint/ccanlint.h
tools/ccanlint/compulsory_tests/check_build.c
tools/ccanlint/compulsory_tests/check_depends_built.c
tools/ccanlint/compulsory_tests/check_depends_exist.c
tools/ccanlint/compulsory_tests/compile_tests.c
tools/ccanlint/file_analysis.c

index 2ddbf37ae89b199819ead3a62fa6d34cf91aa0e0..6680f4f0406f8764270273bd9aeeef61a4736a95 100644 (file)
@@ -31,8 +31,6 @@ struct manifest {
 
        /* From tests/check_depends_exist.c */
        struct list_head dep_dirs;
 
        /* From tests/check_depends_exist.c */
        struct list_head dep_dirs;
-       /* From tests/check_depends_built.c */
-       struct list_head dep_objs;
 };
 
 struct manifest *get_manifest(const void *ctx, const char *dir);
 };
 
 struct manifest *get_manifest(const void *ctx, const char *dir);
index 2098f0d2a488212f2079e40ffc45d4ca48efe49e..5031cf84d4b8e40eff63aa4d22042a629dbfe22b 100644 (file)
@@ -27,9 +27,10 @@ static char *obj_list(const struct manifest *m)
        struct ccan_file *i;
 
        /* Other CCAN deps. */
        struct ccan_file *i;
 
        /* Other CCAN deps. */
-       list_for_each(&m->dep_objs, i, list)
-               list = talloc_asprintf_append(list, "%s ", i->name);
-
+       list_for_each(&m->dep_dirs, i, list) {
+               if (i->compiled)
+                       list = talloc_asprintf_append(list, "%s ", i->compiled);
+       }
        return list;
 }
 
        return list;
 }
 
index c261315ddf47a243d425c2317d5b740134a0712c..497a22c19950ff371480d627732489e4e827a566 100644 (file)
@@ -42,21 +42,16 @@ static void *check_depends_built(struct manifest *m, unsigned int *timeleft)
        char *report = NULL;
 
        list_for_each(&m->dep_dirs, i, list) {
        char *report = NULL;
 
        list_for_each(&m->dep_dirs, i, list) {
-               char *objfile;
-
                if (!expect_obj_file(i->fullname))
                        continue;
 
                if (!expect_obj_file(i->fullname))
                        continue;
 
-               objfile = talloc_asprintf(m, "%s.o", i->fullname);
-               if (stat(objfile, &st) != 0) {
+               i->compiled = talloc_asprintf(i, "%s.o", i->fullname);
+               if (stat(i->compiled, &st) != 0) {
                        report = talloc_asprintf_append(report,
                                                        "object file %s\n",
                        report = talloc_asprintf_append(report,
                                                        "object file %s\n",
-                                                       objfile);
-               } else {
-                       struct ccan_file *f = new_ccan_file(m, "", objfile);
-                       list_add_tail(&m->dep_objs, &f->list);
-               }
-                       
+                                                       i->compiled);
+                       i->compiled = NULL;
+               }                       
        }
 
        /* We may need libtap for testing, unless we're "tap" */
        }
 
        /* We may need libtap for testing, unless we're "tap" */
index bb6067edcd8bb16169d73e46c4d542e3c9f9fbeb..4a77d7e0e41ccd788f3d662090ad6fe94e7ffa11 100644 (file)
 
 static char *add_dep(char *sofar, struct manifest *m, const char *dep)
 {
 
 static char *add_dep(char *sofar, struct manifest *m, const char *dep)
 {
-       char *dir;
        struct stat st;
        struct ccan_file *f;
 
        struct stat st;
        struct ccan_file *f;
 
-       dir = talloc_asprintf(m, "%s/%s", ccan_dir, dep);
-       if (stat(dir, &st) != 0) {
+       f = new_ccan_file(m, ccan_dir, talloc_strdup(m, dep));
+       if (stat(f->fullname, &st) != 0) {
                return talloc_asprintf_append(sofar,
                                              "ccan/%s: expected it in"
                                              " directory %s\n",
                return talloc_asprintf_append(sofar,
                                              "ccan/%s: expected it in"
                                              " directory %s\n",
-                                             dep, dir);
+                                             dep, f->fullname);
        }
 
        }
 
-       f = new_ccan_file(m, "", dir);
        list_add_tail(&m->dep_dirs, &f->list);
        return sofar;
 }
        list_add_tail(&m->dep_dirs, &f->list);
        return sofar;
 }
index 1e184f2d24242201542840e006f4b3f283dc5a2d..c6527ed51a2fbc5145e07b8288211ced9373f57a 100644 (file)
@@ -40,8 +40,10 @@ static char *obj_list(const struct manifest *m, bool link_with_module)
                list = talloc_asprintf_append(list, " %s.o", m->dir);
 
        /* Other ccan modules. */
                list = talloc_asprintf_append(list, " %s.o", m->dir);
 
        /* Other ccan modules. */
-       list_for_each(&m->dep_objs, i, list)
-               list = talloc_asprintf_append(list, " %s", i->name);
+       list_for_each(&m->dep_dirs, i, list) {
+               if (i->compiled)
+                       list = talloc_asprintf_append(list, " %s", i->compiled);
+       }
 
        return list;
 }
 
        return list;
 }
index c03931d8b45874cd97366647adbe50bf269bae80..93baf8ebf56bd7703a27b3f9e06fdd58efab0d18 100644 (file)
@@ -14,6 +14,7 @@
 #include <dirent.h>
 #include <ctype.h>
 #include <stdarg.h>
 #include <dirent.h>
 #include <ctype.h>
 #include <stdarg.h>
+#include <assert.h>
 
 const char *ccan_dir;
 
 
 const char *ccan_dir;
 
@@ -38,6 +39,8 @@ struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name)
 {
        struct ccan_file *f;
 
 {
        struct ccan_file *f;
 
+       assert(dir[0] == '/');
+
        f = talloc(ctx, struct ccan_file);
        f->lines = NULL;
        f->line_info = NULL;
        f = talloc(ctx, struct ccan_file);
        f->lines = NULL;
        f->line_info = NULL;
@@ -172,7 +175,6 @@ struct manifest *get_manifest(const void *ctx, const char *dir)
        list_head_init(&m->other_test_files);
        list_head_init(&m->other_files);
        list_head_init(&m->dep_dirs);
        list_head_init(&m->other_test_files);
        list_head_init(&m->other_files);
        list_head_init(&m->dep_dirs);
-       list_head_init(&m->dep_objs);
 
        olddir = talloc_getcwd(NULL);
        if (!olddir)
 
        olddir = talloc_getcwd(NULL);
        if (!olddir)