updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / vim-stripped / fetch_patches.sh
bloba7e763f5b0f03c28d55d3bcfd4c2f3ab2e6e90f4
1 # the external logic for pulling in patches
3 get_patches() {
4 _patchdir=${srcdir}/patches
5 _rpath=ftp://ftp.vim.org/pub/vim/patches/${_srcver}
7 cd ${srcdir}/${_vimfolder}
8 if [ -d ${_patchdir} ]; then
9 rm -rf ${_patchdir}
10 echo -e "\tremove patches from old build"
12 mkdir ${_patchdir}
14 cd ${_patchdir}
16 # change IFS to loop line-by-line
17 _OLDIFS=$IFS
18 IFS="
20 echo -e "\tfetching checksumfile for patches"
21 wget ${_rpath}/MD5SUMS >/dev/null 2>&1
23 _patchtotal=$(cat MD5SUMS | sed -e /.*.gz/d | wc -l)
25 if [ -e "${srcdir}/ignore_patches.list" ]; then
26 echo -e "\tignoring specified patches"
27 for _line in $(/bin/cat ${srcdir}/ignore_patches.list); do
28 sed -i /${_line}/d MD5SUMS
29 done
32 downloads=0
33 for _line in $(/bin/cat MD5SUMS); do
34 downloads=$((${downloads} + 1))
35 _md5=$(echo $_line | cut -d ' ' -f1)
36 _file=$(echo $_line | cut -d ' ' -f3)
37 if [ -f ${SRCDEST}/vim-${_srcver}/${_file} ]; then
38 echo -e "\thaving patch file:${_file}"
39 cp ${SRCDEST}/vim-${_srcver}/${_file} ./
40 else
41 echo -n -e "\t... fetching patch file: ${_file} ..."
42 wget ${_rpath}/${_file} >/dev/null 2>&1
43 if [ -w ${SRCDEST} ]; then
44 if [ ! -d ${SRCDEST}/vim-${_srcver} ]; then
45 mkdir -p ${SRCDEST}/vim-${_srcver}
47 cp ${_file} ${SRCDEST}/vim-${_srcver}/
48 echo " done!"
52 if [ $(echo "${_md5} ${_file}" | md5sum --status -c -) ]; then
53 echo ${_file} md5sums do not match
54 return 1
56 done
58 ########
60 if [ ${_patchtotal} != ${_patchlevel} ]; then
61 echo -e "Number of patches (${_patchtotal}) does not match the patchlevel (${_patchlevel})!\nEdit the PKGBUILD accordingly!"
62 return 1
63 else
64 echo -e "Number of patches (${_patchtotal}) matches the patchlevel (${_patchlevel}), build starting..."
66 IFS=$_OLDIFS
67 rm MD5SUMS
68 cd ${srcdir}/${_vimfolder}
69 for _patch in $(/bin/ls ${_patchdir}); do
70 patch -Np0 -i ${_patchdir}/${_patch} || return 1
71 done
72 rm -rf ${_patchdir}
73 return 0