5 # ------------------------------------------------
7 # ------------------------------------------------
9 # Tries to apply a patch from the given directory. Exits the program if it
11 check_and_apply_patch
() {
15 if [ \
( -d ${BASE}/$path \
) -a \
( ! -f ${BASE}/$path/.
`basename $patch` \
) ] ; then
17 echo -e "\nTrying to apply patch from directory: `pwd`"
18 `git apply --check --directory=$path $patch`
21 if [ $exit_status -ne 0 ]; then
22 echo -e "Failed to apply patch $patch in directory ${BASE}/$path"
25 cd ${BASE}/$path; git am
$patch
26 # it could have still failed (note that this is git-am, not git apply)
30 if [ $exit_status -ne 0 ]; then
31 echo -e "git-am failed on patch $patch in directory ${BASE}/$path"
34 touch ${BASE}/$path/.
`basename $patch`
35 echo -e "Successfully applied patch $patch in directory ${BASE}/$path"
41 check_and_apply_patch
"isl" "${BASE}/patches/0001-isl-dim-wise-single_valued-and-isl_pw_aff_map-functi.patch"