[ff1e2f9] | 1 | #!/bin/sh
|
---|
| 2 | # Jonathan Norman
|
---|
| 3 |
|
---|
| 4 | # Vim branch update patch generator
|
---|
[06dcdf6] | 5 |
|
---|
| 6 | VERSION=$1
|
---|
| 7 |
|
---|
| 8 | # Check Input
|
---|
| 9 | #
|
---|
| 10 | if [ "${VERSION}" = "" ]; then
|
---|
[ff1e2f9] | 11 | echo "$0 [Vim_version]"
|
---|
[9676bac] | 12 | echo "This will Create a Patch for Vim Vim_Version"
|
---|
| 13 | exit 255
|
---|
[06dcdf6] | 14 | fi
|
---|
| 15 |
|
---|
[ff1e2f9] | 16 | TMP=~/tmp/vim-${VERSION}
|
---|
| 17 | PATCHDIR=${TMP}/patches
|
---|
| 18 | PATCHURL=ftp://ftp.vim.org/pub/vim/patches
|
---|
[06dcdf6] | 19 | SERIES=$(echo ${VERSION} | sed -e 's/\.//g')
|
---|
[ff1e2f9] | 20 | CLFS_PATCHS=http://patches.cross-lfs.org/dev/
|
---|
[06dcdf6] | 21 |
|
---|
[ff1e2f9] | 22 | # Figure out patch number
|
---|
| 23 | UPDATE_NUM=$(curl -ls http://patches.cross-lfs.org/dev/ | grep vim-${VERSION} | cut -d . -f 3 | cut -d - -f 3-)
|
---|
| 24 | UPDATE_NUM=$(expr ${UPDATE_NUM} + 1)
|
---|
[06dcdf6] | 25 |
|
---|
[ff1e2f9] | 26 | # Download patches
|
---|
| 27 | echo "Downloading patches for VIM ${VERSION}"
|
---|
| 28 | PATCH_NUM=$(curl -s $PATCHURL/${VERSION}/ | grep " ${VERSION}." | cut -f 3- -d . | tail -n1)
|
---|
| 29 | mkdir -p $PATCHDIR
|
---|
| 30 | cd $PATCHDIR
|
---|
| 31 | curl -O -# $PATCHURL/$VERSION/$VERSION.[001-$PATCH_NUM]
|
---|
[c7ef534] | 32 |
|
---|
[ff1e2f9] | 33 | echo "Downloading source for VIM $VERSION"
|
---|
| 34 | cd $TMP
|
---|
| 35 | curl -sO ftp://ftp.vim.org/pub/vim/unix/vim-${VERSION}.tar.bz2
|
---|
| 36 | tar -xvf vim-${VERSION}.tar.bz2
|
---|
| 37 | cp -R vim${SERIES} vim${SERIES}.orig
|
---|
[06dcdf6] | 38 |
|
---|
[ff1e2f9] | 39 | echo -n "Generating Patch..."
|
---|
| 40 | cd vim${SERIES}/src
|
---|
[06dcdf6] | 41 |
|
---|
[ff1e2f9] | 42 | for PATCH in $(ls $PATCHDIR); do
|
---|
| 43 | patch -Np0 -i $PATCHDIR/$PATCH
|
---|
| 44 | # echo $PATCHDIR/$PATCH
|
---|
[06dcdf6] | 45 | done
|
---|
| 46 |
|
---|
[ff1e2f9] | 47 | cd $TMP
|
---|
[d8a9d8b] | 48 |
|
---|
[ff1e2f9] | 49 | # Create patch
|
---|
| 50 | echo "Submitted By: Jonathan Norman (jonathan at bluesquarelinux dot co dot uk)" > vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 51 | echo "Date: `date +%Y-%m-%d`" >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 52 | echo "Initial Package Version: ${VERSION}" >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 53 | echo "Origin: Upstream" >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 54 | echo "Upstream Status: Applied" >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 55 | echo "Description: Contains all upstream patches up to ${VERSION}.${UPDATE_NUM}" >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 56 | echo "" >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 57 |
|
---|
| 58 | LC_ALL=C TZ=UTC0 diff -Naur vim${SERIES}.orig vim${SERIES} >> vim-${VERSION}-branch_update-$UPDATE_NUM.patch
|
---|
| 59 |
|
---|
| 60 | echo "Done"
|
---|
| 61 | echo "Cleaning up"
|
---|
| 62 | rm -rf vim${SERIES} vim${SERIES}.orig #vim-${VERSION}.tar.bz2
|
---|
| 63 |
|
---|
| 64 | echo "Created: vim-${VERSION}-branch_update-$UPDATE_NUM.patch"
|
---|