commit 019389b3f08fcea73cbff5881303a29da6320ffa parent 91667984ed7410cddbed305034cf5b181ae7e810 Author: Marcello Stanisci <stanisci.m@gmail.com> Date: Mon, 24 Jun 2019 12:03:40 +0200 Improving garbage collection Diffstat:
| M | buildbot/make_auditor_reports.sh | | | 50 | +++++++++++++++++++++++++++++++++----------------- |
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git 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