ifchange: --keep option

* tool/ifchange (--keep=suffix): new option for debug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-05-15 07:51:32 +00:00
parent 3f51cff4f9
commit 262529fdfb
1 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@
# usage: ifchange target temporary
timestamp=
keepsuffix=
until [ "$0" = 0 ]; do
case "$1" in
--timestamp)
@ -10,6 +11,12 @@ until [ "$0" = 0 ]; do
--timestamp=*)
timestamp=`expr \( "$1" : '[^=]*=\(.*\)' \)`
;;
--keep)
keepsuffix=.old
;;
--keep=*)
keepsuffix=`expr \( "$1" : '[^=]*=\(.*\)' \)`
;;
*)
break
;;
@ -30,6 +37,7 @@ if cmp "$target" "$temp" >/dev/null 2>&1; then
rm -f "$temp"
else
echo "$target updated"
${keepsuffix:+ mv -f "$target" "${target}${keepsuffix}" }
mv -f "$temp" "$target"
fi