blob: e3ef84b042b67a528f2771d610bc122cd6b97ef9 (
plain) (
tree)
|
|
#!/bin/bash
if ! type einfo >/dev/null 2>&1 ; then
. /etc/init.d/functions.sh
fi
autopatch() {
local diff level p patches patchdir
[[ ! -d "$PATCH_OVERLAY" ]] && return
patchdir="${PATCH_OVERLAY}/${CATEGORY}/${PN}"
patches=$(ls -1 ${patchdir}/{${PN},${P},${PF}}-[^0-9]*.{patch,diff} 2>/dev/null)
[[ $patches == "" ]] && return
if ! pushd ${S} &>/dev/null; then
eerror "FAILED TO cd $S"
return
fi
for p in ${patches}; do
p=$(basename $p)
diff=${patchdir}/${p}
if [[ -e $diff ]] && [ ! -e ${S}/.${p} ]; then
for level in 0 1 2 3 4; do
patch -g0 --dry -p${level} >/dev/null < $diff
if [ $? = 0 ]; then
ebegin "auto patching (-p${level}) ${p}"
patch -g0 -p${level} < $diff > /dev/null
eend $?
touch ${S}/.${p}
continue 2
fi
done
eerror "FAILED auto patching $p"
else
[[ ! -e $diff ]] && eerror "$diff does not exist, unable to auto patch"
fi
done
popd &>/dev/null
}
#ewarn "at $EBUILD_PHASE"
case $EBUILD_PHASE in
compile)
einfo "Checking for auto patches in ${PATCH_OVERLAY}/${CATEGORY}/${PN}"
if [[ ! -d "$PATCH_OVERLAY" ]]; then
eerror "PATCH_OVERLAY=$PATCH_OVERLAY is not a dir"
else
PATH=$PATH:/usr/sbin:/usr/bin:/bin:/sbin
autopatch
fi
;;
esac
|