summaryrefslogtreecommitdiff
path: root/buildbot/make_auditor_reports.sh
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-06-24 12:03:40 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2019-06-24 12:03:40 +0200
commit019389b3f08fcea73cbff5881303a29da6320ffa (patch)
tree3a14368eb72dda65c5eec374539f3232523acf65 /buildbot/make_auditor_reports.sh
parent91667984ed7410cddbed305034cf5b181ae7e810 (diff)
downloaddeployment-019389b3f08fcea73cbff5881303a29da6320ffa.tar.gz
deployment-019389b3f08fcea73cbff5881303a29da6320ffa.tar.bz2
deployment-019389b3f08fcea73cbff5881303a29da6320ffa.zip
Improving garbage collection
Diffstat (limited to 'buildbot/make_auditor_reports.sh')
-rwxr-xr-xbuildbot/make_auditor_reports.sh50
1 files changed, 33 insertions, 17 deletions
diff --git a/buildbot/make_auditor_reports.sh b/buildbot/make_auditor_reports.sh
index 4e4d321..d1515d8 100755
--- a/buildbot/make_auditor_reports.sh
+++ b/buildbot/make_auditor_reports.sh
@@ -9,6 +9,18 @@ REPORT_FILE_NOEXT=${HOME}/audit_report.${DATE}
WIRE_REPORT_FILE_NOEXT=${HOME}/wire_audit_report.${DATE}
JINJA_TEMPLATE="auditor-report.tex.j2"
+clean_files () {
+ # Remove garbage and set permissions.
+ echo Removing "${REPORT_FILE_NOEXT}.aux"
+ rm -f "${REPORT_FILE_NOEXT}.aux"
+ echo Removing "${REPORT_FILE_NOEXT}.tex"
+ rm -f "${REPORT_FILE_NOEXT}.tex"
+ echo Removing "${REPORT_FILE_NOEXT}.log"
+ rm -f "${REPORT_FILE_NOEXT}.log"
+ echo Removing "${REPORT_FILE_NOEXT}.txt", "${WIRE_REPORT_FILE_NOEXT}.txt"
+ rm -f "${REPORT_FILE_NOEXT}.txt" "${WIRE_REPORT_FILE_NOEXT}.txt"
+}
+
source ${HOME}/activate
if test -a ${REPORTS_DIRECTORY}/$(basename "${REPORT_FILE_NOEXT}.pdf"); then
@@ -24,31 +36,35 @@ taler-auditor-exchange \
-u $(taler-config -s exchange -o base_url)
# Generate first report.
-taler-auditor > "${REPORT_FILE_NOEXT}.txt"
+if ! taler-auditor > "${REPORT_FILE_NOEXT}.txt"; then
+ clean_files
+ exit 1
+fi
# Generate "wire" report.
-taler-wire-auditor > "${WIRE_REPORT_FILE_NOEXT}.txt"
+if ! taler-wire-auditor > "${WIRE_REPORT_FILE_NOEXT}.txt"; then
+ clean_files
+ exit 1
+fi
-python ${PWD}/render_auditor_reports.py \
+if ! python ${PWD}/render_auditor_reports.py \
"${REPORT_FILE_NOEXT}.txt" \
"${WIRE_REPORT_FILE_NOEXT}.txt" \
> "${REPORT_FILE_NOEXT}.tex" \
- < "${JINJA_TEMPLATE}"
+ < "${JINJA_TEMPLATE}"; then
+
+ clean_files
+ exit 1
+fi
cd ${HOME}
-pdflatex "${REPORT_FILE_NOEXT}.tex"
-# Give twice to let TeX resolve the sections references.
-pdflatex "${REPORT_FILE_NOEXT}.tex"
-
-# Remove garbage and set permissions.
-echo Removing "${REPORT_FILE_NOEXT}.aux"
-rm "${REPORT_FILE_NOEXT}.aux"
-echo Removing "${REPORT_FILE_NOEXT}.tex"
-rm "${REPORT_FILE_NOEXT}.tex"
-echo Removing "${REPORT_FILE_NOEXT}.log"
-rm "${REPORT_FILE_NOEXT}.log"
-echo Removing "${REPORT_FILE_NOEXT}.txt", "${WIRE_REPORT_FILE_NOEXT}.txt"
-rm "${REPORT_FILE_NOEXT}.txt" "${WIRE_REPORT_FILE_NOEXT}.txt"
+
+if ! pdflatex "${REPORT_FILE_NOEXT}.tex" && pdflatex "${REPORT_FILE_NOEXT}.tex"; then
+ clean_files
+ exit 1
+fi
+
+clean_files
if ! test -f "${REPORT_FILE_NOEXT}.pdf"; then
echo Could not produce the report