blob: 4728ca2adfee1f610193ed8cb510a45a4c2d2804 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/bash
. /etc/init.d/functions.sh
autopatch() {
local diff level p patches patched
[[ ! -d "$PATCH_OVERLAY" ]] && return 0
patches=$(ls -1 ${PATCH_OVERLAY}/${CATEGORY}/${PN}/${PN}-*.{patch,diff} 2>/dev/null)
[[ $patches == "" ]] && return 0
if ! cd ${S}; then
eerror "FAILED TO cd $S"
return 1
fi
for p in ${patches}; do
p=$(basename $p)
diff=${PATCH_OVERLAY}/${CATEGORY}/${PN}/${p}
if [[ -e $diff ]] && [ ! -e ${S}/.${p} ]; then
patched=0
for level in 0 1 2 3 4; do
if [[ $patched == 0 ]]; then
patch -g0 --dry -p${level} >/dev/null < $diff
if [ $? = 0 ]; then
ebegin "auto patching (-p${level}) ${p}"
patch -g0 -p${level} < $diff > /dev/null && patched=1
eend $?
touch ${S}/.${p}
fi
fi
done
[[ $patched != 1 ]] && eerror "FAILED auto patching $p"
else
[[ ! -e $diff ]] && eerror "$diff does not exist, unable to auto patch"
fi
done
cd $OLDPWD
}
#ewarn "at $EBUILD_PHASE"
case $EBUILD_PHASE in
compile)
ebegin "Checking for auto patches in ${PATCH_OVERLAY}/${CATEGORY}/${PN}"
if [[ ! -d "$PATCH_OVERLAY" ]]; then
eend 1
eerror "PATCH_OVERLAY=$PATCH_OVERLAY is not a dir"
else
PATH=$PATH:/usr/sbin:/usr/bin:/bin:/sbin
autopatch
eend 0
fi
;;
esac
|