Commit 8fc1b230 authored by Rusty Russell's avatar Rusty Russell

web: generate correct pages for submodules.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 10e5e329
# This can be overridden on cmdline to generate pages elsewhere. # This can be overridden on cmdline to generate pages elsewhere.
WEBDIR=/home/rusty/www/html/ccan WEBDIR=/home/rusty/www/html/ccan
ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(MODS_NORMAL) $(MODS_EXTERNAL)) ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(MODS))
DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(MODS_NORMAL) $(MODS_EXTERNAL)) DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(MODS))
DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(MODS_NORMAL) $(MODS_EXTERNAL)) DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(MODS))
WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $(WEBDIR)/info WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $(WEBDIR)/info
JUNKDIRS=$(wildcard junkcode/*) JUNKDIRS=$(wildcard junkcode/*)
JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html) JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
...@@ -40,7 +40,7 @@ $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files cca ...@@ -40,7 +40,7 @@ $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files cca
$(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
$(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS) $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) > $@ php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
$(WEBDIR)/upload.html: web/staticupload.php $(WEBDIR)/upload.html: web/staticupload.php
php5 web/staticupload.php > $@ php5 web/staticupload.php > $@
...@@ -62,13 +62,16 @@ $(WEBDIR)/ccan.jpg: web/ccan.jpg ...@@ -62,13 +62,16 @@ $(WEBDIR)/ccan.jpg: web/ccan.jpg
cp $< $@ cp $< $@
$(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
URLPREFIX=../ php5 web/staticmoduleinfo.php `pwd`/ccan/$* > $@ @mkdir -p `dirname $@`
URLPREFIX=../`echo $* | tr -dc '/' | sed s',/,../,g'` php5 web/staticmoduleinfo.php `pwd`/ccan/$* $* > $@
$(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info clean-tree $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info clean-tree
tar -c -j -f $@ $$(git ls-files ccan/$*) $$(git ls-files ccan/$* | xargs -n1 -r readlink | sed -n 's,^../../,,p' | sort -u) @mkdir -p `dirname $@`
FILES=$$(tools/list_files.sh ccan/$*) && tar -c -j -f $@ $$FILES $$(echo $$FILES | xargs -n1 -r readlink | sed 's,^\(../\)*,,' | sort -u)
$(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info tools/ccan_depends clean-tree $(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info tools/ccan_depends clean-tree
tar -c -j -f $@ $$(git ls-files $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) ) ) $$(git ls-files $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) ) | xargs -n1 -r readlink | sed -n 's,^../../,,p' | sort -u) @mkdir -p `dirname $@`
FILES=$$(tools/list_files.sh ccan/$* $$(tools/ccan_depends ccan/$*) ) && tar -c -j -f $@ $$FILES $$(echo $$FILES | xargs -n1 -r readlink | sed 's,^\(../\)*,,' | sort -u)
distclean: distclean-web distclean: distclean-web
......
#! /bin/sh
# Script to list all files, for making tarballs.
set -e
if [ $# -eq 0 ]; then
echo Usage: list_files.sh '<ccandir>...' >&2
exit 1
fi
for d; do
# git ls-files recurses, but we want ignores correct :(
for f in `git ls-files $d | sed "s,^\($d/[^/]*\)/.*,\1," | uniq`; do
# Include subdirs, unless it's a separate module.
if [ -d "$f" ]; then
if [ ! -f "$f"/_info ]; then
$0 "$f"
fi
else
echo "$f"
fi
done
done
...@@ -5,9 +5,6 @@ $tempfolder = "/home/ccan/upload-temp/"; ...@@ -5,9 +5,6 @@ $tempfolder = "/home/ccan/upload-temp/";
//location of upload script (for posting uploads) //location of upload script (for posting uploads)
$uploadscript = "http://ccodearchive.net/uploader.php"; $uploadscript = "http://ccodearchive.net/uploader.php";
//infofile
$infofile = '/_info';
//ccan admin //ccan admin
$ccanadmin = "rusty@rustcorp.com.au"; $ccanadmin = "rusty@rustcorp.com.au";
......
...@@ -25,13 +25,7 @@ Or you can just download the <a href="ccan.tar.bz2">tarball of everything includ ...@@ -25,13 +25,7 @@ Or you can just download the <a href="ccan.tar.bz2">tarball of everything includ
<th align="right">Download</th> <th align="right">Download</th>
<?php <?php
$d = dir($argv[1]); $modules = array_slice($argv, 4);
$modules = array();
while (false !== ($entry = $d->read())) {
if ($entry[0] != '.' && is_file($argv[1].$entry."/_info")) {
array_push($modules, $entry);
}
}
sort($modules); sort($modules);
foreach ($modules as $module) { foreach ($modules as $module) {
...@@ -49,7 +43,6 @@ foreach ($modules as $module) { ...@@ -49,7 +43,6 @@ foreach ($modules as $module) {
</tr> </tr>
<?php <?php
} }
$d->close();
?> ?>
</table> </table>
......
...@@ -4,7 +4,7 @@ include('logo.html'); ...@@ -4,7 +4,7 @@ include('logo.html');
include('menulist.html'); include('menulist.html');
include('static-configuration'); include('static-configuration');
$module_path=$argv[1]; $module_path=$argv[1];
$module=basename($module_path); $module=$argv[2];
$maintainer=extract_field('maintainer',$module_path); $maintainer=extract_field('maintainer',$module_path);
$author=extract_field('author',$module_path); $author=extract_field('author',$module_path);
$summary=extract_field('summary',$module_path); $summary=extract_field('summary',$module_path);
...@@ -15,6 +15,7 @@ $dependencies=htmlspecialchars(shell_exec('tools/ccan_depends --direct '.$module ...@@ -15,6 +15,7 @@ $dependencies=htmlspecialchars(shell_exec('tools/ccan_depends --direct '.$module
$extdepends=htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan '.$module_path)); $extdepends=htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan '.$module_path));
$licence=extract_field('licence',$module_path); $licence=extract_field('licence',$module_path);
$license=extract_field('license',$module_path); $license=extract_field('license',$module_path);
$url_prefix = getenv("URLPREFIX");
?> ?>
<table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1"> <table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1">
<tr align="center" bgcolor="FFFFCC"> <tr align="center" bgcolor="FFFFCC">
...@@ -22,8 +23,8 @@ $license=extract_field('license',$module_path); ...@@ -22,8 +23,8 @@ $license=extract_field('license',$module_path);
<a href="<?=$repo_base.$module?>">Browse Source</a> <a href="<?=$repo_base.$module?>">Browse Source</a>
</td> </td>
<td> <td>
<a href="../<?=$tar_dir?>/with-deps/<?=$module?>.tar.bz2">Download</a> <a href="<?=$url_prefix?><?=$tar_dir?>/with-deps/<?=$module?>.tar.bz2">Download</a>
<a href="../<?=$tar_dir?>/<?=$module?>.tar.bz2">(without any required ccan dependencies)</a> <a href="<?=$url_prefix?><?=$tar_dir?>/<?=$module?>.tar.bz2">(without any required ccan dependencies)</a>
</tr> </tr>
</table> </table>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment