[Clfs-commits] commit: r5054 - in /trunk/scripts/patch: binutils-patch.sh gcc-patch.sh

svn at cross-lfs.org svn at cross-lfs.org
Mon Jun 15 15:03:52 PDT 2009


Author: jim
Date: Mon Jun 15 22:03:52 2009
New Revision: 5054

Log:
Update Patch Scripts

Modified:
    trunk/scripts/patch/binutils-patch.sh
    trunk/scripts/patch/gcc-patch.sh

Modified: trunk/scripts/patch/binutils-patch.sh
==============================================================================
--- trunk/scripts/patch/binutils-patch.sh (original)
+++ trunk/scripts/patch/binutils-patch.sh Mon Jun 15 22:03:52 2009
@@ -80,11 +80,7 @@
 DATE_STAMP=$(date +%Y%m%d)
 cd /usr/src/binutils-${SOURCEVERSION}
 sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS) :" bfd/Makefile.in
-sed -i "s:^[[:space:]]VERSION=\(.*\)$:VERSION=\1.${DATE_STAMP}:g" bfd/configure
-
-# Cleanliness is the name of my game!
-#
-unset DATE_STAMP
+sed -i "s:^[[:space:]]VERSION=\(.*\)$: VERSION=\1.${DATE_STAMP}:g" bfd/configure
 
 # Create Patch
 #
@@ -97,5 +93,11 @@
 echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
 echo "             rechecked periodically." >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
 echo "" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
+echo "This patch was created on ${DATE_STAMP}" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
+echo "" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
 diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
 echo "Created /usr/src/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch."
+
+# Cleanliness is the name of my game!
+#
+unset DATE_STAMP

Modified: trunk/scripts/patch/gcc-patch.sh
==============================================================================
--- trunk/scripts/patch/gcc-patch.sh (original)
+++ trunk/scripts/patch/gcc-patch.sh Mon Jun 15 22:03:52 2009
@@ -13,6 +13,10 @@
   exit 255
 fi
 
+# Set Patch Directory
+#
+PATCH_DIR=$(pwd -P)/gcc
+
 # Download GCC Source
 #
 cd /usr/src
@@ -23,25 +27,28 @@
 # Set Patch Number
 #
 cd /usr/src
-wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
+wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing > /dev/null 2>&1
 PATCH_NUM=$(cat index.html | grep gcc | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
 PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+PATCH_NUM2=$(cat index.html | grep gcc | grep "${VERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+PATCH_NUM2=$(expr ${PATCH_NUM2} + 1)
 rm -f index.html
 
 # Cleanup Directory
 #
-#rm -rf gcc-${VERSION} gcc-${VERSION}.orig
-#tar xvf gcc-${VERSION}.tar.bz2
-#mv gcc-${VERSION} gcc-${VERSION}.orig
+rm -rf gcc-${VERSION} gcc-${VERSION}.orig
+tar xvf gcc-${VERSION}.tar.bz2
+mv gcc-${VERSION} gcc-${VERSION}.orig
 CURRENTDIR=$(pwd -P)
 
 # Get Current Updates from SVN
 #
-#cd /usr/src
-#NUM1=$(echo ${VERSION} | cut -f1 -d.)
-#NUM2=$(echo ${VERSION} | cut -f2 -d.)
-#FIXEDVERSION=$(echo -n "$NUM1" ; echo -n "_" ; echo -e "$NUM2")
-#svn export svn://gcc.gnu.org/svn/gcc/branches/gcc-${FIXEDVERSION}-branch gcc-${VERSION}
+cd /usr/src
+NUM1=$(echo ${VERSION} | cut -f1 -d.)
+NUM2=$(echo ${VERSION} | cut -f2 -d.)
+FIXEDVERSION=$(echo -n "$NUM1" ; echo -n "_" ; echo -e "$NUM2")
+REVISION=$(svn info svn://gcc.gnu.org/svn/gcc/branches/gcc-${FIXEDVERSION}-branch | grep "Last Changed Rev" | cut -f2 -d: | sed -e 's/ //g')
+svn export svn://gcc.gnu.org/svn/gcc/branches/gcc-${FIXEDVERSION}-branch gcc-${VERSION}
 
 # Add a custom version string
 #
@@ -50,6 +57,7 @@
 sed -i "s:PKGVERSION:\"(GCC for Cross-LFS ${VERSION}.${DATE_STAMP}) \":" gcc-${VERSION}/gcc/version.c
 
 # Cleanup
+#
 DIRS="gcc-${VERSION} gcc-${VERSION}.orig"
 for DIRECTORY in ${DIRS}; do
   cd ${DIRECTORY}
@@ -84,5 +92,70 @@
 echo "Description: This is a branch update for gcc-${VERSION}, and should be" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
 echo "             rechecked periodically." >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
 echo "" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
+echo "This patch was made from Revision # ${REVISION}." >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
+echo "" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
 diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
 echo "Created /usr/src/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch."
+
+# Create Another Copy to create fixes patch
+#
+cd /usr/src
+rm -rf gcc-${VERSION}.orig
+cp -ar gcc-${VERSION} gcc-${VERSION}.orig
+
+# Apply Patches from directories
+#
+cd /usr/src/gcc-${VERSION}
+if [ -e ${PATCH_DIR}/${VERSION} ]; then
+  PATCH_FILES=$(ls ${PATCH_DIR}/${VERSION}/*.patch)
+  if [ "${PATCH_FILES}" != "" ]; then
+    for pfile in ${PATCH_FILES}; do
+      echo "Applying - ${pfile}..."
+      for pvalue in $(seq 0 5); do
+        patch --dry-run -Np${pvalue} -i ${pfile} > /dev/null 2>&1
+        if [ "${?}" = "0" ]; then
+          PVALUE=${pvalue}
+          break
+        fi
+      done
+      if [ "${PVALUE}" != "" ]; then
+        patch -Np${PVALUE} -i ${pfile}
+      else
+        echo "Patch: ${pfile} Failed to Apply..."
+        exit 255
+      fi
+    done
+  fi
+fi
+
+# Cleanup Directory
+#
+
+for dir in $(find * -type d); do
+  cd /usr/src/gcc-${VERSION}/${dir}
+  for file in $(find . -name '*~'); do
+    rm -f ${file}
+  done
+  for file in $(find . -name '*.orig'); do
+    rm -f ${file}
+  done
+  for file in $(find . -name '*.rej'); do
+    rm -f ${file}
+  done
+done
+cd /usr/src/gcc-${VERSION}/
+rm -rf *.orig *~ *.rej
+
+# Create Patch
+#
+cd /usr/src
+echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "Origin: Upstream" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "Upstream Status: Applied" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "Description: This Patch contains fixes for gcc-${VERSION}, and should be" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "             rechecked periodically." >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
+echo "Created /usr/src/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch."




More information about the Clfs-commits mailing list