Mercurial > hg > aboriginal
annotate more/bisectinate.sh @ 1178:80693b1a8038
Yank toybox from simple-root-filesystem. (Still need it for patch in host-tools.sh)
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 26 Jul 2010 00:06:58 -0500 |
parents | 300e6d919d86 |
children | cfcb4ee310b0 |
rev | line source |
---|---|
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Find the first breakage (since the last known good version) via git bisect. |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 if [ $# -ne 4 ] |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 then |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 echo usage: bisectinate PACKAGE repodir@branch start arch >&2 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 exit 1 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 fi |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 # Parse command line options |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 PKG="$1" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 REPO="${2/@*/}" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 BRANCH="${2/*@/}" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 [ "$BRANCH" == "$2" ] && BRANCH=master |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 START="$3" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 ARCH="$4" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
20 TOP="$(pwd)" |
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
21 [ -z "$SRCDIR" ] && SRCDIR="$TOP/packages" |
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
22 [ -z "$BUILD" ] && BUILD="$TOP/build" |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 if [ ! -d "$REPO/.git" ] |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 then |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 echo "No git repo at $REPO" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 exit 1 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 fi |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 |
995
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
30 # For kernel and busybox bisects, only redo part of the build |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
31 |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
32 if [ "$PKG" == linux ] && [ -e "$BUILD/root-filesystem-$ARCH".tar.bz2 ] |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
33 then |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
34 ZAPJUST=system-image |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
35 elif [ "$PKG" == busybox ] && |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
36 [ -e "$BUILD/simple-cross-compiler-$ARCH.tar.bz2" ] |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
37 then |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
38 ZAPJUST=root-filesystem |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
39 else |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
40 ZAPJUST= |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
41 fi |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
42 |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 # Start bisecting repository |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
45 mkdir -p "$BUILD"/logs |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 cd "$REPO" && |
985
c7fd7c400d3b
Add more cleanup to bisectinate's repository initialization (reliability tweak).
Rob Landley <rob@landley.net>
parents:
957
diff
changeset
|
47 git clean -fdx && git checkout -f && |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 git bisect reset && |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 git bisect start && |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 git bisect good "$START" || exit 1 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 RESULT="$(git bisect bad "$BRANCH")" |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
52 cd "$TOP" |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 set -o pipefail |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 # Loop through bisection results |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 while true |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
59 do |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
60 echo "$RESULT" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
61 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
62 # Are we done? |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
63 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
64 [ ! "$(echo "$RESULT" | head -n 1 | grep "^Bisecting:")" ] && exit |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
65 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
66 cd "$REPO" |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
67 git show > "$BUILD/logs/test-${ARCH}.txt" |
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
68 # The "cat" bypasses git's stupid overengineered built-in call to less. |
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
69 git log HEAD -1 | cat |
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
70 echo "Testing..." |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
71 git archive --prefix="$PKG/" HEAD | bzip2 \ |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
72 > "$SRCDIR/alt-$PKG-0.tar.bz2" || exit 1 |
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
73 cd "$TOP" |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
74 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
75 # Perform actual build |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
76 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
77 RESULT=bad |
995
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
78 |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
79 [ ! -z "$ZAPJUST" ] && |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
80 rm -rf "$BUILD/${ZAPJUST}-$ARCH"{,.tar.bz2} || |
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
81 rm -rf "$BUILD"/*-"$ARCH"{,.tar.bz2} |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
82 EXTRACT_ALL=yes USE_UNSTABLE="$PKG" ./build.sh "$ARCH" \ |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
83 | tee -a "$BUILD"/logs/test-"$ARCH".txt |
994
4a02bb65fe0c
Fix a typo that broke the script completely.
Rob Landley <rob@landley.net>
parents:
986
diff
changeset
|
84 if [ -e "$BUILD"/system-image-"$ARCH".tar.bz2 ] |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
85 then |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
86 if [ -z "$LONG" ] |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
87 then |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
88 RESULT=good |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
89 else |
995
c867d05d8c4d
Optimize the linux and busybox bisects to not rebuild earlier sections unnecessarily.
Rob Landley <rob@landley.net>
parents:
994
diff
changeset
|
90 rm -rf "$BUILD"/cron-temp/"$ARCH"-dropbearmulti |
1157
300e6d919d86
Move "sources/more/" to just "more/", add a README explaining why those scripts are there, and adjust calls to them.
Rob Landley <rob@landley.net>
parents:
995
diff
changeset
|
91 more/native-static-build.sh "$ARCH" 2>&1 \ |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
92 | tee -a "$BUILD"/logs/test-"$ARCH".txt |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
93 |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
94 [ -e "$BUILD"/cron-temp/"$ARCH"-dropbearmulti ] && RESULT=good |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
95 fi |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
96 fi |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
97 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
98 # If it built, try the native compile |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
99 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
100 if [ "$RESULT" == "bad" ] |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
101 then |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
102 mv "$BUILD"/logs/{test,testfail}-"$ARCH".txt |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
103 else |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
104 rm "$BUILD"/logs/test-"$ARCH".txt |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
105 fi |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
106 |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
107 cd "$REPO" |
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
108 RESULT="$(git bisect $RESULT)" |
986
fb0152b485f4
Give bisectinate.sh overrideable SRCDIR and BUILD.
Rob Landley <rob@landley.net>
parents:
985
diff
changeset
|
109 cd "$TOP" |
957
44483a915e13
Script to track down breakage in a USE_UNSTABLE package via git bisect.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
110 done |