From 811b77cab63fe03f601f308552c66073d07cf94f Mon Sep 17 00:00:00 2001 From: Richard Henwood Date: Fri, 30 Dec 2011 15:31:23 -0600 Subject: [PATCH] LUDOC-13: diff works for doc changes. make diff now creates a annotated html file highlighting the differences between master and review manual builds. Signed-off-by: Richard Henwood Change-Id: Iec9a83b162697e17e894486c54090fbd406c2dff --- Makefile | 13 ++++++++----- tools/diff.py | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b97f6ec..6fa2c86 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,9 @@ TMP?=/tmp TGT_BASE=lustre_manual MASTER_URL=http://build.whamcloud.com/job/lustre-manual/lastSuccessfulBuild/ -MASTER_XHTML=$(MASTER_URL)/artifact/_out/$(TGT_BASE).xhtml +MASTER_URL_LAB=http://build.lab.whamcloud.com:8080/job/lustre-manual/lastSuccessfulBuild/ +MASTER_XHTML=$(MASTER_URL)/artifact/$(TGT_BASE).xhtml +MASTER_XHTML_LAB=$(MASTER_URL_LAB)/artifact/$(TGT_BASE).xhtml TGT_MASTER=$(TMP)/mastermanual @@ -23,7 +25,7 @@ XSL=$(or $(shell ls -d $(XSL_UBN) 2> /dev/null), \ $(shell ls -d $(XSL_MAC) 2> /dev/null)) .PHONY: all -all: clean xhtml html pdf +all: clean check xhtml html pdf diff .PHONY: check check: $(SRC_XML) @@ -53,19 +55,20 @@ pdf: $(TGT_BASE).pdf # get the git hash for the last successful build of the manual .PHONY: mastermanual.revision mastermanual.revision: - wget -O mastermanual.index $(MASTER_URL) + wget -O mastermanual.index $(MASTER_URL) || wget -O mastermanual.index $(MASTER_URL_LAB) awk '/Revision/ { print $$NF }' mastermanual.index > mastermanual.revision # only fetch the full manual if we don't have it or the manual changed $(TGT_MASTER).xhtml: mastermanual.revision if ! cmp -s mastermanual.revision $(TGT_MASTER).revision ; then\ - wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) && \ + (wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) || \ + wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML_LAB)) && \ mv mastermanual.revision $(TGT_MASTER).revision;\ fi .PHONY: diff diff: $(TGT_BASE).xhtml $(TGT_MASTER).xhtml - ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff + ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff.html .PHONY: push diff --git a/tools/diff.py b/tools/diff.py index 0c8036c..f407784 100755 --- a/tools/diff.py +++ b/tools/diff.py @@ -21,11 +21,22 @@ def textDiff(a, b): # @@ need to do something more complicated here # call textDiff but not for html, but for some html... ugh # gonna cop-out for now - out.append(''+''.join(a[e[1]:e[2]]) + ''+''.join(b[e[3]:e[4]])+"") + # I've put this hack in to try accomodate id's generated by docbook compilation. RJH 30/12/2011 + if ''+''.join(a[e[1]:e[2]]) + ''+''.join(b[e[3]:e[4]])+"") elif e[0] == "delete": - out.append('' + ''.join(a[e[1]:e[2]]) + "") + out.append('' + ''.join(a[e[1]:e[2]]) + "") elif e[0] == "insert": - out.append(''+''.join(b[e[3]:e[4]]) + "") + out.append(''+''.join(b[e[3]:e[4]]) + "") elif e[0] == "equal": out.append(''.join(b[e[3]:e[4]])) else: -- 1.8.3.1