Changeset 20a0aa0


Ignore:
Timestamp:
Feb 16, 2012, 10:24:54 AM (12 years ago)
Author:
Jonathan Norman <jon@…>
Branches:
clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
c1dbf1b
Parents:
57b3f19
git-author:
Jonathan Norman <jon@…> (02/16/12 10:20:20)
git-committer:
Jonathan Norman <jon@…> (02/16/12 10:24:54)
Message:

Updated Ncurses branch update script generator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/patch/ncurses-patch.sh

    • Property mode changed from 100755 to 100644
    r57b3f19 r20a0aa0  
    1 #!/bin/bash
    2 # Create a Ncuruses Patch
     1#!/bin/sh
     2# Jonathan Norman
    33
    4 # Get Version #
    5 #
     4# Ncurses branch update patch generator
     5
    66VERSION=$1
    77
     
    99#
    1010if [ "${VERSION}" = "" ]; then
    11   echo "$0 - Ncurses_Version"
    12   echo "This will Create a Patch for Ncurses Ncurses_Version"
     11  echo "$0 [ncurses_version]"
     12  echo "This will Create a Patch for ncurses ncurses_Version"
    1313  exit 255
    1414fi
    1515
    16 # Get Patch Names
    17 #
    18 cd ~/tmp
    19 wget ftp://invisible-island.net/ncurses/${VERSION}/ --no-remove-listing
    20 ROLLUP=$(cat index.html | grep bz2 | cut -f2 -d'>' | cut -f1 -d'<' | tail -n 1)
    21 ROLLPATCH=$(echo ${ROLLUP} | cut -f3 -d-)
    22 FILES=$(cat index.html | grep ${VERSION}-2 | grep patch.gz | cut -f2 -d'>' | cut -f1 -d'<')
    23 rm -f .listing
    24 rm -f index.html
     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/
    2521
    26 # Download Ncurses Source
    27 #
    28 cd ~/tmp
    29 if ! [ -e ncurses-${VERSION}.tar.gz ]; then
    30   wget ftp://invisible-island.net/ncurses/ncurses-${VERSION}.tar.gz
    31 fi
     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)
    3226
    33 # Set Patch Number
    34 #
    35 cd ~/tmp
    36 wget http://svn.cross-lfs.org/svn/repos/patches/ncurses/ --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
    49 
    50 # Cleanup Directory
    51 #
    52 cd ~/tmp
    53 rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
    54 tar xvf ncurses-${VERSION}.tar.gz
    55 cp -ar ncurses-${VERSION} ncurses-${VERSION}.orig
    56 
    57 # Download and Apply Rollup Patch
    58 #
    59 cd ~/tmp/ncurses-${VERSION}
    60 CURRENTDIR=$(pwd -P)
    61 mkdir ~/tmp/ncurses-${VERSION}-patches
    62 cd ~/tmp/ncurses-${VERSION}
    63 if [ "${ROLLUP}" != "" ]; then
    64   echo "Getting Rollup ${ROLLUP} Patch..."
    65   cd ~/tmp/ncurses-${VERSION}-patches
    66   wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${ROLLUP}
    67   cd ${CURRENTDIR}
    68   echo "Applying Rollup ${ROLLUP} Patch..."
    69   cp ~/tmp/ncurses-${VERSION}-patches/${ROLLUP} ${CURRENTDIR}/${ROLLUP}
    70   bunzip2 ${ROLLUP}
    71   ROLLUP2=$(echo ${ROLLUP} | sed -e 's/.bz2//g')
    72   sh ${ROLLUP2}
    73 fi
    74 
    75 # Download and Apply Patches
    76 #
    77 install -d ~/tmp/ncurses-${VERSION}-patches
    78 cd ~/tmp/ncurses-${VERSION}
    79 CURRENTDIR=$(pwd -P)
    80 for file in ${FILES}; do
    81   if [ "${ROLLPATCH}" != "" ]; then
    82     TEST=$(echo ${file} | grep -c ${ROLLPATCH})
    83   else
    84     TEST=0
    85   fi
    86   if [ "${TEST}" = "0" ]; then
    87     cd ~/tmp/ncurses-${VERSION}-patches
    88     echo "Getting Patch ${file}..."
    89     wget --quiet ftp://invisible-island.net/ncurses/${VERSION}/${file}
    90     cd ${CURRENTDIR}
    91     gunzip -c ~/tmp/ncurses-${VERSION}-patches/${file} | patch --dry-run -s -f -Np1
    92     if [ "$?" = "0" ]; then
    93       echo "Apply Patch ${file}..."
    94       gunzip -c ~/tmp/ncurses-${VERSION}-patches/${file} | patch -Np1
    95       LASTFILE=$(echo ${file} | cut -f2 -d. | cut -f2 -d-)
    96     fi
    97   fi
     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
    9834done
    9935
    100 # Cleanup Directory
    101 #
    102 cd ~/tmp
     36
     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
     42
     43echo -n "Generating Patch..."
    10344cd ncurses-${VERSION}
    104 for dir in $(find * -type d); do
    105   cd ~/tmp/ncurses-${VERSION}/${dir}
    106   for file in $(find . -name '*~'); do
    107     rm -f ${file}
    108   done
    109   for file in $(find . -name '*.orig'); do
    110     rm -f ${file}
    111   done
     45
     46gunzip -c $PATCHDIR/*.sh.gz | sh
     47for PATCH in $(ls $PATCHDIR | grep patch.gz); do
     48        gunzip -c $PATCHDIR/$PATCH | patch -Np1
    11249done
    113 cd ~/tmp/ncurses-${VERSION}
    114 rm -f *~ *.orig
    11550
    116 # Create Patch
    117 #
    118 cd ~/tmp
    119 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    120 echo "Date: `date +%m-%d-%Y`" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    121 echo "Initial Package Version: ${VERSION}" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    122 echo "Origin: Upstream" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    123 echo "Upstream Status: Applied" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    124 echo "Description: This is a branch update for NCurses-${VERSION}, and should be" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    125 echo "             rechecked periodically. This patch covers up to ${VERSION}-${LASTFILE}." >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    126 echo "" >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    127 diff -Naur ncurses-${VERSION}.orig ncurses-${VERSION} >> ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch
    128 echo "Created ~/patches/ncurses-${VERSION}-branch_update-${PATCH_NUM}.patch."
     51cd $TMP
    12952
    130 # Cleanup Directory
    131 #
    132 cd ~/tmp
    133 rm -rf ncurses-${VERSION} ncurses-${VERSION}.orig
     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 TracChangeset for help on using the changeset viewer.