testing: clone reviewboard-fork when starting mozreview (bug 1264203) r?gps draft
authorbyron jones <glob@mozilla.com>
Tue, 26 Apr 2016 16:21:24 +0800
changeset 8098 315a868f861c647991670c3e09e3e0d52514b93b
parent 8097 822835220ece8e46304afe34024e09dc5c2670e2
child 8099 62e954c1419cb20df12a9901bc196dd876aeafa3
push id821
push userbjones@mozilla.com
push dateThu, 12 May 2016 05:13:51 +0000
reviewersgps
bugs1264203
testing: clone reviewboard-fork when starting mozreview (bug 1264203) r?gps Clone our Review Board fork into VCT when creating the test environment, and ensure the local host has the tools required to package Djblets and Review Board. This is in preparation for using a customised Review Board instead of an unmodified upstream version. MozReview-Commit-ID: 2y0DKMepUIf
.hgignore
create-test-environment
testing/vcttesting/mozreview.py
--- a/.hgignore
+++ b/.hgignore
@@ -1,13 +1,14 @@
 coverage/
 docs/_build/
 testing/bmoserver/.vagrant
 testing/puppet/files/Mozilla-Bugzilla-Public*
 testing/unifiedserver/.vagrant
+reviewboard-fork/
 venv/
 \.egg-info$
 \.pyc$
 \.pyo$
 \.swp$
 \.t.err$
 ~$
 \.vagrant/*
--- a/create-test-environment
+++ b/create-test-environment
@@ -3,16 +3,30 @@
 set -e
 
 vercheck=`python -c 'import sys; print(sys.version_info[0:3] >= (2, 7, 9))'`
 if [ "x${vercheck}" != "xTrue" ]; then
   echo "Python version too old. Test environment requires 2.7.9+"
   exit 1
 fi
 
+# We need node.js for tools required to package/install Review Board
+# (eg. lessc, uglifyjs)
+if ! type npm >/dev/null 2>&1; then
+  echo "npm not found.  Please install node.js."
+  exit 1
+fi
+# More annoyingly we need msgfmt which is part of gettext.
+if ! type msgfmt >/dev/null 2>&1; then
+  echo "msgfmt not found.  Please install the gettext package."
+  echo "On OSX you can use homebrew to install this:"
+  echo "  brew install gettext && brew link gettext --force"
+  exit 1
+fi
+
 ROOT=`pwd`
 VENV=${ROOT}/venv
 
 if [ ! -d ${VENV} ]; then
   # There is a bug in pycrypto where it tries to invoke `configure` instead
   # of a path qualified configure. So if there is a "configure" on $PATH
   # it will invoke the wrong one.
   configure=which configure &>/dev/null || true
@@ -47,16 +61,43 @@ fi
 source ${VENV}/bin/activate
 
 cd pylib/requests
 python setup.py develop
 cd ../..
 
 pip install --upgrade --require-hashes -r test-requirements.txt
 
+if [ ! -d reviewboard-fork ]; then
+  echo "Cloning Review Board"
+  hg clone https://hg.mozilla.org/webtools/reviewboard reviewboard-fork
+fi
+
+if [ ! -d ${VENV}/node ]; then
+    mkdir ${VENV}/node
+fi
+cd ${VENV}/node
+npm init -y >/dev/null
+npm install less uglifyjs
+cd ${VENV}
+for FN in lessc uglifyjs; do
+    if [ ! -e bin/${FN} ]; then
+        ln -s ../node/node_modules/.bin/${FN} bin/${FN}
+    fi
+done
+cd ..
+
+cd reviewboard-fork
+hg pull -u
+cd djblets
+python setup.py install
+cd ../reviewboard
+python setup.py install
+cd ../..
+
 cd pylib/Bugsy
 python setup.py develop
 cd ../..
 
 cd pylib/mozansible
 python setup.py develop
 cd ../..
 
--- a/testing/vcttesting/mozreview.py
+++ b/testing/vcttesting/mozreview.py
@@ -185,16 +185,20 @@ class MozReview(object):
         ldap_image = ldap_image or self.ldap_image
         pulse_image = pulse_image or self.pulse_image
         rbweb_image = rbweb_image or self.rbweb_image
         autolanddb_image = autolanddb_image or self.autolanddb_image
         autoland_image = autoland_image or self.autoland_image
         hgweb_image = hgweb_image or self.hgweb_image
         treestatus_image = treestatus_image or self.treestatus_image
 
+        if not os.path.exists(os.path.join(ROOT, 'reviewboard-fork')):
+            raise Exception('Failed to find reviewboard-fork. '
+                            'Please run create-test-environment.')
+
         self.started = True
         mr_info = self._docker.start_mozreview(
                 cluster=self._name,
                 http_port=bugzilla_port,
                 pulse_port=pulse_port,
                 web_image=web_image,
                 hgrb_image=hgrb_image,
                 ldap_image=ldap_image,