[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 2/3] mg-branch-setup: New script



Also, update the README.dev accordingly

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 README.dev      |   77 +++++++++++++++-------------------------
 mg-branch-setup |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+), 49 deletions(-)
 create mode 100755 mg-branch-setup

diff --git a/README.dev b/README.dev
index e9458a3..3303e77 100644
--- a/README.dev
+++ b/README.dev
@@ -69,60 +69,39 @@ former case, disables everything; in the latter, just that 
"branch")
 Creating a new branch
 =====================
 
-As osstest@osstest:
-
-$ cd branches
-
-($branch sort of matching ap-fetch-version modulo wildcards and must
-match cron invocation)
-
-$ cd ~osstest/branches
-$ umask 002
-$ git clone ../testing.git for-$branch.git
-
-If you want to bisect then:
-$ cd ../bisects
-$ git clone ../testing.git for-$branch.git
-
-$ cd ../branches
-$ ln -s /export/home/osstest/bisects/for-$branch.git 
for-$branch.git/tree-bisect
-
-$ mkdir for-$branch.git/tmp
-# For manual playing only.
-
-Now can play in here. Can push random stuff and run
-"cr-daily-branch --real $branch" as osstest@osstest. e.g.
+* Add appropriate code to ap-*
+  (For linux-* this is not needed if the tag is in the standard namespace)
+  (ap-push should use refs/heads/foo, not just `foo', for the remote
+   ref name - so that the initial push works)
+
+* Create any necessary output tree on xenbits:
+  As xen@xenbits do   mkdir   and   git init --bare
+  If this tree is going to contain push gate input, push something to
+  the push gate input ref.
+
+* Create the actual trees and push an initial version
+  As osstest@osstest:
+  $ cd $HOME/testing.git
+  $ OSSTEST_CONFIG=production-config \
+    ./mg-branch-setup BRANCH bisect INITIAL-TESTED-VERSION
+
+* Optional testing:
+  You can now play in here if you like.  Can push random stuff and run
+  "cr-daily-branch --real $branch" as osstest@osstest. e.g.
   $ OSSTEST_EMAIL_HEADER=/home/ianc/osstest-email-ijc \
     OSSTEST_CONFIG=production-config ./cr-daily-branch --real $branch
 
-Note: Push to incoming and git reset --hard incoming
-Note2:
-$ cat ~/osstest-email-ijc
-To: ian.campbell@xxxxxxxxxx
-
-Do not run cr-for-branches -- it will try to update all sorts trees
-etc.
-
-Need to create any xenbits trees which are referenced:
-
-As xen@xenbits do mkdir and git init --bare, but this might confuse
-cr-daily-branches so you would want to push something there
-(e.g. current master, easiest to do as osstest@osstest). Or "git clone
---bare" but might create all sorts of unwanted refs.
-
-Use ap-push to populate tree, in order to test ap-push, after using
-ap-fetch-version to populate the local repo. e.g.
-OSSTEST_CONFIG=production-config ./ap-fetch-version $branch
-OSSTEST_CONFIG=production-config ./ap-push $branch $revision
+  If you do this, do not run cr-for-branches -- it will try to update
+  all sorts trees etc.
 
-NOTE: $revision must be a revision *not* a tag. If you want to start
-with a known baseline then git rev-parse FOO~0 it first.
-NOTE2: ap-push should use refs/heads/foo explicitly so that this
-initial push works
+  Before enabling this in cron (eg by pushing the change to BRANCHES
+  to production pretest branch), rewind so that osstest can fast
+  forward it to the actual production version.  Ie in bisects and
+  branches for-$branch.git,
+     git fetch origin incoming
+     git reset --hard FETCH_HEAD
 
-When pushing the patches, be sure to make sure that the
-for-$branch.git repo can fast forward to the pushed version (perhaps
-by resetting it).
+$ Add to BRANCHES setting in cr-for-branches
 
 Force pushing a branch
 ======================
diff --git a/mg-branch-setup b/mg-branch-setup
new file mode 100755
index 0000000..b0c9712
--- /dev/null
+++ b/mg-branch-setup
@@ -0,0 +1,106 @@
+#!/bin/bash
+#
+# usage:
+#  ./mg-branch-setup BRANCH bisect INITIAL-TESTED-VERSION
+#  ./mg-branch-setup BRANCH no-bisect
+#  ./mg-branch-setup BRANCH no-check
+#
+#  - checks that ap-fetch works (only if not `no-check')
+#  - creates the tree in ~osstest/branches
+#  - if applicable, creates the tree in ~osstest/bisects
+#  - if applicable, pushes INITIAL-TESTED-VERSION with ap-push
+#
+# Does NOT
+#  - add anything to the branch list in cr-for-branches
+#  - create any input/output tree on xenbits
+#  - run any test flights (obviously)
+
+set -e
+
+fail () { echo >&2 "$*"; exit 1; }
+badusage () { fail 'bad usage'; }
+need_value () {
+       case "$1" in
+       -*|'')  badusage ;;
+       esac
+}
+
+branch=$1; shift
+need_value "$branch"
+
+mode=$1; shift
+
+case "$mode" in
+bisect)
+       fetch=true
+       push=true
+       bisect=true
+       push_version="$1"; shift
+       need_value "$push_version"
+       ;;
+no-bisect)
+       fetch=true
+       push=false
+       bisect=false
+       ;;
+no-check)
+       fetch=false
+       push=false
+       bisect=false
+       ;;
+*)
+       badusage
+       ;;
+esac
+
+if [ $# != 0 ]; then badusage; fi
+
+umask 002
+
+must_test () {
+       local dir="$1"; shift
+       local t
+       for t in "$@"; do
+               if ! test $t "$dir"; then fail "test $t $dir failed"; fi
+       done
+}
+
+(
+       set -e
+       cd $HOME
+       must_test testing.git -d
+       must_test branches -d -w
+       if $bisect; then
+               must_test bisects -d -w
+       fi
+)
+
+x () { echo >&2 "; $*"; "$@"; }
+
+if $fetch; then
+       x ./ap-fetch-version $branch
+fi
+
+if $push; then
+       x ./ap-push $branch "$push_version"~0
+       x ./ap-fetch-version-baseline $branch
+fi
+
+make_tree () {
+       (
+               set -e
+               x cd $HOME/$1
+               x git clone ../testing.git for-$branch.git
+               x mkdir for-$branch.git/tmp
+       )
+}
+
+set -e
+make_tree branches
+if $bisect; then
+       make_tree bisects
+       x ln -sf $HOME/branches/for-$branch.git \
+               $HOME/bisects/for-$branch.git/tree-bisect
+fi
+
+echo "Branch $branch set up ok."
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.