Changeset 73ace20 for scripts/patch/vim-patch.sh
- Timestamp:
- Oct 10, 2012, 6:42:21 PM (12 years ago)
- Branches:
- clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- f7b2c72
- Parents:
- 0cce40d (diff), 80cbd64 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/patch/vim-patch.sh
-
Property mode
changed from
100755
to100644
r0cce40d r73ace20 1 #!/bin/ bash2 # Create a VIM Patch1 #!/bin/sh 2 # Jonathan Norman 3 3 4 # Get Version #5 # 4 # Vim branch update patch generator 5 6 6 VERSION=$1 7 7 … … 9 9 # 10 10 if [ "${VERSION}" = "" ]; then 11 echo "$0 - Vim_Version"11 echo "$0 [Vim_version]" 12 12 echo "This will Create a Patch for Vim Vim_Version" 13 13 exit 255 14 14 fi 15 15 16 # Get the # of Patches 17 # 18 cd ~/tmp 19 wget ftp://ftp.vim.org/pub/vim/patches/${VERSION}/ --no-remove-listing 20 FILES=$(cat index.html | grep "${VERSION}" | cut -f6 -d. | cut -f1 -d'"' | sed '/^$/d' | tail -n 1) 21 rm -f .listing 22 rm -f index.html 16 TMP=~/tmp/vim-${VERSION} 17 PATCHDIR=${TMP}/patches 18 PATCHURL=ftp://ftp.vim.org/pub/vim/patches 23 19 SERIES=$(echo ${VERSION} | sed -e 's/\.//g') 24 SKIPPATCH="" 25 SKIPPED="" 20 CLFS_PATCHS=http://patches.cross-lfs.org/dev/ 26 21 27 # Download VIM Source 28 # 29 if ! [ -e vim-${VERSION}.tar.bz2 ]; then 30 wget ftp://ftp.vim.org/pub/vim/unix/vim-${VERSION}.tar.bz2 31 fi 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) 32 25 33 # Set Patch Number 34 # 35 cd ~/tmp 36 wget http://svn.cross-lfs.org/svn/repos/patches/vim/ --no-remove-listing 37 for num in $(seq 1 99); do 38 PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num}.patch | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1) 39 if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then 40 PATCH_NUM=$(expr ${PATCH_NUM} + 1) 41 break 42 fi 43 if [ "${PATCH_NUM}" != "${num}" ]; then 44 PATCH_NUM=$(expr ${num}) 45 break 46 fi 47 done 48 rm -f index.html 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] 49 32 50 # Cleanup Directory 51 # 52 rm -rf vim${SERIES} vim${SERIES}.orig 53 tar xvf vim-${VERSION}.tar.bz254 cp - arvim${SERIES} vim${SERIES}.orig33 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 55 38 56 # Download and Apply Patches 57 # 58 install -d ~/tmp/vim-${VERSION}-patches 59 cd ~/tmp/vim${SERIES} 60 CURRENTDIR=$(pwd -P) 61 PATCHURL=ftp://ftp.vim.org/pub/vim/patches/${VERSION} 62 COUNT=1 63 while [ ${COUNT} -le ${FILES} ]; do 64 cd ~/tmp/vim${SERIES} 65 DLCOUNT="${COUNT}" 66 SKIPME=no 67 if [ "${COUNT}" -lt "100" ]; then 68 DLCOUNT="0${COUNT}" 69 fi 70 if [ "${COUNT}" -lt "10" ]; then 71 DLCOUNT="00${COUNT}" 72 fi 73 for skip in ${SKIPPATCH} ; do 74 if [ "${DLCOUNT}" = "${skip}" ]; then 75 echo "Patch ${VERSION}.${DLCOUNT} skipped" 76 SKIPPED="${SKIPPED} ${DLCOUNT}" 77 SKIPME=yes 78 fi 79 done 80 if [ "${SKIPME}" != "yes" ]; then 81 if ! [ -e ${VERSION}.${DLCOUNT} ]; then 82 cd ~/tmp/vim-${VERSION}-patches 83 wget --quiet $PATCHURL/${VERSION}.${DLCOUNT} 84 fi 85 cd $CURRENTDIR 86 patch --dry-run -s -f -Np0 -i ~/tmp/vim-${VERSION}-patches/${VERSION}.${DLCOUNT} 87 if [ "$?" = "0" ]; then 88 echo "Patch ${VERSION}.${DLCOUNT} applied" 89 patch -s -Np0 -i ~/tmp/vim-${VERSION}-patches/${VERSION}.${DLCOUNT} 90 else 91 echo "Patch ${VERSION}.${DLCOUNT} not applied" 92 SKIPPED="${SKIPPED} ${DLCOUNT}" 93 fi 94 fi 95 COUNT=$(expr ${COUNT} + 1) 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 96 45 done 97 46 98 # Cleanup Directory 99 # 100 for dir in $(find * -type d); do 101 cd ~/tmp/vim${SERIES} 102 for file in $(find . -name '*~'); do 103 rm -f ${file} 104 done 105 for file in $(find . -name '*.orig'); do 106 rm -f ${file} 107 done 108 done 109 cd ~/tmp/vim${SERIES} 110 rm -f *~ *.orig 47 cd $TMP 111 48 112 # Create Patch 113 # 114 cd ~/tmp 115 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 116 echo "Date: `date +%m-%d-%Y`" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 117 echo "Initial Package Version: ${VERSION}" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 118 echo "Origin: Upstream" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 119 echo "Upstream Status: Applied" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 120 echo "Description: Contains all upstream patches up to ${VERSION}.${FILES}" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 121 if [ -n "${SKIPPED}" ]; then 122 echo " The following patches were skipped" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 123 echo " ${SKIPPED}" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 124 fi 125 echo "" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 126 diff -Naur vim${SERIES}.orig vim${SERIES} >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch 127 echo "Created ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch." 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 128 57 129 # Cleanup Directory 130 # 131 rm -rf vim${SERIES} vim${SERIES}.orig 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" -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.