ATF-log archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
org.NetBSD.atf.htdocs.revamp: 0ac8b9c7df262d13953b5b75afc9193ffc0e8ee9
#
#
# add_dir "scripts"
#
# add_file "scripts/build-xml.sh"
# content [8fb8647d8a57ee3c5d7f4c7a0dd144927710a560]
#
# add_file "scripts/generate-revision.sh"
# content [1e9335c5e5918ca7f655fb92595760c2904a6d64]
#
# patch "Makefile"
# from [289268e2441a13834cd1047830214749183d00a1]
# to [0e5a419589eb88786c93af89ffe0ea7b0d6afa56]
#
# set "scripts/build-xml.sh"
# attr "mtn:execute"
# value "true"
#
# set "scripts/generate-revision.sh"
# attr "mtn:execute"
# value "true"
#
============================================================
--- scripts/build-xml.sh 8fb8647d8a57ee3c5d7f4c7a0dd144927710a560
+++ scripts/build-xml.sh 8fb8647d8a57ee3c5d7f4c7a0dd144927710a560
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+set -e
+
+: ${XSLTPROC:=xsltproc}
+
+if [ ${#} -ne 4 ]; then
+ echo "Usage: build-xml.sh xsltfile revfile infile outfile" 1>&2
+ exit 1
+fi
+xsltfile="${1}"; shift
+revfile="${1}"; shift
+infile="${1}"; shift
+outfile="${1}"; shift
+
+${XSLTPROC} --stringparam revision "$(cat "${revfile}")" "${xsltfile}" \
+ "${infile}" >"${outfile}.tmp"
+if grep 'UNSUPPORTED' "${outfile}.tmp" >/dev/null; then
+ echo "${infile} contains tags unsupported by the stylesheet" 1>&2
+ exit 1
+fi
+mv "${outfile}.tmp" "${outfile}"
============================================================
--- scripts/generate-revision.sh 1e9335c5e5918ca7f655fb92595760c2904a6d64
+++ scripts/generate-revision.sh 1e9335c5e5918ca7f655fb92595760c2904a6d64
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+set -e
+
+: ${MTN:=mtn}
+
+if [ ${#} -ne 1 ]; then
+ echo "Usage: generate-revision.sh outfile" 1>&2
+ exit 1
+fi
+outfile="${1}"; shift
+
+base=$(${MTN} automate get_base_revision_id)
+if ${MTN} status | grep "no changes" >/dev/null 2>&1; then
+ local=
+else
+ local=" (locally modified)"
+fi
+
+temp="$(mktemp -t htdocs.XXXXXX)"
+trap "rm -f ${temp}" HUP INT QUIT TERM
+
+echo "${base}${local}" >>"${temp}"
+if test -f "${outfile}"; then
+ if cmp -s "${outfile}" "${temp}"; then
+ :
+ else
+ install -m 444 "${temp}" "${outfile}"
+ fi
+else
+ install -m 444 "${temp}" "${outfile}"
+fi
+rm -f "${temp}"
============================================================
--- Makefile 289268e2441a13834cd1047830214749183d00a1
+++ Makefile 0e5a419589eb88786c93af89ffe0ea7b0d6afa56
@@ -1,69 +1,120 @@
-SRCS= about.xml
-SRCS+= docs.xml
-SRCS+= download.xml
-SRCS+= examples.xml
-SRCS+= index.xml
-SRCS+= mlists.xml
-SRCS+= news.xml
-SRCS+= repository.xml
+HTDOCS = htdocs
-IMAGES= favicon.ico
-IMAGES+= img-components.png
-IMAGES+= img-test-structure.png
-IMAGES+= logo-web.png
-IMAGES+= rss-icon.png
+MTN = mtn
+XSLTPROC = xsltproc
-KEYS= keys/jmmv_AT_NetBSD_DOT_org.txt
+.PHONY: all
+.ORDER: dirs build
+all: dirs build
-CSSFILE= styles/style.css
-XSLFILE= styles/style.xsl
+# -------------------------------------------------------------------------
+# Output control.
+# -------------------------------------------------------------------------
-# --------------------------------------------------------------------
-# Rules
-# --------------------------------------------------------------------
+INFO_BUILD = echo " build"
+INFO_COPY = echo " copy"
+INFO_CREATE = echo " create"
+INFO_GENERATE = echo "generate"
-.SUFFIXES:
-.SUFFIXES: .xml .html
+# -------------------------------------------------------------------------
+# Special targets.
+# -------------------------------------------------------------------------
-OBJS= ${SRCS:.xml=.html}
-UPLOAD= ${OBJS} ${CSSFILE} ${IMAGES} ${KEYS} rss/rss.xml
+DIRS = $(HTDOCS)
+DIRS += $(HTDOCS)/images
+DIRS += $(HTDOCS)/rss
+DIRS += $(HTDOCS)/styles
-.xml.html: ${XSLFILE} layout.xml revision.txt
- xsltproc --stringparam revision "$$(cat revision.txt)" \
- ${XSLFILE} $< > $@.tmp
- @if grep 'UNSUPPORTED' $@.tmp >/dev/null; then \
- echo '$< contains unsupported tags'; \
- false; \
+.PHONY: dirs
+dirs:
+.for dir in $(DIRS)
+ @if test -d $(dir); then :; else \
+ $(INFO_CREATE) $(dir); \
+ install -d -m 755 $(dir); \
fi
- mv $@.tmp $@
+.endfor
-.PHONY: build clean cleandir upload
+.PHONY: clean
+clean:
+ test -f $(HTDOCS)/revision.tag && rm -rf $(HTDOCS)
-build: ${OBJS} rss/rss.xml
+# -------------------------------------------------------------------------
+# Documents.
+# -------------------------------------------------------------------------
-clean:
- rm -f ${OBJS} revision.txt rss/rss.xml
+XMLS = about.xml
+XMLS += docs.xml
+XMLS += download.xml
+XMLS += examples.xml
+XMLS += index.xml
+XMLS += layout.xml
+XMLS += mlists.xml
+XMLS += news.xml
+XMLS += repository.xml
-cleandir: clean
- rm -f *~
+XSLT = style.xsl
-upload: build
- scp -r ${UPLOAD} jmmv%www.NetBSD.org@localhost:public_html/atf
+build: build-xmls
+build-xmls:
+.for xml in $(XMLS)
+html_$(xml)= $(HTDOCS)/$(xml:S/.xml$/.html/)
+build-xmls: $(html_$(xml))
+$(html_$(xml)): $(xml) styles/$(XSLT) $(HTDOCS)/revision.tag layout.xml
+ @$(INFO_BUILD) $(html_$(xml))
+ @env XSLTPROC=$(XSLTPROC) ./scripts/build-xml.sh styles/$(XSLT) \
+ $(HTDOCS)/revision.tag $(xml) $(html_$(xml))
+.endfor
-#index.html news.html: dbs/news.xml
+$(HTDOCS)/revision.tag: Makefile _MTN/revision
+ @$(INFO_GENERATE) $(HTDOCS)/revision.tag
+ @env MTN=$(MTN) ./scripts/generate-revision.sh $(HTDOCS)/revision.tag
+ @touch $(HTDOCS)/revision.tag
-rss/rss.xml: rss/source.xml rss/generate.xsl dbs/news.xml
- xsltproc rss/generate.xsl rss/source.xml >rss/rss.xml
+# -------------------------------------------------------------------------
+# images directory.
+# -------------------------------------------------------------------------
-revision.txt: Makefile _MTN/revision
- base=$$(mtn automate get_base_revision_id); \
- if mtn status | grep "no changes" >/dev/null 2>&1; then \
- local=; \
- else \
- local=" (locally modified)"; \
- fi; \
- echo "$${base}$${local}" >revision.txt2; \
- if ! cmp -s revision.txt revision.txt2; then \
- mv revision.txt2 revision.txt; \
- fi
- rm -f revision.txt2
+IMAGES = components.png
+IMAGES += logo-web.png
+IMAGES += rss-icon.png
+IMAGES += test-structure.png
+
+build: copy-images
+copy-images:
+.for image in $(IMAGES)
+copy-images: $(HTDOCS)/images/$(image)
+$(HTDOCS)/images/$(image): images/$(image)
+ @$(INFO_COPY) $(HTDOCS)/images/$(image)
+ @install -m 444 images/$(image) $(HTDOCS)/images/$(image)
+.endfor
+
+# -------------------------------------------------------------------------
+# styles directory.
+# -------------------------------------------------------------------------
+
+CSS = style.css
+
+build: copy-css
+copy-css:
+.for css in $(CSS)
+copy-css: $(HTDOCS)/styles/$(css)
+$(HTDOCS)/styles/$(css): styles/$(css)
+ @$(INFO_COPY) $(HTDOCS)/styles/$(css)
+ @install -m 444 styles/$(css) $(HTDOCS)/styles/$(css)
+.endfor
+
+# -------------------------------------------------------------------------
+# rss directory.
+# -------------------------------------------------------------------------
+
+build: build-rss
+build-rss: $(HTDOCS)/rss/rss.xml
+$(HTDOCS)/rss/rss.xml: rss/generate.xsl rss/source.xml
+ @$(INFO_BUILD) $(HTDOCS)/rss/rss.xml
+ @$(XSLTPROC) rss/generate.xsl rss/source.xml >$(HTDOCS)/rss/rss.xml
+
+build: copy-rss
+copy-rss: $(HTDOCS)/rss/.htaccess
+$(HTDOCS)/rss/.htaccess: rss/dot.htaccess
+ @$(INFO_COPY) $(HTDOCS)/rss/.htaccess
+ @install -m 444 rss/dot.htaccess $(HTDOCS)/rss/.htaccess
Home |
Main Index |
Thread Index |
Old Index