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
--- 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,