diff options
author | Florian Dold <florian@dold.me> | 2024-01-10 13:35:57 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-10 13:37:29 +0100 |
commit | e0cc5c9caf3953ee8409fad854ab894fd1a521e7 (patch) | |
tree | f1114520183e4764f1be3d5d49331b7731961759 /contrib/taler-terms-generator | |
parent | b8a07ff3a314ae0e72441563f6580e07b3c83773 (diff) |
taler-terms-generator: support incremental buildsv0.9.4-dev.8
Diffstat (limited to 'contrib/taler-terms-generator')
-rwxr-xr-x | contrib/taler-terms-generator | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/contrib/taler-terms-generator b/contrib/taler-terms-generator index 346599535..4f348ae7b 100755 --- a/contrib/taler-terms-generator +++ b/contrib/taler-terms-generator @@ -95,9 +95,10 @@ LOCALE_DIR=$(taler-config -s "PATHS" -o "LOCALEDIR" -f) OUTPUT=$(taler-config -s "EXCHANGE" -o "TERMS_DIR" -f) PAPER="a4" COPYRIGHT="2014-2023 Taler Systems SA (GPLv3+ or GFDL 1.3+)" +INCREMENTAL=0 # Parse command-line options -while getopts ':a:C:hi:l:L:o:p:t:' OPTION; do +while getopts ':a:C:hKi:l:L:o:p:t:' OPTION; do case "$OPTION" in a) AUTHOR="$OPTARG" @@ -110,6 +111,7 @@ while getopts ':a:C:hi:l:L:o:p:t:' OPTION; do echo ' -a AUTHOR -- set author header' "(default: $AUTHOR)" echo ' -C COPYRIGHT -- set copyright header' "(default: $COPYRIGHT)" echo ' -h -- print this help' + echo ' -K -- rebuild only if input is older than output' echo ' -i INPUT -- input file to convert' "(default: $VERSION)" echo ' -l LANGUAGE -- target language to add' echo ' -L LOCALE_DIR -- directory with resources for translation' "(default: $LOCALE_DIR)" @@ -144,6 +146,9 @@ while getopts ':a:C:hi:l:L:o:p:t:' OPTION; do t) TITLE="$OPTARG" ;; + K) + INCREMENTAL=1 + ;; ?) echo "Unrecognized command line option" 1>&2 exit 1 @@ -163,6 +168,12 @@ then exit 1 fi +if ! which make > /dev/null +then + echo "Command 'make' not found, but required. Please install make." 1>&2 + exit 1 +fi + # We append ".rst" if needed, remove if given on command-line # shellcheck disable=SC2001 VERSION=$(echo "${VERSION}" | sed -e "s/\.rst$//") @@ -220,6 +231,17 @@ then exit 0 fi +# As a heuristic for incremental builds, we only check the text output file. +if [[ "$INCREMENTAL" -eq 1 ]] +then + if [[ "$VERSION" -ot "${OUTPUT}/buildstamp" ]]; + then + echo "Not rebuilding, input file $VERSION is older than $OUTPUT/buildstamp." + exit 0 + fi +fi + + # shellcheck disable=SC2086 for d in en $(ls -d ${LOCALE_DIR}/?? | grep -v "en" 2> /dev/null || true) do @@ -306,5 +328,10 @@ do mv "${BUILDDIR}/pdf/${VERSION_BASENAME}.pdf" "${OUTPUT}/${LANGUAGE}/${VERSION_BASENAME}.pdf" done +if [[ "$INCREMENTAL" -eq 1 ]] +then + touch "${OUTPUT}/buildstamp"; +fi + echo "Done" 1>&2 exit 0 |