Browse Source

Allow things without test/ dirs to be modules.
Allow versions on dependencies.
Display external dependencies on info pages.

Rusty Russell 17 years ago
parent
commit
e30753942e
7 changed files with 42 additions and 13 deletions
  1. 5 3
      Makefile
  2. 5 5
      Makefile-web
  3. 1 1
      ccan/ogg_to_pcm/_info.c
  4. 1 1
      ccan/wwviaudio/_info.c
  5. 12 2
      tools/ccan_depends.c
  6. 1 1
      web/staticall.php
  7. 17 0
      web/staticmoduleinfo.php

+ 5 - 3
Makefile

@@ -10,15 +10,17 @@
 #        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)

+ 5 - 5
Makefile-web

@@ -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

+ 1 - 1
ccan/ogg_to_pcm/_info.c

@@ -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;
 	}
 

+ 1 - 1
ccan/wwviaudio/_info.c

@@ -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;
 	}

+ 12 - 2
tools/ccan_depends.c

@@ -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;
 }

+ 1 - 1
web/staticall.php

@@ -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);
 	}
 }

+ 17 - 0
web/staticmoduleinfo.php

@@ -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>