mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ifchange: make target directory
* tool/ifchange: make target directory if it does not exist with its parent directories. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f4d18f524c
commit
9403716fb0
2 changed files with 13 additions and 10 deletions
|
@ -1,4 +1,7 @@
|
|||
Thu Jun 9 15:31:09 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Thu Jun 9 15:31:52 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* tool/ifchange: make target directory if it does not exist with
|
||||
its parent directories.
|
||||
|
||||
* win32/ifchange.bat: drop support for command.com used on old
|
||||
systems.
|
||||
|
|
|
@ -61,25 +61,25 @@ if [ "$color" = always -o \( "$color" = auto -a -t 1 \) ]; then
|
|||
unset msg_begin
|
||||
fi
|
||||
|
||||
targetdir=
|
||||
case "$target" in */*) targetdir=`dirname "$target"`;; esac
|
||||
if [ -f "$target" -a ! -${empty:+f}${empty:-s} "$temp" ] || cmp "$target" "$temp" >/dev/null 2>&1; then
|
||||
echo "$target ${msg_unchanged}unchanged${msg_reset}"
|
||||
rm -f "$temp"
|
||||
else
|
||||
echo "$target ${msg_updated}updated${msg_reset}"
|
||||
[ x"${keepsuffix}" = x ] || mv -f "$target" "${target}${keepsuffix}"
|
||||
[ x"${targetdir}" = x -o -d "${targetdir}" ] || mkdir -p "${targetdir}"
|
||||
[ x"${keepsuffix}" != x -a -f "$target" ] && mv -f "$target" "${target}${keepsuffix}"
|
||||
mv -f "$temp" "$target"
|
||||
fi
|
||||
|
||||
if [ -n "${timestamp}" ]; then
|
||||
if [ x"${timestamp}" = x. ]; then
|
||||
case "$target" in
|
||||
*/*)
|
||||
timestamp=`dirname "$target"`/.time.`basename "$target"`
|
||||
;;
|
||||
*)
|
||||
timestamp=.time."$target"
|
||||
;;
|
||||
esac
|
||||
if [ x"$targetdir" = x. ]; then
|
||||
timestamp=.time."$target"
|
||||
else
|
||||
timestamp="$targetdir"/.time.`basename "$target"`
|
||||
fi
|
||||
fi
|
||||
: > "$timestamp"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue