source: scripts/patch/vim-patch.sh@ 5c7a2eb

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5c7a2eb was 9676bac, checked in by Jim Gifford <clfs@…>, 16 years ago

Added Perl Patch and cleaned up

  • Property mode set to 100755
File size: 3.1 KB
RevLine 
[06dcdf6]1#!/bin/bash
2# Create a VIM Patch
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
[9676bac]11 echo "$0 - Vim_Version"
12 echo "This will Create a Patch for Vim Vim_Version"
13 exit 255
[06dcdf6]14fi
15
16# Get the # of Patches
17#
18cd /usr/src
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
[9676bac]30 wget ftp://ftp.vim.org/pub/vim/unix/vim-${VERSION}.tar.bz2
[06dcdf6]31fi
32
33# Cleanup Directory
34#
35rm -rf vim${SERIES} vim${SERIES}.orig
36tar xvf vim-${VERSION}.tar.bz2
37cp -ar vim${SERIES} vim${SERIES}.orig
38cd vim${SERIES}
39CURRENTDIR=$(pwd -P)
40
41# Download and Apply Patches
42#
43PATCHURL=ftp://ftp.vim.org/pub/vim/patches/${VERSION}
44mkdir /tmp/vim-${VERSION}
45COUNT=1
46while [ ${COUNT} -le ${FILES} ]; do
[9676bac]47 cd /tmp/vim-${VERSION}
48 DLCOUNT="${COUNT}"
49 SKIPME=no
50 if [ "${COUNT}" -lt "100" ]; then
51 DLCOUNT="0${COUNT}"
52 fi
53 if [ "${COUNT}" -lt "10" ]; then
54 DLCOUNT="00${COUNT}"
55 fi
56 for skip in ${SKIPPATCH} ; do
57 if [ "${DLCOUNT}" = "${skip}" ]; then
58 echo "Patch ${VERSION}.${DLCOUNT} skipped"
59 SKIPPED="${SKIPPED} ${DLCOUNT}"
60 SKIPME=yes
61 fi
62 done
63 if [ "${SKIPME}" != "yes" ]; then
64 if ! [ -e ${VERSION}.${DLCOUNT} ]; then
65 wget --quiet $PATCHURL/${VERSION}.${DLCOUNT}
66 fi
67 cd $CURRENTDIR
68 patch --dry-run -s -f -Np0 -i /tmp/vim-${VERSION}/${VERSION}.${DLCOUNT}
69 if [ "$?" = "0" ]; then
70 echo "Patch ${VERSION}.${DLCOUNT} applied"
71 patch -s -Np0 -i /tmp/vim-${VERSION}/${VERSION}.${DLCOUNT}
72 else
73 echo "Patch ${VERSION}.${DLCOUNT} not applied"
74 rm -f /tmp/vim-${VERSION}/${VERSION}.${DLCOUNT}
75 SKIPPED="${SKIPPED} ${DLCOUNT}"
76 fi
77 fi
78 COUNT=`expr ${COUNT} + 1`
[06dcdf6]79done
80
[c0d5090]81# Cleanup Directory
82#
83for dir in $(find * -type d); do
[9676bac]84 cd /usr/src/vim${SERIES}
85 for file in $(find . -name '*~'); do
86 rm -f ${file}
87 done
88 for file in $(find . -name '*.orig'); do
89 rm -f ${file}
90 done
[06dcdf6]91done
[e91eb56]92cd /usr/src/vim${SERIES}
[2803d79]93rm -f *~ *.orig
[06dcdf6]94
95# Create Patch
96#
97cd /usr/src
[c94176e]98echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > vim-${VERSION}-branch_update-x.patch
[06dcdf6]99echo "Date: `date +%m-%d-%Y`" >> vim-${VERSION}-branch_update-x.patch
100echo "Initial Package Version: ${VERSION}" >> vim-${VERSION}-branch_update-x.patch
101echo "Origin: Upstream" >> vim-${VERSION}-branch_update-x.patch
102echo "Upstream Status: Applied" >> vim-${VERSION}-branch_update-x.patch
103echo "Description: Contains all upstream patches up to ${VERSION}.${FILES}" >> vim-${VERSION}-branch_update-x.patch
104if [ -n "${SKIPPED}" ]; then
[9676bac]105 echo " The following patches were skipped" >> vim-${VERSION}-branch_update-x.patch
106 echo " ${SKIPPED}" >> vim-${VERSION}-branch_update-x.patch
[06dcdf6]107fi
108echo "" >> vim-${VERSION}-branch_update-x.patch
109diff -Naur vim${SERIES}.orig vim${SERIES} >> vim-${VERSION}-branch_update-x.patch
110echo "Created /usr/src/vim-${VERSION}-branch_update-x.patch."
Note: See TracBrowser for help on using the repository browser.