Index: scripts/fetch/binutils.sh
===================================================================
--- scripts/fetch/binutils.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/fetch/binutils.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -33,7 +33,16 @@
 #
 cd ~/tmp
-wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep binutils | grep "${VERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
-PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+wget http://svn.cross-lfs.org/svn/repos/patches/binutils/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep fixes-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/fetch/eglibc.sh
===================================================================
--- scripts/fetch/eglibc.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/fetch/eglibc.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -36,7 +36,16 @@
 #
 cd ~/tmp
-wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep eglibc | grep "${SOURCEVERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
-PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+wget http://svn.cross-lfs.org/svn/repos/patches/eglibc/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep fixes-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/bash-patch.sh
===================================================================
--- scripts/patch/bash-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/bash-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -35,7 +35,16 @@
 #
 cd ~/tmp
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep bash | 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)
+wget http://svn.cross-lfs.org/svn/repos/patches/bash/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/binutils-patch.sh
===================================================================
--- scripts/patch/binutils-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/binutils-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -31,9 +31,27 @@
 #
 cd ~/tmp
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep binutils | grep "${SOURCEVERSION}" | 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 binutils | grep "${SOURCEVERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
-PATCH_NUM2=$(expr ${PATCH_NUM2} + 1)
+wget http://svn.cross-lfs.org/svn/repos/patches/binutils/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
+for num in $(seq 1 99); do
+  PATCH_NUM2=$(cat index.html | grep "${SOURCEVERSION}" | grep fixes-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM2}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM2=$(expr ${PATCH_NUM2} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM2}" != "${num}" ]; then
+    PATCH_NUM2=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/gcc-patch.sh
===================================================================
--- scripts/patch/gcc-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/gcc-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -29,9 +29,27 @@
 #
 cd ~/tmp
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-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)
+wget http://svn.cross-lfs.org/svn/repos/patches/gcc/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
+for num in $(seq 1 99); do
+  PATCH_NUM2=$(cat index.html | grep "${SOURCEVERSION}" | grep fixes-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM2}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM2=$(expr ${PATCH_NUM2} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM2}" != "${num}" ]; then
+    PATCH_NUM2=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/gcc/4.4.1/35-boemhm-ppc.patch
===================================================================
--- scripts/patch/gcc/4.4.1/35-boemhm-ppc.patch	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
+++ scripts/patch/gcc/4.4.1/35-boemhm-ppc.patch	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -0,0 +1,73 @@
+Fixes 
+In file included from /var/build_system/work/gcc-4.4.1/boehm-gc/include/private/gc_priv.h:98,
+                 from /var/build_system/work/gcc-4.4.1/boehm-gc/alloc.c:19:
+/var/build_system/work/gcc-4.4.1/boehm-gc/include/private/gc_locks.h: In function âGC_test_and_setâ:
+/var/build_system/work/gcc-4.4.1/boehm-gc/include/private/gc_locks.h:165: error: âasmâ operand has impossible constraints
+make[3]: *** [alloc.lo] Error 1
+make[3]: Leaving directory `/var/build_system/work/gcc-build/powerpc-unknown-linux-gnu/boehm-gc'
+make[2]: *** [all-recursive] Error 1
+
+--- trunk/boehm-gc/include/private/gc_locks.h	2008/07/23 11:06:42	138078
++++ trunk/boehm-gc/include/private/gc_locks.h	2009/07/23 16:05:37	150018
+@@ -139,49 +139,35 @@
+ #      define GC_TEST_AND_SET_DEFINED
+ #    endif
+ #    if defined(POWERPC)
+-#     if 0 /* CPP_WORDSZ == 64  totally broken to use int locks with ldarx */
+-        inline static int GC_test_and_set(volatile unsigned int *addr) {
+-          unsigned long oldval;
+-          unsigned long temp = 1; /* locked value */
+-
+-          __asm__ __volatile__(
+-               "1:\tldarx %0,0,%3\n"   /* load and reserve               */
+-               "\tcmpdi %0, 0\n"       /* if load is                     */
+-               "\tbne 2f\n"            /*   non-zero, return already set */
+-               "\tstdcx. %2,0,%1\n"    /* else store conditional         */
+-               "\tbne- 1b\n"           /* retry if lost reservation      */
+-               "\tsync\n"              /* import barrier                 */
+-               "2:\t\n"                /* oldval is zero if we set       */
+-              : "=&r"(oldval), "=p"(addr)
+-              : "r"(temp), "1"(addr)
+-              : "cr0","memory");
+-          return (int)oldval;
+-        }
++#     define GC_TEST_AND_SET_DEFINED
++#     define GC_CLEAR_DEFINED
++#     if (__GNUC__>4)||((__GNUC__==4)&&(__GNUC_MINOR__>=4))
++#       define GC_test_and_set(addr) __sync_lock_test_and_set (addr, 1)
++#       define GC_clear(addr) __sync_lock_release (addr)
+ #     else
+         inline static int GC_test_and_set(volatile unsigned int *addr) {
+           int oldval;
+           int temp = 1; /* locked value */
+ 
+           __asm__ __volatile__(
+-               "1:\tlwarx %0,0,%3\n"   /* load and reserve               */
++               "\n1:\n"
++	       "\tlwarx %0,%y3\n"      /* load and reserve, 32-bits      */
+                "\tcmpwi %0, 0\n"       /* if load is                     */
+                "\tbne 2f\n"            /*   non-zero, return already set */
+-               "\tstwcx. %2,0,%1\n"    /* else store conditional         */
++               "\tstwcx. %2,%y3\n"     /* else store conditional         */
+                "\tbne- 1b\n"           /* retry if lost reservation      */
+                "\tsync\n"              /* import barrier                 */
+                "2:\t\n"                /* oldval is zero if we set       */
+-              : "=&r"(oldval), "=p"(addr)
+-              : "r"(temp), "1"(addr)
++              : "=&r"(oldval), "=m"(addr)
++              : "r"(temp), "Z"(addr)
+               : "cr0","memory");
+           return oldval;
+         }
+-#     endif
+-#     define GC_TEST_AND_SET_DEFINED
+       inline static void GC_clear(volatile unsigned int *addr) {
+ 	__asm__ __volatile__("lwsync" : : : "memory");
+         *(addr) = 0;
+       }
+-#     define GC_CLEAR_DEFINED
++#    endif
+ #    endif
+ #    if defined(ALPHA) 
+         inline static int GC_test_and_set(volatile unsigned int * addr)
+
Index: scripts/patch/ncurses-patch.sh
===================================================================
--- scripts/patch/ncurses-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/ncurses-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -34,7 +34,16 @@
 #
 cd ~/tmp
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep ncurses | 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)
+wget http://svn.cross-lfs.org/svn/repos/patches/ncurses/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/perl-patch.sh
===================================================================
--- scripts/patch/perl-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/perl-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -24,7 +24,16 @@
 #
 cd /usr/src
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-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)
-PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+wget http://svn.cross-lfs.org/svn/repos/patches/perl/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/readline-patch.sh
===================================================================
--- scripts/patch/readline-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/readline-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -35,7 +35,16 @@
 #
 cd ~/tmp
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep readline | 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)
+wget http://svn.cross-lfs.org/svn/repos/patches/readline/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
Index: scripts/patch/vim-patch.sh
===================================================================
--- scripts/patch/vim-patch.sh	(revision e47a55462c108b65a6ac986a2e119964b66687c9)
+++ scripts/patch/vim-patch.sh	(revision 29f6db37e98fcfe79b7c8e3c349c99538a7686ec)
@@ -34,7 +34,16 @@
 #
 cd ~/tmp
-wget http://patches.cross-lfs.org/dev/ --no-remove-listing
-PATCH_NUM=$(cat index.html | grep vim | 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)
+wget http://svn.cross-lfs.org/svn/repos/patches/vim/ --no-remove-listing
+for num in $(seq 1 99); do
+  PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep branch_update-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
+  if [ "${PATCH_NUM}" = "0" -a "${num}" = "1" ]; then
+    PATCH_NUM=$(expr ${PATCH_NUM} + 1)
+    break
+  fi
+  if [ "${PATCH_NUM}" != "${num}" ]; then
+    PATCH_NUM=$(expr ${num})
+    break
+  fi
+done
 rm -f index.html
 
