source: scripts/patch/ncurses-patch.sh@ 16ed0af

sysvinit
Last change on this file since 16ed0af was 20a0aa0, checked in by Jonathan Norman <jon@…>, 13 years ago

Updated Ncurses branch update script generator

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[20a0aa0]1#!/bin/sh
2# Jonathan Norman
3
4# Ncurses branch update patch generator
[06dcdf6]5
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
[20a0aa0]11 echo "$0 [ncurses_version]"
12 echo "This will Create a Patch for ncurses ncurses_Version"
[9676bac]13 exit 255
[06dcdf6]14fi
15
[20a0aa0]16TMP=~/tmp/ncurses-${VERSION}
17PATCHDIR=${TMP}/patches
18PATCHURL=ftp://invisible-island.net/ncurses/
19SERIES=$(echo ${VERSION} | sed -e 's/\.//g')
20CLFS_PATCHS=http://patches.cross-lfs.org/dev/
[06dcdf6]21
[20a0aa0]22# Figure out patch number
23UPDATE_NUM=0
24UPDATE_NUM=$(curl -ls http://patches.cross-lfs.org/dev/ | grep ncurses-${VERSION}-branch_update | cut -d . -f 3 | cut -d - -f 3-)
25UPDATE_NUM=$(expr ${UPDATE_NUM} + 1)
[c7ef534]26
[20a0aa0]27# Download patches
28echo "Downloading patches for Ncurses ${VERSION}"
29FILES=$(curl -sl ftp://invisible-island.net/ncurses/${VERSION}/ | grep patch | grep -v bz2 | grep -v asc)
30mkdir -p $PATCHDIR
31cd $PATCHDIR
32for FILE in $FILES; do
33 curl -O -# $PATCHURL/$VERSION/$FILE
34done
[06dcdf6]35
36
[20a0aa0]37echo "Downloading source for Ncurses $VERSION"
38cd $TMP
39curl -sO ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
40tar -xvf ncurses-${VERSION}.tar.gz
41cp -R ncurses-${VERSION} ncurses-${VERSION}.orig
[06dcdf6]42
[20a0aa0]43echo -n "Generating Patch..."
[d8a9d8b]44cd ncurses-${VERSION}
[20a0aa0]45
46gunzip -c $PATCHDIR/*.sh.gz | sh
47for PATCH in $(ls $PATCHDIR | grep patch.gz); do
48 gunzip -c $PATCHDIR/$PATCH | patch -Np1
[06dcdf6]49done
50
[20a0aa0]51cd $TMP
52
53DATE=$(ls $PATCHDIR | tail -n1 | cut -d- -f3 | cut -d. -f1);
54
55# Create patch
56echo "Submitted By: Jonathan Norman (jonathan at bluesquarelinux dot co dot uk)" > ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
57echo "Date: `date +%Y-%m-%d`" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
58echo "Initial Package Version: ${VERSION}" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
59echo "Origin: Upstream" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
60echo "Upstream Status: Applied" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
61echo "Description: Contains all upstream patches up to ${VERSION}-${DATE}" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
62echo "" >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
63
64LC_ALL=C TZ=UTC0 diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch
65
66echo "Done"
67echo "Cleaning up"
68rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig #ncurses-${VERSION}.tar.bz2
69
70echo "Created: $PWD/ncurses-${VERSION}-branch_update-$UPDATE_NUM.patch"
Note: See TracBrowser for help on using the repository browser.