Permalink
Browse files

make sure patches are not appplied multiple times, fix #1270

  • Loading branch information...
mpapis committed Oct 27, 2012
1 parent ff9b3f6 commit 14c95964f71a1e5729112816fb0aa28a2d0f6ff8
Showing with 22 additions and 2 deletions.
  1. +22 −2 scripts/functions/manage/base
@@ -66,8 +66,7 @@ __rvm_apply_patches()
rvm_warn "Patch '$patch_name' not found."
result=1
elif
- ! __rvm_log_command "patch.apply.${patch_name##*\/}" "Applying patch $full_patch_path" \
- patch -F $patch_fuzziness -p$patch_level -N -f -i "$full_patch_path"
+ ! __rvm_apply_patch "${patch_name}" "$full_patch_path" "$patch_fuzziness" "$patch_level"
then
result=1
fi
@@ -76,6 +75,27 @@ __rvm_apply_patches()
return ${result:-0}
}
+__rvm_apply_patch()
+{
+ typeset _patch_name _full_patch_path _patch_fuzziness _patch_level
+ _patch_name="$1"
+ _full_patch_path="$2"
+ _patch_fuzziness="$3"
+ _patch_level="$4"
+
+ if
+ [[ -r "patches.list" ]] &&
+ GREP_OPTIONS="" \grep "${_patch_name}" "patches.list" >/dev/null
+ then
+ rvm_warn "Patch ${_patch_name} was already applied."
+ else
+ touch "patches.list"
+ __rvm_log_command "patch.apply.${_patch_name##*\/}" "Applying patch ${_full_patch_path}" \
+ patch -F ${_patch_fuzziness} -p${_patch_level} -N -f -i "${_full_patch_path}" &&
+ printf "%b" "${_patch_name}" >> "patches.list"
+ fi
+}
+
__rvm_install_source()
{
true ${rvm_ruby_selected_flag:=0} ${rvm_static_flag:=0}

0 comments on commit 14c9596

Please sign in to comment.