[arch-commits] Commit in vim/trunk (PKGBUILD fetch_patches.sh)

Daniel Griffiths dgriffiths at archlinux.org
Sat Feb 13 21:00:24 UTC 2010


    Date: Saturday, February 13, 2010 @ 16:00:23
  Author: dgriffiths
Revision: 68666

FS#16165 - Redesigned fetch_patches to enable parallel downloading

Modified:
  vim/trunk/PKGBUILD
  vim/trunk/fetch_patches.sh

------------------+
 PKGBUILD         |   17 +++++++++-----
 fetch_patches.sh |   64 ++++++++++-------------------------------------------
 2 files changed, 25 insertions(+), 56 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2010-02-13 20:56:39 UTC (rev 68665)
+++ PKGBUILD	2010-02-13 21:00:23 UTC (rev 68666)
@@ -5,13 +5,13 @@
 _srcver=7.2
 _patchlevel=359
 pkgver=${_srcver}.${_patchlevel}
-pkgrel=1
+pkgrel=2
 pkgdesc='Vi Improved, a highly configurable, improved version of the vi text editor'
-arch=(i686 x86_64)
+arch=('i686' 'x86_64')
 license=('custom:vim')
 url="http://www.vim.org"
 depends=('gpm' 'coreutils' 'perl')
-makedepends=('wget' 'sed' 'grep' 'gettext')
+makedepends=('wget' 'sed' 'grep' 'gettext' 'curl')
 backup=(etc/vimrc)
 install=${pkgname}.install
 # we need the extra-stuff to get all patches applied smoothly
@@ -20,7 +20,7 @@
         ftp://ftp.vim.org/pub/vim/extra/vim-${_srcver}-lang.tar.gz \
         fetch_patches.sh fetch_runtime.sh vimrc archlinux.vim)
 md5sums=('f0901284b338e448bfd79ccca0041254' '35e04482f07c57221c9a751aaa3b8dac' \
-         'd8884786979e0e520c112faf2e176f05' '6d7e8d7868e8bfaa9a5880cd9c439320' \
+         'd8884786979e0e520c112faf2e176f05' '159d4d11ecaf85c06623a02c1f843d01' \
          '45c1c3c6aff7de0d8fc2a9d8cd5cec7d' '3f42c68545b5b1afb2e9a5b2731ef063' \
          '10353a61aadc3f276692d0e17db1478e')
 
@@ -29,7 +29,6 @@
   _versiondir="vim"$(echo ${_srcver} | sed "s/\.//")
   # pull in patches from vim.org (or the src cache alternatively)
   . ${srcdir}/fetch_patches.sh
-  . ${srcdir}/fetch_runtime.sh
   get_patches || return 1
 
   cd ${srcdir}/${_versiondir}
@@ -43,6 +42,14 @@
     --enable-perlinterp
     #--with-global-runtime=/usr/share/vim --with-vim-name=vim \
   make || return 1
+}
+
+package()
+{
+  . ${srcdir}/fetch_runtime.sh
+  _versiondir="vim"$(echo ${_srcver} | sed "s/\.//")
+  cd ${srcdir}/${_versiondir}
+
   make  VIMRCLOC=/etc DESTDIR=${pkgdir} install
   cd ${pkgdir}/usr/bin
   rm ex view          # provided by (n)vi in core

Modified: fetch_patches.sh
===================================================================
--- fetch_patches.sh	2010-02-13 20:56:39 UTC (rev 68665)
+++ fetch_patches.sh	2010-02-13 21:00:23 UTC (rev 68666)
@@ -1,67 +1,29 @@
 # the external logic for pulling in patches
 
 get_patches() {
-  _patchdir=${srcdir}/patches
-  cd ${srcdir}/${_versiondir}
-  if [ -d ${_patchdir} ]; then
-    rm -rf ${_patchdir}
-    echo -e "\tremove patches from old build"
-  fi
-  mkdir ${_patchdir} && cd ${_patchdir}
-  _rpath=ftp://ftp.vim.org/pub/vim/patches/${_srcver}
 
-  # change IFS to loop line-by-line
-  _OLDIFS=$IFS
-  IFS="
-"
-  echo -e "\tfetching checksumfile for patches"
-  wget ${_rpath}/MD5SUMS >/dev/null 2>&1
+  curl ftp://ftp.vim.org/pub/vim/patches/${_srcver}/MD5SUMS | sed -e \
+    '/.gz$/d' > MD5SUMS
+  let _patchlevel=$_patchlevel+1
+  _currpatch=$(cat MD5SUMS | wc -l)
+  sed -i "${_patchlevel},\$d" MD5SUMS
+  cat MD5SUMS | awk '{ print $2 }' | sed -e \
+    "s|^|ftp://ftp.vim.org/pub/vim/patches/${_srcver}/|" | \
+    xargs -P 0 -r -n 1 wget -nv
+  md5sum -c MD5SUMS > /dev/null || return 1
+  for file in $(cat MD5SUMS | awk '{ print $2 }')
+    do patch -p0 < $file > vim.full.patch.log; done
 
-  _downloads=0
-  for _line in $(/bin/cat MD5SUMS); do
-    _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} ./
-    else
-      echo -n -e "\t... fetching patch file: ${_file} ..."
-      wget ${_rpath}/${_file} >/dev/null 2>&1
-      if [ -w ${SRCDEST} ]; then
-        if [ ! -d ${SRCDEST}/vim-${_srcver} ]; then
-          mkdir -p ${SRCDEST}/vim-${_srcver}
-        fi
-        cp ${_file} ${SRCDEST}/vim-${_srcver}/
-        echo " done!"
-      fi
-    fi
-
-    if [ $(echo "${_md5}  ${_file}" | md5sum --status -c -) ]; then
-      echo ${_file} md5sums do not match
-      return 1
-    fi
-  done
-
   ########
 
-  if [ ${_downloads} != ${_patchlevel} ]; then
+  if [ ${_patchlevel} -le ${_currpatch} ]; 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 "${_currpatch} as pkgrel number!"
     echo ""
     sleep 10
   fi
-  IFS=$_OLDIFS
-  rm MD5SUMS
-  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
 }




More information about the arch-commits mailing list