mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
3f51cff4f9
commit
262529fdfb
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue