]> git.ozlabs.org Git - ccan/commitdiff
web: create "versioned" tarballs.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 8 Sep 2021 07:29:02 +0000 (16:59 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 8 Sep 2021 07:29:02 +0000 (16:59 +0930)
Fixes: https://github.com/rustyrussell/ccan/issues/90
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Makefile-web
web/staticall.php
web/staticindex.php

index 29ca254e635701eed3c20ff44dd3a6661ec83bf5..ae388c0cadfde215b5291ca79663ca7378b496d5 100644 (file)
@@ -18,6 +18,7 @@ JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
 JUNKBALLS=$(JUNKDIRS:%=$(WEBDIR)/%.tar.bz2)
 PRETTIFY=$(WEBDIR)/prettify/src/run_prettify.js $(WEBDIR)/prettify/src/prettify.css
 
+VERSION_NUM := $(shell git describe | cut -d- -f2)
 
 clean-tree:
        [ "$(WEBDEV)" ] || ! git status --porcelain | grep .
@@ -40,14 +41,17 @@ $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
        cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
        URLPREFIX=../ $(PHP) web/staticjunkcode.php junkcode/$* $* > $@
 
+$(WEBDIR)/ccan.tar.bz2: $(WEBDIR)/ccan-$(VERSION_NUM).tar.bz2
+       ln -sf ccan-$(VERSION_NUM).tar.bz2 ccan.tar.bz2
+
 # We want tarball to contain ccan/; we put junkcode in, but don't depend on it.
-$(WEBDIR)/ccan.tar.bz2: config.h Makefile $(shell git ls-files ccan tools licenses)
+$(WEBDIR)/ccan-$(VERSION_NUM).tar.bz2: config.h Makefile $(shell git ls-files ccan tools licenses)
        DIR=`pwd` && cd /tmp && ln -sf "$$DIR" ccan && tar cvfj $@ `for f in $^; do echo ccan/$$f; done` ccan/junkcode && rm ccan
 
 $(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)
-       $(PHP) web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
+       $(PHP) web/staticall.php ccan/ junkcode/ $(WEBDIR) ccan-$(VERSION_NUM).tar.bz2 $(MODS) > $@
 
 $(WEBDIR)/upload.html: web/staticupload.php
        $(PHP) web/staticupload.php > $@
@@ -57,7 +61,7 @@ $(WEBDIR)/uploader.php: web/uploader.php.cpp
        cpp -w -C -P $< | grep . > $@
 
 $(WEBDIR)/index.html: web/staticindex.php
-       $(PHP) web/staticindex.php > $@
+       $(PHP) web/staticindex.php ccan-$(VERSION_NUM).tar.bz2 > $@
 
 $(WEBDIR)/example-config.h: config.h
        cp $< $@
index 3e9d445a3eaed74f7e5222b38adddfc3560fbbf3..c82a8bdb5d6176296c71dc859cf35d9927f8a878 100644 (file)
@@ -4,7 +4,7 @@ include('logo.html');
 include('menulist.html');
 include('static-configuration');
 
-$tarballsize=round((filesize($argv[3]."/ccan.tar.bz2") + 1023) / 1024);
+$tarballsize=round((filesize($argv[3]."/".$argv[4]) + 1023) / 1024);
 ?>
 <div class='content'>
 <h1> List of all CCAN modules: </h1>
@@ -16,7 +16,7 @@ download.
 </p>
 
 <p>
-Or you can just download the <a href="ccan.tar.bz2">tarball of everything including CCAN tools (<?=$tarballsize?>K)</a>.
+Or you can just download the <a href="<?=$argv[4]?>">tarball of everything including CCAN tools (<?=$tarballsize?>K)</a>.
 </p>
 
 <table align="center" cellpadding="3" cellspacing="1">
@@ -25,7 +25,7 @@ Or you can just download the <a href="ccan.tar.bz2">tarball of everything includ
 <th align="right">Download</th>
 
 <?php 
-$modules = array_slice($argv, 4);
+$modules = array_slice($argv, 5);
 sort($modules);
 
 foreach ($modules as $module) {
index 700714ba7fe1884d51547594887cadabe19266df..8ef968e0f1c74b2055fccb471f4fc363ae335d45 100644 (file)
@@ -21,7 +21,7 @@ for Perl code development and sharing.
 <h2>Get The Code</h2>
 
 <p> You can get each module as a tarball (<a href="list.html">see
-list</a>), get a tarball of <a href="ccan.tar.bz2">the whole repository</a> with tools,
+list</a>), get a tarball of <a href="<?=$argv[1]?>">the whole repository</a> with tools,
 or clone our <a href="http://git.ozlabs.org/?p=ccan">git repository</a> (<tt>git clone git://git.ozlabs.org/~ccan/ccan</tt>) or the one on <a href="http://github.com/rustyrussell/ccan/">github</a>.
 </p>