]> git.ozlabs.org Git - ccan/commitdiff
Allow things without test/ dirs to be modules.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 9 Apr 2009 04:29:39 +0000 (13:59 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 9 Apr 2009 04:29:39 +0000 (13:59 +0930)
Allow versions on dependencies.
Display external dependencies on info pages.

Makefile
Makefile-web
ccan/ogg_to_pcm/_info.c
ccan/wwviaudio/_info.c
tools/ccan_depends.c
web/staticall.php
web/staticmoduleinfo.php

index 333ea449167b3989f594afeac313447812a83b76..409c4b4aed627494cb151ddf718d3990ca744e1d 100644 (file)
--- a/Makefile
+++ b/Makefile
 #        Especially tools/ccanlint/ccanlint and tools/namespacize.
 # distclean: destroy everything back to pristine state
 
-ALL=$(patsubst ccan/%/test, %, $(wildcard ccan/*/test))
-ALL_DIRS=$(patsubst %, ccan/%, $(ALL))
+# Anything with an _info.c file is a module.
+ALL=$(patsubst ccan/%/_info.c, %, $(wildcard ccan/*/_info.c))
 ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(ALL))
+# Not all modules have tests.
+ALL_TESTS=$(patsubst ccan/%/test/, %, $(wildcard ccan/*/test/))
 
 default: libccan.a
 
 include Makefile-ccan
 
-check: $(ALL_DIRS:ccan/%=check-%)
+check: $(ALL_TESTS:%=check-%)
 
 distclean: clean
        rm -f $(ALL_DEPENDS)
index 68422c5212ec1fe4bc95d42b017cd1e089ea0efe..4a180ecaa6899c1637a15e8b526296097f5cb38a 100644 (file)
@@ -1,9 +1,9 @@
 # This can be overridden on cmdline to generate pages elsewhere.
 WEBDIR=~/www/html/ccan/
 
-ALL_PAGES=$(patsubst ccan/%, $(WEBDIR)/info/%.html, $(ALL_DIRS))
-DIRECT_TARBALLS=$(patsubst ccan/%, $(WEBDIR)/tarballs/%.tar.bz2, $(ALL_DIRS))
-DEPEND_TARBALLS=$(patsubst ccan/%, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(ALL_DIRS))
+ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(ALL))
+DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(ALL))
+DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(ALL))
 WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $(WEBDIR)/info
 JUNKDIRS=$(wildcard junkcode/*)
 JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
@@ -56,10 +56,10 @@ $(WEBDIR)/ccan.jpg: web/ccan.jpg
 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
        @URLPREFIX=../ php5 web/staticmoduleinfo.php ccan/$* > $@
 
-$(WEBDIR)/tarballs/%.tar.bz2: ccan/%/test
+$(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info.c
        tar -c -j -f $@ `bzr ls --versioned --kind=file ccan/$*`
 
-$(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/test tools/ccan_depends
+$(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info.c tools/ccan_depends
        tar cfj $@ $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) | xargs -n 1 bzr ls --versioned --kind=file)
 
 distclean: distclean-web
index 48d4da88beb8148ab2d8129a9fe7c7d8285b43c1..2a5655ae73b12712d1e58606d623efcd49487c6f 100644 (file)
@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("libvorbis\n");
+               printf("libvorbis >=19\n");
                return 0;
        }
 
index a25a227359939d476fc462b07143cf158be56b20..b039fae04a6dc42936b3bda49cf2a46cc0897bbe 100644 (file)
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
 
        if (strcmp(argv[1], "depends") == 0) {
                printf("ccan/ogg_to_pcm\n"
-                      "libvorbis\n"
+                      "libvorbis >=19\n"
                       "portaudio\n");
                return 0;
        }
index 91d7c98983c772c6acc989b467d2e782be209ccd..0c46173f06a7987a72e6f5b376d2e96d7269b89e 100644 (file)
@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
        unsigned int i;
        bool compile = false;
        bool recurse = true;
+       bool ccan = true;
 
        if (argv[1] && streq(argv[1], "--direct")) {
                argv++;
@@ -22,10 +23,19 @@ int main(int argc, char *argv[])
                argc--;
                compile = true;
        }
+       if (argv[1] && streq(argv[1], "--non-ccan")) {
+               argv++;
+               argc--;
+               ccan = false;
+       }
        if (argc != 2)
-               errx(1, "Usage: ccan_depends [--direct] [--compile] <dir>\n"
+               errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] <dir>\n"
                        "Spits out all the ccan dependencies (recursively unless --direct)");
 
+       /* We find depends without compiling by looking for ccan/ */
+       if (!ccan && !compile)
+               errx(1, "--non-ccan needs --compile");
+
        if (compile)
                deps = get_deps(talloc_autofree_context(), argv[1], recurse);
        else
@@ -33,7 +43,7 @@ int main(int argc, char *argv[])
                                          recurse);
 
        for (i = 0; deps[i]; i++)
-               if (strstarts(deps[i], "ccan/"))
+               if (strstarts(deps[i], "ccan/") == ccan)
                        printf("%s\n", deps[i]);
        return 0;
 }
index 85c7fe97847e569dfb421008253758807c9a5fb9..ac39eddca23bd69b02ac06de4876f2aa0e3930fe 100644 (file)
@@ -28,7 +28,7 @@ Or you can just download the <a href="ccan.tar.bz2">tarball of everything includ
 $d = dir($argv[1]);
 $modules = array();
 while (false !== ($entry = $d->read())) {
-       if ($entry[0] != '.' && is_dir($argv[1].$entry."/test")) {
+       if ($entry[0] != '.' && is_file($argv[1].$entry."/_info.c")) {
                array_push($modules, $entry);
        }
 }
index 4accde1e83b237dd80c815660e362891586ca4d6..b9fac443d5439fd659dbdb1bcb64b62e1397bfd3 100644 (file)
@@ -11,6 +11,7 @@ $summary=extract_field('summary',$module);
 $description=htmlize_field('description',$module);
 $example=extract_field('example',$module);
 $dependencies=htmlspecialchars(shell_exec('tools/ccan_depends --direct '.$module));
+$extdepends=htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan '.$module));
 $licence=extract_field('licence',$module);
 ?>
 <table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1">
@@ -64,6 +65,22 @@ if ($dependencies) {
 </tr>
 <?php 
 }
+
+if ($extdepends) {
+?>
+<tr align="left" bgcolor="FFFFCC">
+<td><h3>External dependencies: </h3> <?php
+       foreach (split("\n", $extdepends) as $dep) {
+               $fields=preg_split("/\s+/", $dep);
+               echo $fields[0].' ';
+               if (count($fields) > 1)
+                       echo '(version '.$fields[1].') ';
+               echo '<br>';
+        }
+?></td>
+</tr>
+<?php 
+}
 ?>
 <tr align="left" bgcolor="FFFFCC">
 <td><h3>Description: </h3> <?=$description;?> </td>