From e30753942e5a5ea6e958fdd850fc7a9c33285dae Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 9 Apr 2009 13:59:39 +0930 Subject: [PATCH] Allow things without test/ dirs to be modules. Allow versions on dependencies. Display external dependencies on info pages. --- Makefile | 8 +++++--- Makefile-web | 10 +++++----- ccan/ogg_to_pcm/_info.c | 2 +- ccan/wwviaudio/_info.c | 2 +- tools/ccan_depends.c | 14 ++++++++++++-- web/staticall.php | 2 +- web/staticmoduleinfo.php | 17 +++++++++++++++++ 7 files changed, 42 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 333ea449..409c4b4a 100644 --- a/Makefile +++ b/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) diff --git a/Makefile-web b/Makefile-web index 68422c52..4a180eca 100644 --- a/Makefile-web +++ b/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 diff --git a/ccan/ogg_to_pcm/_info.c b/ccan/ogg_to_pcm/_info.c index 48d4da88..2a5655ae 100644 --- a/ccan/ogg_to_pcm/_info.c +++ b/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; } diff --git a/ccan/wwviaudio/_info.c b/ccan/wwviaudio/_info.c index a25a2273..b039fae0 100644 --- a/ccan/wwviaudio/_info.c +++ b/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; } diff --git a/tools/ccan_depends.c b/tools/ccan_depends.c index 91d7c989..0c46173f 100644 --- a/tools/ccan_depends.c +++ b/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] \n" + errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] \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; } diff --git a/web/staticall.php b/web/staticall.php index 85c7fe97..ac39eddc 100644 --- a/web/staticall.php +++ b/web/staticall.php @@ -28,7 +28,7 @@ Or you can just download the 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); } } diff --git a/web/staticmoduleinfo.php b/web/staticmoduleinfo.php index 4accde1e..b9fac443 100644 --- a/web/staticmoduleinfo.php +++ b/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); ?> @@ -64,6 +65,22 @@ if ($dependencies) { + + + + -- 2.39.2

External dependencies:

1) + echo '(version '.$fields[1].') '; + echo '
'; + } +?>

Description: