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. bz2 ]; then
|
---|
20 | wget http://www.cpan.org/src/perl-${VERSION}.tar.bz2
|
---|
21 | fi
|
---|
22 |
|
---|
23 | # Set Patch Number
|
---|
24 | #
|
---|
25 | cd /usr/src
|
---|
26 | wget http://svn.cross-lfs.org/svn/repos/patches/perl/ --no-remove-listing
|
---|
27 | for num in $(seq 1 99); do
|
---|
28 | 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)
|
---|
29 | if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
|
---|
30 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
31 | break
|
---|
32 | fi
|
---|
33 | if [ "${PATCH_NUM}" != "${num}" ]; then
|
---|
34 | PATCH_NUM=$(expr ${num})
|
---|
35 | break
|
---|
36 | fi
|
---|
37 | done
|
---|
38 | rm -f index.html
|
---|
39 |
|
---|
40 | # Cleanup Directory
|
---|
41 | #
|
---|
42 | rm -rf perl-${VERSION} perl-${VERSION}.orig
|
---|
43 | tar xvf perl-${VERSION}.tar.bz2
|
---|
44 | mv perl-${VERSION} perl-${VERSION}.orig
|
---|
45 | CURRENTDIR=$(pwd -P)
|
---|
46 |
|
---|
47 | # Get Current Updates from GIT
|
---|
48 | #
|
---|
49 | cd /usr/src
|
---|
50 | mkdir perl.git
|
---|
51 | cd perl.git
|
---|
52 | git clone git://perl5.git.perl.org/perl.git
|
---|
53 |
|
---|
54 | # Cleanup
|
---|
55 | #
|
---|
56 | cd /usr/src/perl-${VERSION}
|
---|
57 | REMOVE=".patch AUTHORS Changes*"
|
---|
58 | for file in $REMOVE; do
|
---|
59 | cd /usr/src/perl-${VERSION}
|
---|
60 | rm -f ${file}
|
---|
61 | cd /usr/src/perl-${VERSION}.orig
|
---|
62 | rm -f ${file}
|
---|
63 | done
|
---|
64 | cd ..
|
---|
65 |
|
---|
66 | # Remove Directories
|
---|
67 | #
|
---|
68 | cd /usr/src/perl-${VERSION}
|
---|
69 | REMOVE="os2 vms win32"
|
---|
70 | for dir in $REMOVE; do
|
---|
71 | cd /usr/src/perl-${VERSION}
|
---|
72 | rm -rf ${dir}
|
---|
73 | cd /usr/src/perl-${VERSION}.orig
|
---|
74 | rm -rf ${dir}
|
---|
75 | done
|
---|
76 | cd ..
|
---|
77 |
|
---|
78 | # Create Patch
|
---|
79 | #
|
---|
80 | cd /usr/src
|
---|
81 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > perl-${VERSION}-branch_update-x.patch
|
---|
82 | echo "Date: `date +%m-%d-%Y`" >> perl-${VERSION}-branch_update-x.patch
|
---|
83 | echo "Initial Package Version: ${VERSION}" >> perl-${VERSION}-branch_update-x.patch
|
---|
84 | echo "Origin: Upstream" >> perl-${VERSION}-branch_update-x.patch
|
---|
85 | echo "Upstream Status: Applied" >> perl-${VERSION}-branch_update-x.patch
|
---|
86 | echo "Description: This is a branch update for perl-${VERSION}, and should be" >> perl-${VERSION}-branch_update-x.patch
|
---|
87 | echo " rechecked periodically." >> perl-${VERSION}-branch_update-x.patch
|
---|
88 | echo "" >> perl-${VERSION}-branch_update-x.patch
|
---|
89 | diff -Naur perl-${VERSION}.orig perl-${VERSION} >> perl-${VERSION}-branch_update-x.patch
|
---|
90 | echo "Created /usr/src/perl-${VERSION}-branch_update-x.patch."
|
---|