]> git.pld-linux.org Git - packages/vim.git/blobdiff - update-source.sh
Provide vim-syntax-gitcommit to ease upgrading
[packages/vim.git] / update-source.sh
index 8e85764ef4862b927bf3aba3db79c7b35bc07b06..9ef41e4eee5e1d382797e1f29075f198852a888e 100755 (executable)
@@ -22,25 +22,25 @@ 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.new 2>&1
+       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
+       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}')
@@ -58,6 +58,7 @@ if [ "$curver" != "$ver" ]; then
        fi
        sed -i -e "
                s/^\(%define[ \t]\+patchlevel[ \t]\+\)[0-9]\+\$/\1$patch/
+               s/^\(%define[ \t]\+rel[ \t]\+\)[0-9]\+\$/\11/
        " $specfile
 
        # fetch missing/mismatching files manually. faster than builder does that
@@ -94,10 +95,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
@@ -108,6 +110,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.104064 seconds and 4 git commands to generate.