source: scripts/patch/vim-patch.sh@ 443914b

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 443914b was 639e34d, checked in by Jim Gifford <clfs@…>, 15 years ago

Changed Patches URL's

  • Property mode set to 100755
File size: 3.6 KB
Line 
1#!/bin/bash
2# Create a VIM Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
11 echo "$0 - Vim_Version"
12 echo "This will Create a Patch for Vim Vim_Version"
13 exit 255
14fi
15
16# Get the # of Patches
17#
18cd ~/tmp
19wget ftp://ftp.vim.org/pub/vim/patches/${VERSION}/ --no-remove-listing
20FILES=$(cat index.html | grep "${VERSION}" | cut -f6 -d. | cut -f1 -d'"' | sed '/^$/d' | tail -n 1)
21rm -f .listing
22rm -f index.html
23SERIES=$(echo ${VERSION} | sed -e 's/\.//g')
24SKIPPATCH=""
25SKIPPED=""
26
27# Download VIM Source
28#
29if ! [ -e vim-${VERSION}.tar.bz2 ]; then
30 wget ftp://ftp.vim.org/pub/vim/unix/vim-${VERSION}.tar.bz2
31fi
32
33# Set Patch Number
34#
35cd ~/tmp
36wget http://patches.cross-lfs.org/dev/ --no-remove-listing
37PATCH_NUM=$(cat index.html | grep vim | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
38PATCH_NUM=$(expr ${PATCH_NUM} + 1)
39rm -f index.html
40
41# Cleanup Directory
42#
43rm -rf vim${SERIES} vim${SERIES}.orig
44tar xvf vim-${VERSION}.tar.bz2
45cp -ar vim${SERIES} vim${SERIES}.orig
46
47# Download and Apply Patches
48#
49install -d ~/tmp/vim-${VERSION}-patches
50cd ~/tmp/vim${SERIES}
51CURRENTDIR=$(pwd -P)
52PATCHURL=ftp://ftp.vim.org/pub/vim/patches/${VERSION}
53COUNT=1
54while [ ${COUNT} -le ${FILES} ]; do
55 cd ~/tmp/vim${SERIES}
56 DLCOUNT="${COUNT}"
57 SKIPME=no
58 if [ "${COUNT}" -lt "100" ]; then
59 DLCOUNT="0${COUNT}"
60 fi
61 if [ "${COUNT}" -lt "10" ]; then
62 DLCOUNT="00${COUNT}"
63 fi
64 for skip in ${SKIPPATCH} ; do
65 if [ "${DLCOUNT}" = "${skip}" ]; then
66 echo "Patch ${VERSION}.${DLCOUNT} skipped"
67 SKIPPED="${SKIPPED} ${DLCOUNT}"
68 SKIPME=yes
69 fi
70 done
71 if [ "${SKIPME}" != "yes" ]; then
72 if ! [ -e ${VERSION}.${DLCOUNT} ]; then
73 cd ~/tmp/vim-${VERSION}-patches
74 wget --quiet $PATCHURL/${VERSION}.${DLCOUNT}
75 fi
76 cd $CURRENTDIR
77 patch --dry-run -s -f -Np0 -i ~/tmp/vim-${VERSION}-patches/${VERSION}.${DLCOUNT}
78 if [ "$?" = "0" ]; then
79 echo "Patch ${VERSION}.${DLCOUNT} applied"
80 patch -s -Np0 -i ~/tmp/vim-${VERSION}-patches/${VERSION}.${DLCOUNT}
81 else
82 echo "Patch ${VERSION}.${DLCOUNT} not applied"
83 SKIPPED="${SKIPPED} ${DLCOUNT}"
84 fi
85 fi
86 COUNT=$(expr ${COUNT} + 1)
87done
88
89# Cleanup Directory
90#
91for dir in $(find * -type d); do
92 cd ~/tmp/vim${SERIES}
93 for file in $(find . -name '*~'); do
94 rm -f ${file}
95 done
96 for file in $(find . -name '*.orig'); do
97 rm -f ${file}
98 done
99done
100cd ~/tmp/vim${SERIES}
101rm -f *~ *.orig
102
103# Create Patch
104#
105cd ~/tmp
106echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
107echo "Date: `date +%m-%d-%Y`" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
108echo "Initial Package Version: ${VERSION}" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
109echo "Origin: Upstream" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
110echo "Upstream Status: Applied" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
111echo "Description: Contains all upstream patches up to ${VERSION}.${FILES}" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
112if [ -n "${SKIPPED}" ]; then
113 echo " The following patches were skipped" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
114 echo " ${SKIPPED}" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
115fi
116echo "" >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
117diff -Naur vim${SERIES}.orig vim${SERIES} >> ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch
118echo "Created ~/patches/vim-${VERSION}-branch_update-${PATCH_NUM}.patch."
119
120# Cleanup Directory
121#
122rm -rf vim${SERIES} vim${SERIES}.orig
Note: See TracBrowser for help on using the repository browser.