-
Notifications
You must be signed in to change notification settings - Fork 0
/
makepatches.sh
executable file
·80 lines (74 loc) · 1.42 KB
/
makepatches.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
source $(dirname $0 )/env.sh
patchesdn=patches
function fpatch {
if [ -f ${src} ]&&[ -f ${tgt} ]
then
if dt=$(diff ${src} ${tgt})
then
return 0
elif [ -n "${dt}" ]
then
patchfile="$(echo ${src} | sed "s%/${srcdn}/%/${patchesdn}/${srcdn}/%").diff"
patchdir=$(dirname ${patchfile})
if [ ! -d ${patchdir} ]
then
mkdir -p ${patchdir}
fi
diff ${src} ${tgt} > ${patchfile}
ls -l ${patchfile}
return 0
else
echo "$0 Error in 'diff ${src} ${tgt}'." >&2
return 1
fi
else
echo "$0 Error missing file '${tgt}'." >&2
return 1
fi
}
function fdriver {
for src in $(find ${root}/${srcdn} -path '*/.svn' -prune -o -type f -print )
do
if tgt=$(echo ${src} | sed "s%/${srcdn}/%/${tgtdn}/%")
then
if fpatch
then
continue
else
echo "$0 Error in 'fpatch ${src} ${tgt}'." >&2
return 1
fi
else
echo "$0 Error in 'echo ${src} | sed \"s%/${srcdn}/%/${tgtdn}/%\"'." >&2
return 1
fi
done
return 0
}
root=${TOPD}
srcdn="gcc-${GCC_VERSION}"
tgtdn="gcc/${srcdn}"
if fdriver
then
srcdn="acme"
tgtdn="binutils"
if fdriver
then
srcdn="c30_resource"
tgtdn="binutils"
if fdriver
then
exit 0
else
echo "$0 Error in fdriver '${C30_RESOURCE}'." >&2
exit 1
fi
else
echo "$0 Error in fdriver '${BINUTILS_DIR}'." >&2
exit 1
fi
else
echo "$0 Error in fdriver '${GCC_DIR}'." >&2
exit 1
fi