1 # the purpose of this magic is to pull in the latest runtime files for vim
2 # we start withe theruntime provoded by the tarballs and compare MD5s against
4 # if this fails we look in the local source cache if they have been fetched
5 # for an earlier build and compare those MD5 files
6 # if this fails, we fetch the stuff from online and store it in the local src
8 # The local cache has to be set (makepkg.conf) AND it has to be writable
11 _OLDDIR
=$
(pwd) #get absolute path
13 _ftp
="ftp://ftp.vim.org/pub/vim/runtime"
15 # we're gonna be sneaky and grok the A-A-P recipe for the files we need
17 _srccache
="${SRCDEST}/vim-${_srcver}/"
19 echo "getting runtime recipe"
21 [ -f "${_recipe}" ] && rm "${_recipe}"
22 wget
"${_ftp}/${_recipe}" >/dev
/null
2>&1
25 _runtimedir
=$
(pwd) #get absolute path
27 # change IFS to loop line-by-line
31 echo "begin fetching updated runtime files..."
32 for _file
in $
(grep "file = " "${srcdir}/${_recipe}"); do
33 _file
=$
(echo ${_file} |
sed "s|.*file = \(.*\)|\1|")
34 _md5
=$
(grep -A2 "file = ${_file} *$" "${srcdir}/${_recipe}" | \
36 sed 's|@if get_md5(file) != "\(.*\)":|\1|g')
37 _dir
=$
(dirname "${_file}")
43 # if we have the file and the MD5sum fails, we technically don't have the file
44 if [ -f ${_file} ]; then
45 # MD5 fails ? ... we don't have the file
46 if [ $
(echo "${_md5} ${_file}" |
md5sum --status -c -) ]; then
52 # look files that were not copied from the unzipped sources
53 _cachefile
=${srcdir}/${_versiondir}/runtime/${_file}
54 if [ ${_havefile} -ne 1 -a -f ${_cachefile} ]; then
55 # MD5 fails ? ... we lookup if we downloaded another version earlier
56 if [ $
(echo "${_md5} ${_cachefile}" |
md5sum --status -c -) ]; then
57 _cachefile
=${_srccache}/${_file}
58 if [ -f ${_cachefile} ]; then
59 if [ $
(echo "${_md5} ${_cachefile}" |
md5sum --status -c -) ]; then
62 cp ${_cachefile} ${_dir}
67 cp ${_cachefile} ${_dir}
71 # look up the local $SRCDEST
72 _cachefile
=${_srccache}/${_file}
73 if [ ${_havefile} -ne 1 -a -f ${_cachefile} ]; then
74 # MD5 fails ? ... we don't have the file
75 if [ $
(echo "${_md5} ${_cachefile}" |
md5sum --status -c -) ]; then
78 cp ${_cachefile} ${_dir}
82 # so we finally have to fetch it and store it to $SRCDEST (cache)
83 if [ ${_havefile} -ne 1 ]; then
84 echo -n -e "\t ... fetching file ${_file} ..."
86 wget
"${_ftp}/${_file}" >/dev
/null
2>&1
88 # store freshly downloaded file in SRCDEST
89 mkdir
-p ${_srccache}/${_dir}
90 cp ${_file} ${_srccache}/${_dir}
94 # check the MD5 sum finally
95 if [ $
(echo "${_md5} ${_file}" |
md5sum --status -c -) ]; then
96 echo "!!!! md5sum check for ${_file} failed !!!!"
97 errors
=$
((${_errors} + 1))
102 echo "vim runtime got updated"
104 if [ ${_errors} -gt 0 ]; then
105 echo "${_errors} failed MD5 checks while updating runtime files -> build can't be completed"
108 echo -e "\tpatching filetype.vim for better handling of pacman related files ..."
109 sed -i "s/rpmsave/pacsave/;s/rpmnew/pacnew/;s/,\*\.ebuild/\0,PKGBUILD*,*.install/" filetype.vim
110 sed -i "/find the end/,+3{s/changelog_date_entry_search/changelog_date_end_entry_search/}" ftplugin
/changelog.vim
113 wget http
://www.vim.org
/scripts
/download_script.php
\?src_id
=10872 \
114 -O autoload
/pythoncomplete.vim