From c7e970e29603faf6af19662b7704c25903a6f88b Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 3 Aug 2015 17:12:52 +0000 Subject: [PATCH] introduces refglobs as "dependency guard", to prevent documents from rebuilding due to unimportant changes svn path=/branches/test/; revision=31644 --- build/arguments.sh | 9 +++++++-- build/build_main.sh | 3 ++- build/makerules.sh | 14 +++++++++----- build/source_globber.sh | 3 ++- build/sources.sh | 34 ++++++++++++++++++++++------------ 5 files changed, 42 insertions(+), 21 deletions(-) diff --git a/build/arguments.sh b/build/arguments.sh index 31207cc3ef..bb560cc930 100755 --- a/build/arguments.sh +++ b/build/arguments.sh @@ -62,11 +62,15 @@ if [ -z "$inc_arguments" ]; then command="$1$command" [ "$#" -gt 0 ] && shift 1 && sourcesfile="$1" ;; - cast_globfile) + lang_sources) command="$1$command" [ "$#" -gt 0 ] && shift 1 && sourceglobfile="$1" [ "$#" -gt 0 ] && shift 1 && lang="$1" + ;; + cast_refglobs) + command="$1$command" [ "$#" -gt 0 ] && shift 1 && globfile="$1" + [ "$#" -gt 0 ] && shift 1 && reffile="$1" ;; *) print_error "Unknown option: $1" @@ -93,7 +97,8 @@ if [ -z "$inc_arguments" ]; then build_xmlstream) [ -z "$workfile" ] && die "Missing xhtml file name" ;; tree_maker) [ -z "$target" ] && die "Missing target location" ;; sourceglobs) [ -z "$sourcesfile" ] && die "Missing .sources file" ;; - cast_globfile) [ -z "$sourceglobfile" -o -z "$lang" -o -z "$globfile" ] && die "Need source globfile language and globfile" ;; + lang_sources) [ -z "$sourceglobfile" -o -z "$lang" ] && die "Need source globfile and language" ;; + cast_refglobs) [ -z "$globfile" -o -z "$reffile" ] && die "Need globfile and reffile" ;; map_tags) true;; *help*) print_help; exit 0 ;; *) die "Urecognised command or no command given" ;; diff --git a/build/build_main.sh b/build/build_main.sh index 577d687105..0dcb205e8a 100755 --- a/build/build_main.sh +++ b/build/build_main.sh @@ -40,5 +40,6 @@ case "$command" in build_xmlstream) build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" "$olang" ;; tree_maker) tree_maker "$tree" "$target" ;; sourceglobs) sourceglobs "$sourcesfile" ;; - cast_globfile) cast_globfile "$sourceglobfile" "$lang" "$globfile" ;; + lang_sources) lang_sources "$sourceglobfile" "$lang" ;; + cast_refglobs) cast_refglobs "$globfile" "$reffile" ;; esac diff --git a/build/makerules.sh b/build/makerules.sh index e065f2d383..819ba39dfe 100755 --- a/build/makerules.sh +++ b/build/makerules.sh @@ -47,9 +47,12 @@ MakeEND for lang in $(get_languages); do globfile="${filedir%/.}/._._${shortbase}.${lang}.sourceglobs" + refglobs="${filedir%/.}/._._${shortbase}.${lang}.refglobs" cat <"$globfile" +$(mes "$refglobs"): $(mes "$globfile") + \${PGLOBBER} \${PROCFLAGS} cast_refglobs "$globfile" "$refglobs" MakeEND done } @@ -114,7 +117,7 @@ xhtml_maker(){ textsfile="$(get_textsfile "$lang")" fundraisingfile="$(get_fundraisingfile "$lang")" - $bool_sourceinc && sourceglobs="${filedir#./}/._._${shortbase}.${lang}.sourceglobs" || unset sourceglobs + $bool_sourceinc && sourceglobs="${filedir#./}/._._${shortbase}.${lang}.refglobs" || unset sourceglobs cat <]+)([^>]*>):\2 filename="\1" \3:' } -cast_globfile(){ +#cast_globfile(){ +# sourceglobfile="$1" +# lang="$2" +# globfile="$3" +# +# list_sources "###" "$lang" "$(cat "$sourceglobfile")" >"$globfile" +#} + +lang_sources(){ sourceglobfile="$1" lang="$2" - globfile="$3" - sources="$(list_sources "###" "$lang" "$(cat "$sourceglobfile")")" - - [ -f "$globfile" ] && [ "$sources" = "$(cat "$globfile")" ] \ - || printf %s "$sources" >"$globfile" - - if [ "$sourceglobfile" -nt "$globfile" ]; then - printf %s "$sources" |while read incfile; do - [ "$incfile" -nt "$globfile" ] && touch "$globfile" || true - done - fi + list_sources "###" "$lang" "$(cat "$sourceglobfile")" } +cast_refglobs(){ + globfile="$1" + reffile="$2" + + if [ -f "$globfile" ] && diff "$globfile" "$reffile" >/dev/null; then + incfile="$(cat "$globfile" |xargs -d\\n ls -t |sed -n '1p')" + [ "$incfile" -nt "$globfile" ] && touch "$globfile" + else + cp "$globfile" "$reffile" + fi +}