summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2009-05-15 12:08:43 +0200
committerFlorian Pritz <f-p@gmx.at>2009-05-15 12:08:43 +0200
commitc821cb4942eebc3db1a85020e285da7c66cf3b35 (patch)
tree54b1f78ebb83b608b632e7e41610c78d595ccb63
parent06805f308765f6c08f66bcba64d256683b83a4a2 (diff)
downloadaur-packages-c821cb4942eebc3db1a85020e285da7c66cf3b35.tar.gz
aur-packages-c821cb4942eebc3db1a85020e285da7c66cf3b35.tar.xz
update
-rw-r--r--vim/fetch_patches.sh35
-rw-r--r--vim/fetch_runtime.sh117
2 files changed, 137 insertions, 15 deletions
diff --git a/vim/fetch_patches.sh b/vim/fetch_patches.sh
index bff2e1e..80653a6 100644
--- a/vim/fetch_patches.sh
+++ b/vim/fetch_patches.sh
@@ -1,8 +1,8 @@
# the external logic for pulling in patches
get_patches() {
- _patchdir=${startdir}/src/patches
- cd ${startdir}/src/vim$(echo ${_srcver} | sed "s/\.//")
+ _patchdir=${srcdir}/patches
+ cd ${srcdir}/${_versiondir}
if [ -d ${_patchdir} ]; then
rm -rf ${_patchdir}
echo -e "\tremove patches from old build"
@@ -17,11 +17,12 @@ get_patches() {
echo -e "\tfetching checksumfile for patches"
wget ${_rpath}/MD5SUMS >/dev/null 2>&1
- downloads=0
+ _downloads=0
for _line in $(/bin/cat MD5SUMS); do
- downloads=$((${downloads} + 1))
- _md5=$(echo $_line | cut -d ' ' -f1)
_file=$(echo $_line | cut -d ' ' -f3)
+ [ ${_file##*.} == "gz" ] && continue
+ _downloads=$((${_downloads} + 1))
+ _md5=$(echo $_line | cut -d ' ' -f1)
if [ -f ${SRCDEST}/vim-${_srcver}/${_file} ]; then
echo -e "\thaving patch file:${_file}"
cp ${SRCDEST}/vim-${_srcver}/${_file} ./
@@ -44,19 +45,23 @@ get_patches() {
done
########
-
- rm *.gz
-
- if [ ${downloads} != ${_patchlevel} ]; then
- echo -e "Number of patches does not match the patchlevel!\nEdit the PKGBUILD accordingly!"
- # return 1
+
+ if [ ${_downloads} != ${_patchlevel} ]; then
+ echo ""
+ echo -e "\t\tWARNING!"
+ echo "You are not building the latest available version! A newer patchlevel"
+ echo "seems to be available. Please edit the PKGBUILD and add the latest"
+ echo "${_downloads} as pkgrel number!"
+ echo ""
+ sleep 10
fi
IFS=$_OLDIFS
rm MD5SUMS
- cd ${startdir}/src/vim$(echo ${_srcver} | sed "s/\.//")
- for _patchnum in $(seq -w 1 ${_patchlevel} ); do
- patch -Np0 -i ${_patchdir}/${_srcver}.${_patchnum} || return 1
- done
+ cd ${srcdir}/${_versiondir}
+ for _patchnum in $(/usr/bin/seq 1 ${_patchlevel}); do
+ _patch=${_srcver}.$(printf "%03d" ${_patchnum})
+ patch -Np0 -i ${_patchdir}/${_patch} || return 1
+ done
rm -rf ${_patchdir}
return 0
}
diff --git a/vim/fetch_runtime.sh b/vim/fetch_runtime.sh
new file mode 100644
index 0000000..61c59ae
--- /dev/null
+++ b/vim/fetch_runtime.sh
@@ -0,0 +1,117 @@
+# the purpose of this magic is to pull in the latest runtime files for vim
+# we start withe theruntime provoded by the tarballs and compare MD5s against
+# the latest runtime
+# if this fails we look in the local source cache if they have been fetched
+# for an earlier build and compare those MD5 files
+# if this fails, we fetch the stuff from online and store it in the local src
+# cache.
+# The local cache has to be set (makepkg.conf) AND it has to be writable
+
+update_runtime() {
+ _OLDDIR=$(pwd) #get absolute path
+ _errors=0
+ _ftp="ftp://ftp.vim.org/pub/vim/runtime"
+
+ # we're gonna be sneaky and grok the A-A-P recipe for the files we need
+ _recipe="getunix.aap"
+ _srccache="${SRCDEST}/vim-${_srcver}/"
+
+ echo "getting runtime recipe"
+ cd ${srcdir}
+ [ -f "${_recipe}" ] && rm "${_recipe}"
+ wget "${_ftp}/${_recipe}" >/dev/null 2>&1
+
+ cd "${_runtimedir}"
+ _runtimedir=$(pwd) #get absolute path
+
+ # change IFS to loop line-by-line
+ _OLDIFS=$IFS
+ IFS="
+"
+ echo "begin fetching updated runtime files..."
+ for _file in $(grep "file = " "${srcdir}/${_recipe}"); do
+ _file=$(echo ${_file} | sed "s|.*file = \(.*\)|\1|")
+ _md5=$(grep -A2 "file = ${_file} *$" "${srcdir}/${_recipe}" | \
+ grep "get_md5" | \
+ sed 's|@if get_md5(file) != "\(.*\)":|\1|g')
+ _dir=$(dirname "${_file}")
+
+ mkdir -p "${_dir}"
+
+ echo -e "\t${_file}"
+ _havefile=0
+ # if we have the file and the MD5sum fails, we technically don't have the file
+ if [ -f ${_file} ]; then
+ # MD5 fails ? ... we don't have the file
+ if [ $(echo "${_md5} ${_file}" | md5sum --status -c -) ]; then
+ rm ${_file}
+ else
+ _havefile=1
+ fi
+ fi
+ # look files that were not copied from the unzipped sources
+ _cachefile=${srcdir}/${_versiondir}/runtime/${_file}
+ if [ ${_havefile} -ne 1 -a -f ${_cachefile} ]; then
+ # MD5 fails ? ... we lookup if we downloaded another version earlier
+ if [ $(echo "${_md5} ${_cachefile}" | md5sum --status -c -) ]; then
+ _cachefile=${_srccache}/${_file}
+ if [ -f ${_cachefile} ]; then
+ if [ $(echo "${_md5} ${_cachefile}" | md5sum --status -c -) ]; then
+ rm ${_cachefile}
+ else
+ cp ${_cachefile} ${_dir}
+ _havefile=1
+ fi
+ fi
+ else
+ cp ${_cachefile} ${_dir}
+ _havefile=1
+ fi
+ fi
+ # look up the local $SRCDEST
+ _cachefile=${_srccache}/${_file}
+ if [ ${_havefile} -ne 1 -a -f ${_cachefile} ]; then
+ # MD5 fails ? ... we don't have the file
+ if [ $(echo "${_md5} ${_cachefile}" | md5sum --status -c -) ]; then
+ rm ${_cachefile}
+ else
+ cp ${_cachefile} ${_dir}
+ _havefile=1
+ fi
+ fi
+ # so we finally have to fetch it and store it to $SRCDEST (cache)
+ if [ ${_havefile} -ne 1 ]; then
+ echo -n -e "\t ... fetching file ${_file} ..."
+ cd "${_dir}"
+ wget "${_ftp}/${_file}" >/dev/null 2>&1
+ cd "${_runtimedir}"
+ # store freshly downloaded file in SRCDEST
+ mkdir -p ${_srccache}/${_dir}
+ cp ${_file} ${_srccache}/${_dir}
+ echo -e " done!"
+ fi
+
+ # check the MD5 sum finally
+ if [ $(echo "${_md5} ${_file}" | md5sum --status -c -) ]; then
+ echo "!!!! md5sum check for ${_file} failed !!!!"
+ errors=$((${_errors} + 1))
+ fi
+ done
+ IFS=${_OLDIFS}
+
+ echo "vim runtime got updated"
+
+ if [ ${_errors} -gt 0 ]; then
+ echo "${_errors} failed MD5 checks while updating runtime files -> build can't be completed"
+ return 1
+ else
+ echo -e "\tpatching filetype.vim for better handling of pacman related files ..."
+ sed -i "s/rpmsave/pacsave/;s/rpmnew/pacnew/;s/,\*\.ebuild/\0,PKGBUILD*,*.install/" filetype.vim
+ sed -i "/find the end/,+3{s/changelog_date_entry_search/changelog_date_end_entry_search/}" ftplugin/changelog.vim
+ fi
+ # make Aaron happy
+ wget http://www.vim.org/scripts/download_script.php\?src_id=7766 \
+ -O autoload/pythoncomplete.vim
+ cd "${_OLDDIR}"
+ return 0
+}