crosstool 0-26 seems not to check success of patches

Dan Kegel dank@kegel.com
Sun Jan 25 21:12:00 GMT 2004


Charlie Brady wrote:
> Is that intentional?

OK, I finally went to the trouble of grepping through the patch results.

Can you verify this patch solves the problem?
- Dan

--- crosstool-0.26/getandpatch.sh	2004-01-16 15:04:02.000000000 -0800
+++ crosstool-cur/getandpatch.sh	2004-01-25 13:00:31.000000000 -0800
@@ -27,6 +27,9 @@
  # And one is derived.
  GLIBCTHREADS_FILENAME=`echo $GLIBC_DIR | sed 's/glibc-/glibc-linuxthreads-/'`

+# Pattern in a patch log to indicate failure
+PATCHFAILMSGS="^No file to patch.  Skipping patch.|^Hunk .* FAILED at"
+
  # Download, unpack, and patch the given tarball.
  # Assumes that the tarball unpacks to a name guessable from its url,
  # and that patches already exist locally in a directory named after the tarball.
@@ -59,12 +62,16 @@
  	# -f is required for patches that delete files, like
  	# patches/glibc-2.2.5/hhl-powerpc-fpu.patch,
  	# else patch will think the patch is reversed :-(
-	# FIXME: -f causes failed patches to sail through.  Need to grep for FAIL!
-        # use max --fuzz=1 since fuzz=2 is a bit too dangerous for automation
+	# Since -f tells patch to ignore failures, grep log to look for errors
+	# use max --fuzz=1 since default fuzz is too dangerous for automation
  	cd $BASENAME
-	for p in $TOP_DIR/patches/$BASENAME/*.patch; do
+	for p in $TOP_DIR/patches/$BASENAME/*patch* \
+		 $TOP_DIR/patches/$BASENAME/*.diff; do
  	    if test -f $p; then
-	        patch --fuzz=1 -p1 -f < $p
+	        patch --fuzz=1 -p1 -f < $p > patch$$.log 2>&1
+		cat patch$$.log
+		egrep -q "$PATCHFAILMSGS" patch$$.log && abort "patch $p failed"
+		rm -f patch$$.log
  	    fi
  	done
  }
@@ -91,10 +98,18 @@
  	fi

  	# Apply any patches for this component
-        # use max --fuzz=1 since fuzz=2 is a bit too dangerous for automation
-	for p in $TOP_DIR/patches/$BASENAME/*.patch; do
+	# -f is required for patches that delete files, like
+	# patches/glibc-2.2.5/hhl-powerpc-fpu.patch,
+	# else patch will think the patch is reversed :-(
+	# Since -f tells patch to ignore failures, grep log to look for errors
+	# use max --fuzz=1 since default fuzz is too dangerous for automation
+	for p in $TOP_DIR/patches/$BASENAME/*patch* \
+		 $TOP_DIR/patches/$BASENAME/*.diff; do
  	    if test -f $p; then
-	        patch --fuzz=1 -p1 < $p
+	        patch --fuzz=1 -p1 < $p > patch$$.log 2>&1
+		cat patch$$.log
+		egrep -q "$PATCHFAILMSGS" patch$$.log && abort "patch $p failed"
+		rm -f patch$$.log
  	    fi
  	done
  }

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list