This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, master has been updated
via eb1d8c852dfdba9b37838d2cf3fa047f6c37b76c (commit)
via bc03ba3666179d8eb4d006ae3e1c1adf5df0d313 (commit)
via 8aad8e0f22b4dd80a1d4975e66b36a98329a3e27 (commit)
from 128a736ad62a003759027ce7fdfedefb55f6d77f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit eb1d8c852dfdba9b37838d2cf3fa047f6c37b76c
Author: Dries Kimpe <dkimpe(a)mcs.anl.gov>
Date: Thu Dec 12 16:26:19 2013 -0600
Another try for the docbook rules...
commit bc03ba3666179d8eb4d006ae3e1c1adf5df0d313
Author: Dries Kimpe <dkimpe(a)mcs.anl.gov>
Date: Fri Nov 15 12:39:54 2013 -0600
Add comment for AM_SILENT_RULES workaround
commit 8aad8e0f22b4dd80a1d4975e66b36a98329a3e27
Author: Dries Kimpe <dkimpe(a)mcs.anl.gov>
Date: Fri Nov 15 12:39:20 2013 -0600
Rewrite silent rules to avoid warning
Avoid 'non-POSIX recursive variable expansion' warning.
-----------------------------------------------------------------------
Summary of changes:
code/Make.rules | 41 ++++-
code/configure.ac | 1 +
code/doc/resilience/object-placement.txt | 2 +-
code/doc/resilience/rosd-replication.txt | 4 +-
code/maint/handle-ditaa.py | 269 ++++++++++++++++++++++++------
5 files changed, 250 insertions(+), 67 deletions(-)
Diff of changes:
diff --git a/code/Make.rules b/code/Make.rules
index 9b2f619..7789ff4 100644
--- a/code/Make.rules
+++ b/code/Make.rules
@@ -38,20 +38,20 @@ dirname = $(patsubst %/,%,$(dir $(1)))
#============================================================================
# Silent rules
-doc_verbose = $(doc_verbose_$(V))
-doc_verbose_ = $(doc_verbose_$(AM_DEFAULT_VERBOSITY))
+doc_verbose = $(doc_verbose_@AM_V@)
+doc_verbose_ = $(doc_verbose_@AM_DEFAULT_V@)
doc_verbose_0 = @echo " DOC $@";
-ditaa_verbose = $(ditaa_verbose_$(V))
-ditaa_verbose_ = $(ditaa_verbose_$(AM_DEFAULT_VERBOSITY))
+ditaa_verbose = $(ditaa_verbose_@AM_V@)
+ditaa_verbose_ = $(ditaa_verbose_@AM_DEFAULT_V@)
ditaa_verbose_0 = @echo " DITAA $@";
-asciidoc_verbose = $(asciidoc_verbose_$(V))
-asciidoc_verbose_ = $(asciidoc_verbose_$(AM_DEFAULT_VERBOSITY))
+asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
+asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
asciidoc_verbose_0 = @echo " ASCIIDOC $@";
-dblatex_verbose = $(dblatex_verbose_$(V))
-dblatex_verbose_ = $(dblatex_verbose_$(AM_DEFAULT_VERBOSITY))
+dblatex_verbose = $(dblatex_verbose_@AM_V@)
+dblatex_verbose_ = $(dblatex_verbose_@AM_DEFAULT_V@)
dblatex_verbose_0 = @echo " DBLATEX $@";
@@ -60,6 +60,11 @@ PDFDOCS =
PDFDOCS += $(patsubst %.txt, %.pdf, $(ASCIIDOCSRC))
+PDFDEPS = $(patsubst %.txt, %.d, $(ASCIIDOCSRC))
+
+# If deps exist, include them
+-include $(PDFDEPS)
+
# Ensure docs we built get cleaned by automake
# Docs are included in the distribution, so only remove when doing maintainerclean
MAINTAINERCLEANFILES += $(PDFDOCS)
@@ -75,7 +80,11 @@ doc: $(PDFDOCS)
.PHONY: docclean
docclean:
- $(doc_verbose) rm -f $(PDFDOCS)
+ $(doc_verbose) rm -f $(PDFDOCS) $(PDFDEPS) \
+ $(patsubst %.txt,%.ditaa_txt,$(ASCIIDOCSRC)) \
+ $(patsubst %.txt,%.xml,$(ASCIIDOCSRC)) \
+ $(patsubst %.txt,%_graphunnamed_*.png,$(ASCIIDOCSRC)) \
+ $(patsubst %.txt,%_graphunnamed_*.ditaa,$(ASCIIDOCSRC))
%.xml: %.ditaa_txt
$(asciidoc_verbose) $(ASCIIDOC) -b docbook -o $@ -a icons -a toc \
@@ -85,8 +94,20 @@ docclean:
$(dblatex_verbose) $(DBLATEX) -P latex.output.revhistory=0 --pdf \
-o $@ -q $<
+%.png: %.ditaa
+ $(ditaa_verbose) java -jar @srcdir@/maint/ditaa/ditaa.jar $< $@
+
%.ditaa_txt: %.txt
$(ditaa_verbose) $(srcdir)/maint/handle-ditaa.py \
- -j $(srcdir)/maint/ditaa/ditaa.jar -d $(dir $@) $< >$@
+ --gendep=$(patsubst %.ditaa_txt,%.d,$@) --output=$@ --srcdir=@abs_srcdir@ \
+ --graphbase=$(patsubst %.ditaa_txt,%_graph,$@) --path=@srcdir@ $<
+
+%.d: %.txt
+ $(ditaa_verbose) $(srcdir)/maint/handle-ditaa.py \
+ --gendep=$@ --output=$(patsubst %.d,%.ditaa_txt,$@) --srcdir=@abs_srcdir@ --path=@srcdir@ \
+ --graphbase=$(patsubst %.d,%_graph,$@) $<
+# keep xml/ditaa_txt files for quick rebuild
+#.PRECIOUS: $(patsubst %.txt,%.ditaa_txt,$(ASCIIDOCSRC)) \
+# $(patsubst %.txt,%.xml,$(ASCIIDOCSRC))
diff --git a/code/configure.ac b/code/configure.ac
index 025950f..0623a03 100755
--- a/code/configure.ac
+++ b/code/configure.ac
@@ -10,6 +10,7 @@ AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])
+# we should remove this soon, only needed for automake 1.10 and older
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_SRCDIR([INSTALL])
diff --git a/code/doc/resilience/object-placement.txt b/code/doc/resilience/object-placement.txt
index 8fe776a..3922c70 100644
--- a/code/doc/resilience/object-placement.txt
+++ b/code/doc/resilience/object-placement.txt
@@ -18,7 +18,7 @@ then it must be able to map an OID to a set of server node IDs.
[[fig-placement]]
.Object placement example
-image::figs/triton-layout.png[]
+image::doc/resilience/figs/triton-layout.png[]
<<fig-placement>> shows an example of how objects will be mapped to servers
in Triton. In this context, the address
diff --git a/code/doc/resilience/rosd-replication.txt b/code/doc/resilience/rosd-replication.txt
index 43479a6..684c43a 100644
--- a/code/doc/resilience/rosd-replication.txt
+++ b/code/doc/resilience/rosd-replication.txt
@@ -87,7 +87,7 @@ maintained even while the array is in a degraded mode.
[[fig-rep1]]
.Primary-copy replication
-image::figs/replication1.png[]
+image::doc/resilience/figs/replication1.png[]
Triton will employ a ``primary-copy'' replication protocol as shown in
<<fig-rep1>>. In this model, clients will write to the primary server for a given
@@ -229,7 +229,7 @@ replication across servers by forwarding data to replicas as needed.
[[fig-rep2]]
.ROSD replication with update numbers
-image::figs/replication2.png[]
+image::doc/resilience/figs/replication2.png[]
<<fig-rep2>> outlines the replication protocol used by the ROSD. As noted
in the <<sec-overview,overview>>, all writes are performed at the primary server for a given
diff --git a/code/maint/handle-ditaa.py b/code/maint/handle-ditaa.py
index 5906de8..6597c2b 100755
--- a/code/maint/handle-ditaa.py
+++ b/code/maint/handle-ditaa.py
@@ -2,67 +2,228 @@
import sys
import re
import subprocess
-import tempfile
-import getopt
import os
-header = re.compile("\[DITAA START\s+\((.*?)\)?\]")
-
-def main(document, ditaaPath, imageDir):
- parsed = []
- parsing = False
- filename = ""
- worklist = {}
- for line in document:
- m = header.match(line)
- if m:
- flags = m.groups()
- if flags:
- flags = "[%s]" % flags
- else:
- flags = ""
- handle, filename = tempfile.mkstemp(
- suffix=".jpg", prefix="ditaa-figure-", dir=imageDir)
- os.close(handle)
- parsed.append("image:%s%s\n\n" % (filename, flags))
- parsing = True
- fd, asciiname = tempfile.mkstemp(
- suffix = ".txt", prefix="asciiart-", dir="/tmp")
- a = os.fdopen(fd, "w+b")
- elif line.strip() == "[DITAA END]":
- a.close()
- parsing = False
- job = subprocess.Popen(["java", "-jar", ditaaPath, "-o", asciiname, filename], stdout=subprocess.PIPE)
- job.wait()
- os.unlink(asciiname)
- elif parsing:
- a.write (line)
- else:
- parsed.append(line)
-
- print ("".join(parsed))
+
+def smartUpdate (output, text):
+ """Update file only if new content is different"""
+ # try to open file
+ try:
+ old = open (output, "r").read ()
+ except:
+ old=None
+
+ if old:
+
+ newhash=hash (text)
+ oldhash=hash (old)
+
+ if newhash == oldhash:
+ return
+
+ f = open (output, "w")
+ f.write (text)
+
+
+class TextReader:
+
+ def __init__ (self):
+ self.source = []
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ return self.next ()
+
+ def push (self,fd):
+ self.source.append (fd)
+
+ def next (self):
+ while self.source:
+
+ ret = self.source[-1].readline ()
+ if ret == "":
+ self.source.pop ()
+ continue
+
+ return ret
+
+ raise StopIteration ()
+
+class ASCIIDocParser:
+
+ def __init__(self, source, output, searchloc, srcdir, graphbase):
+ """Takes FD for input, FD for output"""
+ self.deps = []
+ self.clean = []
+ self.header = re.compile("\[DITAA START\s+\((.*?)\)?\]")
+ self.include = re.compile("include::(.*?)\[(.*)\]")
+ self.image = re.compile("image::(.*?)(\[.*\])")
+ self.output = output
+ self.source = TextReader ()
+ self.source.push (source)
+ self.searchloc = searchloc
+ self.srcdir=srcdir
+ self.graphbase=graphbase
+ self.generated=[]
+
+ def findFile(self,f):
+ "Try to open a file by searching in a number of locations"
+ for a in self.searchloc:
+ try:
+ name=os.path.join (a,f)
+ f=open(name, "r")
+ return name,f
+ except:
+ pass
+ sys.stderr.write ("Could not find file '" + f + "'\n")
+ for a in self.searchloc:
+ sys.stderr.write ("Tried: " + os.path.join (a,f) + "\n")
+ raise IOError ()
+
+ def getDeps(self):
+ return self.deps
+
+
+ def getGenerated(self):
+ "Return list of generated image files"
+ return self.generated
+
+
+ def doGraph(self, name, flags, content, output):
+ cleanname=re.sub("[^a-z,0-9,A-Z]",'_', name)
+ filename=self.graphbase + cleanname
+ figsource=filename + ".ditaa"
+ figbin=filename+".png"
+ self.deps.append (figbin)
+
+ self.generated.append (figsource)
+
+ if (output):
+ smartUpdate (figsource, ''.join (content))
+ output.write ("image::%s[%s]\n" % (figbin,flags))
+
+ def parse(self):
+ ingraph=False
+ graphcount=1
+
+ for line in self.source:
+ if not ingraph:
+
+ # check for includes
+ m = self.include.match (line)
+ if m:
+ # Switch to new include file
+ name,fd=self.findFile (m.group(1))
+ self.source.push (fd)
+ self.deps.append (name)
+ continue
+
+
+ # Rewrite image path if needed
+ m = self.image.match (line)
+ if m:
+ path = m.group(1)
+ if self.srcdir:
+ # Rewrite image path
+ if not os.path.isabs (path):
+ path = os.path.join (self.srcdir, path)
+ line = "image::%s[%s]" % (path, m.group(2))
+ self.deps.append (path)
+
+
+ # Check for DITAA
+ m = self.header.match (line)
+
+ if m:
+ "Entering graph mode"
+ if m.groups:
+ graphflags=m.group(1)
+ else:
+ graphflags=None
+
+ graphname="unnamed_%i" % graphcount
+ graphcount=graphcount+1
+
+ ingraph=True
+ graph=[]
+ continue
+
+ # output line
+ if self.output:
+ self.output.write (line)
+
+ else: # in graph mode
+
+ if line.strip() == "[DITAA END]":
+ ingraph=False
+ self.doGraph (graphname, graphflags, graph, self.output)
+ continue
+
+ # add to graph
+ graph.append (line)
+
+
if __name__ == "__main__":
- imageDir = None
- ditaaPath = None
+ import argparse
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument ("--verbose", help="Be verbose", action="store_true")
+ parser.add_argument ("--gendep", type=str,
+ help="Write dependencies to <file>",
+ action="store")
+ parser.add_argument ("--deponly", help="Only calculate dependencies",
+ action="store_true")
+ parser.add_argument ("--output", help="Output file",
+ action="store")
+ parser.add_argument ("--srcdir", type=str, action="store",
+ help="Rewrite path for images to be relative to srcdir")
+ parser.add_argument ("--path",
+ help="Search path for include files. Can be specified multiple times.",
+ action="append")
+
+ parser.add_argument ("--graphbase", type=str, action="store",
+ help="Base filename for generated graphs", required=False)
+
+ parser.add_argument ("input", help="ASCIIDOC input file")
+
- options, args = getopt.getopt(sys.argv[1:], "d:j:")
- for o, v in options:
- if o == "-d":
- imageDir = v
- if o == "-j":
- ditaaPath = v
+ args = parser.parse_args()
- if imageDir == None:
- print ("usage: [-d <image directory>] [-j <path to ditaa jar>]\n")
- sys.exit(1)
+ if not args.output and args.gendep:
+ sys.stderr.write ("Need output filename for dep generation!\n")
+ sys.exit (1)
- if len(args) == 1:
- document = open(args[0], "r").readlines()
+ source = open (args.input, "r")
+
+ if not args.path:
+ args.path=[]
+
+ # Always search directory of input file
+ args.path.append (os.path.dirname (args.input))
+
+ # Output to file or stdout
+ if args.deponly:
+ output = None
+ elif args.output:
+ output = open (args.output, "w")
else:
- document = sys.stdin.readlines()
- main(document, ditaaPath, imageDir)
+ output = sys.stdout
+
+ if args.deponly:
+ output = None
+
+ proc=ASCIIDocParser (source, output, args.path, args.srcdir,
+ args.graphbase)
+ proc.parse ()
+
+ if args.gendep:
+ dep = open (args.gendep, "w")
+ dep.write (args.output)
+ dep.write (": ")
+ dep.write (" ".join (proc.getDeps ()))
+ dep.write ("\n")
-#
-#./handle-ditaa.py $1 | asciidoc -d book -o $TARGET -
hooks/post-receive
--