| 1 | #!/bin/bash | 
|---|
| 2 | # Create a Binutils Patch | 
|---|
| 3 |  | 
|---|
| 4 | # Get Version # | 
|---|
| 5 | # | 
|---|
| 6 | VERSION=$1 | 
|---|
| 7 |  | 
|---|
| 8 | # Check Input | 
|---|
| 9 | # | 
|---|
| 10 | if [ "${VERSION}" = "" ]; then | 
|---|
| 11 | echo "$0 - Binutils_Version" | 
|---|
| 12 | echo "This will Create a Patch for Binutils Binutils_Version" | 
|---|
| 13 | exit 255 | 
|---|
| 14 | fi | 
|---|
| 15 |  | 
|---|
| 16 | # Download Binutils Source | 
|---|
| 17 | # | 
|---|
| 18 | cd /usr/src | 
|---|
| 19 | if ! [ -e binutils-${VERSION}.tar.bz2  ]; then | 
|---|
| 20 | wget ftp://ftp.gnu.org/gnu/binutils/binutils-${VERSION}.tar.bz2 | 
|---|
| 21 | fi | 
|---|
| 22 |  | 
|---|
| 23 | # Cleanup Directory | 
|---|
| 24 | # | 
|---|
| 25 | rm -rf binutils-${VERSION} binutils-${VERSION}.orig | 
|---|
| 26 | tar xvf binutils-${VERSION}.tar.bz2 | 
|---|
| 27 | mv binutils-${VERSION} binutils-${VERSION}.orig | 
|---|
| 28 | CURRENTDIR=$(pwd -P) | 
|---|
| 29 |  | 
|---|
| 30 | # Get Current Updates from CVS | 
|---|
| 31 | # | 
|---|
| 32 | cd /usr/src | 
|---|
| 33 | FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g') | 
|---|
| 34 | cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src export -rbinutils-${FIXEDVERSION}-branch binutils | 
|---|
| 35 | mv src binutils-${VERSION} | 
|---|
| 36 |  | 
|---|
| 37 | # Cleanup | 
|---|
| 38 | # | 
|---|
| 39 | DIRS="binutils-${VERSION} binutils-${VERSION}.orig" | 
|---|
| 40 | for DIRECTORY in ${DIRS}; do | 
|---|
| 41 | cd /usr/src/${DIRECTORY} | 
|---|
| 42 | FILE_LIST=".cvsignore *.gmo" | 
|---|
| 43 | for files in ${FILE_LIST}; do | 
|---|
| 44 | REMOVE=$(find * -name ${files}) | 
|---|
| 45 | for file in $REMOVE; do | 
|---|
| 46 | rm -f ${file} | 
|---|
| 47 | done | 
|---|
| 48 | done | 
|---|
| 49 |  | 
|---|
| 50 | REMOVE=".cvsignore MAINTAINERS COPYING.LIBGLOSS COPYING.NEWLIB README-maintainer-mode depcomp | 
|---|
| 51 | ChangeLog compile ltgcc.m4 lt~obsolete.m4 etc/ChangeLog etc/add-log.el etc/add-log.vi" | 
|---|
| 52 | for file in $REMOVE; do | 
|---|
| 53 | rm -f ${file} | 
|---|
| 54 | done | 
|---|
| 55 | cd .. | 
|---|
| 56 | done | 
|---|
| 57 |  | 
|---|
| 58 | # Cleanup Directory | 
|---|
| 59 | # | 
|---|
| 60 | for dir in $(find * -type d); do | 
|---|
| 61 | cd /usr/src/binutils-${VERSION} | 
|---|
| 62 | for file in $(find . -name '*~'); do | 
|---|
| 63 | rm -f ${file} | 
|---|
| 64 | done | 
|---|
| 65 | for file in $(find . -name '*.orig'); do | 
|---|
| 66 | rm -f ${file} | 
|---|
| 67 | done | 
|---|
| 68 | done | 
|---|
| 69 | cd /usr/src/binutils-${VERSION} | 
|---|
| 70 | rm -f *~ *.orig | 
|---|
| 71 | rm -f /usr/src/binutils-${VERSION}.orig/md5.sum | 
|---|
| 72 |  | 
|---|
| 73 | # Make Binutils a Release | 
|---|
| 74 | # | 
|---|
| 75 | cd /usr/src/binutils-${VERSION} | 
|---|
| 76 | sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.am | 
|---|
| 77 | sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.in | 
|---|
| 78 |  | 
|---|
| 79 | # Create Patch | 
|---|
| 80 | # | 
|---|
| 81 | cd /usr/src | 
|---|
| 82 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > binutils-${VERSION}-branch_update-x.patch | 
|---|
| 83 | echo "Date: `date +%m-%d-%Y`" >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 84 | echo "Initial Package Version: ${VERSION}" >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 85 | echo "Origin: Upstream" >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 86 | echo "Upstream Status: Applied" >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 87 | echo "Description: This is a branch update for binutils-${VERSION}, and should be" >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 88 | echo "             rechecked periodically." >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 89 | echo "" >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 90 | diff -Naur binutils-${VERSION}.orig binutils-${VERSION} >> binutils-${VERSION}-branch_update-x.patch | 
|---|
| 91 | echo "Created /usr/src/binutils-${VERSION}-branch_update-x.patch." | 
|---|