ITS#8731 Improve sample processing script

This commit is contained in:
Ondřej Kuzník 2019-03-21 10:29:03 +00:00
parent 47102fcced
commit 4a136c7651

View file

@ -10,16 +10,16 @@ SPATCH_OPTS=( --macro-file-builtins "$PATCH_DIR/macros.h" )
SED_TRANSFORMATIONS=() SED_TRANSFORMATIONS=()
# strip trailing whitespace copied from source on affected lines
SED_TRANSFORMATIONS+=( -e 's/^\(+.*\)\s\+$/\1/' )
# split out multipart strings back to original form (one per line) # split out multipart strings back to original form (one per line)
SED_TRANSFORMATIONS+=( -e 's/^\(+\s*\)\(.*"\) \(".*\)"$/\1\2\n+\1\3/' ) SED_TRANSFORMATIONS+=( -e 's/^\(+\s*\)\(.*"\) \(".*\)"$/\1\2\n+\1\3/' )
# re-add whitespace around parentheses # re-add whitespace around parentheses
SED_TRANSFORMATIONS+=( -e 's/^\(+.*Debug[0-3]\?(\)\s*$/\1 /' ) SED_TRANSFORMATIONS+=( -e 's/^\(+.*Debug[0-3]\?(\)\s*/\1 /' )
SED_TRANSFORMATIONS+=( -e 's/^\(+.*[^ ]\));$/\1 );/' ) SED_TRANSFORMATIONS+=( -e 's/^\(+.*[^ ]\));$/\1 );/' )
# strip trailing whitespace copied from source on affected lines
SED_TRANSFORMATIONS+=( -e 's/^\(+.*\)\s\+$/\1/' )
# fix whitespace errors in source we touch # fix whitespace errors in source we touch
SED_TRANSFORMATIONS+=( -e 's/^\(+.*\) \t/\1\t\t/' ) SED_TRANSFORMATIONS+=( -e 's/^\(+.*\) \t/\1\t\t/' )
SED_TRANSFORMATIONS+=( -e 's/^\(+\t*\) \{1,3\}\t/\1\t/' ) SED_TRANSFORMATIONS+=( -e 's/^\(+\t*\) \{1,3\}\t/\1\t/' )
@ -29,7 +29,7 @@ normalise() {
shift shift
# iterate until we've reached fixpoint # iterate until we've reached fixpoint
while ! cmp "$patch" "${patch}.new"; do while ! cmp "$patch" "${patch}.new" 2>/dev/null; do
if [ -e "${patch}.new" ]; then if [ -e "${patch}.new" ]; then
mv -- "${patch}.new" "$patch" mv -- "${patch}.new" "$patch"
fi fi