1 | #!/bin/sh
|
---|
2 | # Jonathan Norman
|
---|
3 |
|
---|
4 | # Vim branch update patch generator
|
---|
5 |
|
---|
6 | VERSION=$1
|
---|
7 |
|
---|
8 | # Check Input
|
---|
9 | #
|
---|
10 | if [ "${VERSION}" = "" ]; then
|
---|
11 | echo "$0 [Vim_version]"
|
---|
12 | echo "This will Create a Patch for Vim Vim_Version"
|
---|
13 | exit 255
|
---|
14 | fi
|
---|
15 |
|
---|
16 | TMP=~/tmp/vim-${VERSION}
|
---|
17 | PATCHDIR=${TMP}/patches
|
---|
18 | PATCHURL=ftp://ftp.vim.org/pub/vim/patches
|
---|
19 | SERIES=$(echo ${VERSION} | sed -e 's/\.//g')
|
---|
20 | CLFS_PATCHS=http://patches.cross-lfs.org/dev/
|
---|
21 |
|
---|
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)
|
---|
25 |
|
---|
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]
|
---|
32 |
|
---|
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
|
---|
38 |
|
---|
39 | echo -n "Generating Patch..."
|
---|
40 | cd vim${SERIES}/src
|
---|
41 |
|
---|
42 | for PATCH in $(ls $PATCHDIR); do
|
---|
43 | patch -Np0 -i $PATCHDIR/$PATCH
|
---|
44 | # echo $PATCHDIR/$PATCH
|
---|
45 | done
|
---|
46 |
|
---|
47 | cd $TMP
|
---|
48 |
|
---|
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"
|
---|