source: scripts/patch/vim-patch.sh@ 702b89c

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 702b89c was 2803d79, checked in by Jim Gifford <clfs@…>, 16 years ago

Fixes to Patch Creaters

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