From: Christian Heller Date: Sun, 17 Aug 2014 02:44:40 +0000 (+0200) Subject: Update erlehmann's redo scripts. X-Git-Tag: tce~653 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/move_down?a=commitdiff_plain;h=1d5d60e881d23cc0a316c82fdde8dc5c3e15c013;p=plomrogue Update erlehmann's redo scripts. --- diff --git a/build/redo_scripts/redo b/build/redo_scripts/redo index da3bf19..871b397 100755 --- a/build/redo_scripts/redo +++ b/build/redo_scripts/redo @@ -35,6 +35,7 @@ Usage: redo [OPTIONS] [TARGETS...] -d, --debug print dependency checks as they happen -h, --help print usage instructions and exit + -s, --shuffle randomize build order to find dependency bugs -x, --xtrace print commands as they are executed (variables expanded) Report bugs to . diff --git a/build/redo_scripts/redo-ifchange b/build/redo_scripts/redo-ifchange index 6358bbb..4de3417 100755 --- a/build/redo_scripts/redo-ifchange +++ b/build/redo_scripts/redo-ifchange @@ -53,6 +53,12 @@ _add_target() { fi } +_add_target_buildtime() { + [ -z "$1" ] && exit 1 + # Portable timestamps for systems supporting GNU date format '%N'. + date +%s%N | tr -d '%N' > "$REDO_DIR$1".buildtime +} + _dependencies_uptodate() { target="$1" target_relpath=${target##$REDO_BASE/} @@ -163,13 +169,12 @@ _do() { [ -e "$target.do" ] || _find_dofile "$target" # Add non existing .do file to non-existence dependencies so target is built when # .do file in question is created. - _add_dependency_ne "$(readlink -f "$target")" "$PWD/$target.do" + _add_dependency_ne "$target_abspath" "$PWD/$target.do" if [ ! -e "$dofile" ]; then # If .do file does not exist and target exists, it is a source file. if [ -e "$target" ]; then - _add_target "$(readlink -f $target)" - # Portable timestamps for systems supporting GNU date format '%N'. - date +%s%N | tr -d '%N' > "$REDO_DIR/$target_abspath".buildtime + _add_target "$target_abspath" + _add_target_buildtime "$target_abspath" return 0 # If .do file does not exist and target does not exist, stop. else @@ -178,7 +183,7 @@ _do() { fi # Add .do file to dependencies so target is built when .do file changes. else - _add_dependency "$(readlink -f "$target")" "$PWD/$dofile" + _add_dependency "$target_abspath" "$PWD/$dofile" _add_target "$PWD/$dofile" fi printf '%sredo %s%s%s%s%s\n' \ @@ -198,14 +203,13 @@ _do() { ! test -s "$tmp.tmp2" || mv "$tmp.tmp2" "$target" 2>/dev/null rm -f "$tmp.tmp2" - # Portable timestamps for systems supporting GNU date format '%N'. - date +%s%N | tr -d '%N' > "$REDO_DIR/$target_abspath".buildtime + _add_target_buildtime "$target_abspath" else _echo_debug_message "$REDO_DEPTH$dir$target is up to date." fi # Some do files (like all.do) do not usually generate output. if [ -e "$target" ]; then - _add_target "$(readlink -f $target)" + _add_target "$target_abspath" fi } @@ -251,7 +255,7 @@ _is_uptodate() { if [ ! -e "$REDO_DIR/$target".ctime ]; then _echo_debug_message "$REDO_DEPTH$dir$target_relpath.ctime does not exist." # Add source file to dependencies so target is built when source file changes. - _add_target "$(readlink -f $target)" + _add_target "$target_abspath" return 0 else _echo_debug_message "$REDO_DEPTH$dir$target_relpath.ctime exists." @@ -310,7 +314,9 @@ _run_dofile() { set +e if [ -n "$1" ]; then - for target; do + targets="$@" + [ "$REDO_SHUFFLE" = "1" ] && targets=$(shuf -e "$@") + for target in $targets; do _dirsplit "$target" _dir_shovel "$dir" "$base" dir="$xdir" base="$xbase" basetmp="$xbasetmp"