]> git.donarmstrong.com Git - neurodebian.git/blob - Makefile
BF: doh -- we do not care atm about return status of mirmon update and its grep
[neurodebian.git] / Makefile
1 #WWW_UPLOAD_URI = neuro.debian.net:/home/www/neuro.debian.net/www
2 WWW_UPLOAD_URI = ../www
3 WWW_DIR = build/html/
4
5 WWW_UPLOAD_URI_STATIC=$(WWW_UPLOAD_URI)/_static
6
7 # Lentghy one due to updatedb
8 all: updatedb upload-website mirmon
9 # Quick one -- just rebuilds html if new changes and adjusts the status of the mirrors
10 refresh: upload-website-stamp mirmon
11
12
13 pics:
14         $(MAKE) -C artwork
15
16
17 html: pics source
18         rsync -rvlhpt sphinx/ build/src
19         cd artwork;     cp button_w200.png logo_tuned/fmri_w200.png ../build/src/_static; cd ..
20         cp 3rd/jquery.livetwitter/jquery.livetwitter.min.js build/src/_static
21         cd build/src && $(MAKE) html BUILDDIR=$(CURDIR)/build 2>&1
22         mv $(WWW_DIR)/_static/robots.txt $(WWW_DIR)/
23         cp -r build/src/lists $(WWW_DIR)/
24         cp -r sphinx/survey/2011/figures/* $(WWW_DIR)/_images/
25         @echo "I: extracting header/trailer to be reused in non-sphinx pages"
26         sed -ne '1,/<!-- HEADNOTES -->/p' $(WWW_DIR)/index.html >| $(WWW_DIR)/_static/index-header.ihtml
27         sed -ne '/<h2>Comments<\/h2>/,$$p' $(WWW_DIR)/index.html >| $(WWW_DIR)/_static/index-trailer.ihtml
28
29 clean:
30         -rm html-stamp source-stamp upload-website-stamp
31         $(MAKE) -C artwork clean
32
33
34 distclean: clean
35         -rm -rf build
36
37
38 source: source-stamp
39 source-stamp: build/db.db
40         PYTHONPATH=.:$(PYTHONPATH) python neurodebian/dde.py \
41                 --cfg neurodebian.cfg \
42                 --db build/db.db \
43                 --outdir build/src \
44                 --pkgaddenum pkgs \
45                 --extracts /home/www/neuro.debian.net/www/debian/extracts \
46                 commandisirrelevant
47         rm -f html-stamp
48         touch $@
49
50
51 removecache:
52         -rm -rf build/cache
53
54 removedb:
55         -rm -f build/db.db
56
57
58 updatedb: removedb removecache build/db.db
59
60
61 build/db.db:
62         mkdir -p build
63         PYTHONPATH=.:$(PYTHONPATH) python neurodebian/dde.py \
64                 --cfg neurodebian.cfg \
65                 --db build/db.db \
66                 updatedb
67         -rm -f source-stamp
68
69
70 upload-website: html
71         rsync -rvzlhp --delete \
72         --exclude=debian --exclude=debian-local --exclude=_files \
73         --chmod=Dg+s,g+rw $(WWW_DIR) $(WWW_UPLOAD_URI)
74         : # Touch stamp here so we get it updated on every upload
75         touch $@-stamp
76
77 # call upload iff .git/index was modified, i.e. new changes got pulled in
78 upload-website-stamp: .git/index
79         $(MAKE) upload-website
80
81 mirmon:
82         # update and generate mirrors report
83         [ -x /usr/bin/mirmon ] && mirmon -q -get update -c mirmon-neurodebian.conf 2>&1 \
84         | grep -v 'date: invalid date.*DOCTYPE' || :
85         # [ -x $(WWW_UPLOAD_URI_STATIC)/mirrors-check.ihtml ] &&
86         # everything must be in place!
87         cat $(WWW_UPLOAD_URI_STATIC)/{index-header,mirrors-status,index-trailer}.ihtml \
88          >| $(WWW_UPLOAD_URI)/mirrors-status.html
89
90 .PHONY: removedb removecache updatedb upload-website clean distclean pics html mirmon
91