changeset 957:44483a915e13

Script to track down breakage in a USE_UNSTABLE package via git bisect.
author Rob Landley <rob@landley.net>
date Thu, 21 Jan 2010 19:19:50 -0600
parents ba1b92e403e7
children 0581a13cadb3
files sources/more/bisectinate.sh
diffstat 1 files changed, 93 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/more/bisectinate.sh	Thu Jan 21 19:19:50 2010 -0600
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+# Find the first breakage (since the last known good version) via git bisect.
+
+if [ $# -ne 4 ]
+then
+  echo usage: bisectinate PACKAGE repodir@branch start arch >&2
+  exit 1
+fi
+
+# Parse command line options
+
+PKG="$1"
+REPO="${2/@*/}"
+BRANCH="${2/*@/}"
+[ "$BRANCH" == "$2" ] && BRANCH=master
+START="$3"
+ARCH="$4"
+
+FWLDIR="$(pwd)"
+
+if [ ! -d "$REPO/.git" ]
+then
+  echo "No git repo at $REPO"
+  exit 1
+fi
+
+# Start bisecting repository
+
+mkdir -p build/logs
+cd "$REPO" &&
+git bisect reset &&
+git bisect start &&
+git bisect good "$START" || exit 1
+RESULT="$(git bisect bad "$BRANCH")"
+cd "$FWLDIR"
+
+set -o pipefail
+
+# Loop through bisection results
+
+while true
+do
+  echo "$RESULT"
+
+  # Are we done?
+
+  [ ! "$(echo "$RESULT" | head -n 1 | grep "^Bisecting:")" ] && exit
+
+  cd "$REPO"
+  git show > "$FWLDIR/build/logs/test-${ARCH}.txt"
+  git archive --prefix="$PKG/" HEAD | bzip2 \
+    > "$FWLDIR/packages/alt-$PKG-0.tar.bz2" || exit 1
+  cd "$FWLDIR"
+
+  # Perform actual build
+
+  RESULT=bad
+  rm -rf build/*-"$ARCH"{,.tar.bz2} build/cron-temp/"$ARCH"-dropbearmulti
+  EXTRACT_ALL=yes USE_UNSTABLE="$PKG" ./build.sh "$ARCH" \
+    | tee -a build/logs/test-"$ARCH".txt
+  if [ -e build/system-image-"$ARCH".tar.bz2 ]
+  then
+    if [ -z "$LONG" ]
+    then
+      RESULT=good
+    else
+     sources/more/native-static-build.sh "$ARCH" 2>&1 \
+       | tee -a build/logs/test-"$ARCH".txt
+
+      [ -e build/cron-temp/"$ARCH"-dropbearmulti ] && RESULT=good
+    fi
+  fi
+
+  # If it built, try the native compile
+
+  if [ "$RESULT" == "bad" ]
+  then
+    mv build/logs/{test,testfail}-"$ARCH".txt
+  else
+    rm build/logs/test-"$ARCH".txt
+  fi
+
+  cd "$REPO"
+  RESULT="$(git bisect $RESULT)"
+  cd "$FWLDIR"
+done
+
+
+
+#git bisect start
+#git bisect good 57dded090d6
+#git bisect bad origin/0_9_30