| 1 | #!/bin/bash | 
|---|
| 2 | # Create a Perl Patch | 
|---|
| 3 |  | 
|---|
| 4 | # Get Version # | 
|---|
| 5 | # | 
|---|
| 6 | VERSION=$1 | 
|---|
| 7 |  | 
|---|
| 8 | # Check Input | 
|---|
| 9 | # | 
|---|
| 10 | if [ "${VERSION}" = "" ]; then | 
|---|
| 11 | echo "$0 - Perl_Version" | 
|---|
| 12 | echo "This will Create a Patch for Perl Perl_Version" | 
|---|
| 13 | exit 255 | 
|---|
| 14 | fi | 
|---|
| 15 |  | 
|---|
| 16 | # Download Perl Source | 
|---|
| 17 | # | 
|---|
| 18 | cd /usr/src | 
|---|
| 19 | if ! [ -e perl-${VERSION}.tar.gz  ]; then | 
|---|
| 20 | wget http://www.cpan.org/src/perl-${VERSION}.tar.gz | 
|---|
| 21 | fi | 
|---|
| 22 |  | 
|---|
| 23 | # Set Patch Number | 
|---|
| 24 | # | 
|---|
| 25 | cd /usr/src | 
|---|
| 26 | wget http://patches.cross-lfs.org/dev/ --no-remove-listing | 
|---|
| 27 | PATCH_NUM=$(cat index.html | grep perl | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1) | 
|---|
| 28 | PATCH_NUM=$(expr ${PATCH_NUM} + 1) | 
|---|
| 29 | rm -f index.html | 
|---|
| 30 |  | 
|---|
| 31 | # Cleanup Directory | 
|---|
| 32 | # | 
|---|
| 33 | rm -rf perl-${VERSION} perl-${VERSION}.orig | 
|---|
| 34 | tar xvf perl-${VERSION}.tar.gz | 
|---|
| 35 | mv perl-${VERSION} perl-${VERSION}.orig | 
|---|
| 36 | CURRENTDIR=$(pwd -P) | 
|---|
| 37 |  | 
|---|
| 38 | # Get Current Updates from GIT | 
|---|
| 39 | # | 
|---|
| 40 | cd /usr/src | 
|---|
| 41 | mkdir perl.git | 
|---|
| 42 | cd perl.git | 
|---|
| 43 | git clone git://perl5.git.perl.org/perl.git | 
|---|
| 44 |  | 
|---|
| 45 | # Cleanup | 
|---|
| 46 | # | 
|---|
| 47 | cd /usr/src/perl-${VERSION} | 
|---|
| 48 | REMOVE=".patch AUTHORS Changes*" | 
|---|
| 49 | for file in $REMOVE; do | 
|---|
| 50 | cd /usr/src/perl-${VERSION} | 
|---|
| 51 | rm -f ${file} | 
|---|
| 52 | cd /usr/src/perl-${VERSION}.orig | 
|---|
| 53 | rm -f ${file} | 
|---|
| 54 | done | 
|---|
| 55 | cd .. | 
|---|
| 56 |  | 
|---|
| 57 | # Remove Directories | 
|---|
| 58 | # | 
|---|
| 59 | cd /usr/src/perl-${VERSION} | 
|---|
| 60 | REMOVE="os2 vms win32" | 
|---|
| 61 | for dir in $REMOVE; do | 
|---|
| 62 | cd /usr/src/perl-${VERSION} | 
|---|
| 63 | rm -rf ${dir} | 
|---|
| 64 | cd /usr/src/perl-${VERSION}.orig | 
|---|
| 65 | rm -rf ${dir} | 
|---|
| 66 | done | 
|---|
| 67 | cd .. | 
|---|
| 68 |  | 
|---|
| 69 | # Create Patch | 
|---|
| 70 | # | 
|---|
| 71 | cd /usr/src | 
|---|
| 72 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > perl-${VERSION}-branch_update-x.patch | 
|---|
| 73 | echo "Date: `date +%m-%d-%Y`" >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 74 | echo "Initial Package Version: ${VERSION}" >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 75 | echo "Origin: Upstream" >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 76 | echo "Upstream Status: Applied" >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 77 | echo "Description: This is a branch update for perl-${VERSION}, and should be" >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 78 | echo "             rechecked periodically." >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 79 | echo "" >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 80 | diff -Naur perl-${VERSION}.orig perl-${VERSION} >> perl-${VERSION}-branch_update-x.patch | 
|---|
| 81 | echo "Created /usr/src/perl-${VERSION}-branch_update-x.patch." | 
|---|