]> git.pld-linux.org Git - packages/vim.git/blobdiff - update-source.sh
package /usr/share/vim/doc in vim-rt
[packages/vim.git] / update-source.sh
index adad465d8ca4b80b389f38ad6eca3655e77ada84..26823ec180ed03ba563e0910ca656d3276469837 100755 (executable)
@@ -22,22 +22,27 @@ fi
 
 pkg=vim
 specfile=$pkg.spec
-basever=7.3
+basever=7.4
 baseurl=ftp://ftp.vim.org/pub/editors/vim/patches/$basever
 sources=ftp://ftp.vim.org/pub/editors/vim/patches/$basever/MD5SUMS
 
 status=$(git status --porcelain sources)
 if [ "$status" ]; then
-       echo >&2 "sources status not clean; commit or stash any pending changes"
+       echo >&2 "WARNING: sources status not clean; commit or stash any pending changes"
        echo "$status"
-       exit 1
 fi
 
 if [ "$1" ]; then
        ver=$1
 else
        echo "Fetching latest patches list..."
-       wget -nv $sources -O sources
+       wget -nv $sources -O sources.tmp 2>&1
+       sort -k 2 -V < sources.tmp > sources.new
+       # exclude files already in git tree
+       git ls-files "$basever.*" | sed -e 's/\./\\./g;s/$/$/'| grep -vf - sources.new > sources
+       rm sources.new sources.tmp
+       # also update patches README
+       wget -nv $baseurl/README -O README.patches 2>&1
        ver=$(tail -n1 sources | awk '{print $NF}')
 fi
 
@@ -89,10 +94,11 @@ if [ "$curver" != "$ver" ]; then
                        --define "_builddir $outdir" \
                        --define "_rpmdir $rpmdir" \
                        $specfile || {
-                       echo "Package build failed"
+                       echo "Package build failed" >&2
                        tail -n 1000 $logfile >&2
                        exit 1
                }
+               echo >&2 "Package build OK"
 
                rpmdest=~/public_html/$dist/$arch/
                if [ "$publish_packages" ] && [ "$(ls $rpmdir/*.rpm 2>/dev/null)" ]; then
@@ -103,6 +109,15 @@ if [ "$curver" != "$ver" ]; then
                        poldek --cachedir=$HOME/tmp --mkidx -s $rpmdest/ --mt=pndir
                fi
        fi
+
+       # autocommit
+       msg=$(mktemp)
+       echo "updated to $ver" > $msg
+       echo "" >> $msg
+       over=$(git diff sources | awk '/^\+[0-9a-f]+/{over=$NF; gsub(/\./, "\\.",over); print over; exit}')
+       sed -ne "/$over/,\$p" README.patches | sed -re 's,^[ 0-9]+ ,,' >> $msg
+       git commit -F $msg $specfile sources
+       rm -f $msg
 else
        echo "$specfile already up to $ver"
 fi
This page took 0.15712 seconds and 4 git commands to generate.