summaryrefslogtreecommitdiff
path: root/setup/package.py
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2014-12-05 10:17:53 +0100
committerSimon Lejeune <sle@openerp.com>2014-12-09 12:33:56 +0100
commita7ab5a4109ec99d77f61a6d4c8bc7696149ea09c (patch)
treed4f66620af18cad3310b8372182ffc359abf2c1d /setup/package.py
parenta700a1139ee19d71bc4669ff74bc53c87b38dc7b (diff)
[ADD] Packaging: Debian and CentOS Dockerfiles for nightly builds tests
This way we'll be using docker cache to spare dependencies download time.
Diffstat (limited to 'setup/package.py')
-rwxr-xr-xsetup/package.py45
1 files changed, 23 insertions, 22 deletions
diff --git a/setup/package.py b/setup/package.py
index 383b78b59b6..10910876bfb 100755
--- a/setup/package.py
+++ b/setup/package.py
@@ -298,15 +298,27 @@ def build_exe(o):
#----------------------------------------------------------
# Stage: testing
#----------------------------------------------------------
+def _prepare_testing(o):
+ if not o.no_tarball or not o.no_debian:
+ subprocess.call(["mkdir", "docker_debian"], cwd=o.build_dir)
+ subprocess.call(["cp", "package.dfdebian", os.path.join(o.build_dir, "docker_debian", "Dockerfile")],
+ cwd=os.path.join(o.odoo_dir, "setup"))
+ # Use rsync to copy requirements.txt in order to keep original permissions
+ subprocess.call(["rsync", "-a", "requirements.txt", os.path.join(o.build_dir, "docker_debian")],
+ cwd=os.path.join(o.odoo_dir))
+ subprocess.call(["docker", "build", "-t", "odoo-debian-nightly-tests", "."],
+ cwd=os.path.join(o.build_dir, "docker_debian"))
+ if not o.no_rpm:
+ subprocess.call(["mkdir", "docker_centos"], cwd=o.build_dir)
+ subprocess.call(["cp", "package.dfcentos", os.path.join(o.build_dir, "docker_centos", "Dockerfile")],
+ cwd=os.path.join(o.odoo_dir, "setup"))
+ subprocess.call(["docker", "build", "-t", "odoo-centos-nightly-tests", "."],
+ cwd=os.path.join(o.build_dir, "docker_centos"))
+
def test_tgz(o):
- with docker('debian:stable', o.build_dir, o.pub) as wheezy:
+ with docker('odoo-debian-nightly-tests', o.build_dir, o.pub) as wheezy:
wheezy.release = 'odoo.tar.gz'
- wheezy.system('apt-get update -qq && apt-get upgrade -qq -y')
- wheezy.system("apt-get install postgresql python-dev postgresql-server-dev-all python-pip build-essential libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libssl-dev libjpeg-dev -y")
wheezy.system("service postgresql start")
- wheezy.system('su postgres -s /bin/bash -c "pg_dropcluster --stop 9.1 main"')
- wheezy.system('su postgres -s /bin/bash -c "pg_createcluster --start -e UTF-8 9.1 main"')
- wheezy.system('pip install -r /opt/release/requirements.txt')
wheezy.system('/usr/local/bin/pip install /opt/release/%s' % wheezy.release)
wheezy.system("useradd --system --no-create-home odoo")
wheezy.system('su postgres -s /bin/bash -c "createuser -s odoo"')
@@ -317,13 +329,9 @@ def test_tgz(o):
wheezy.system('su odoo -s /bin/bash -c "odoo.py --addons-path=/usr/local/lib/python2.7/dist-packages/openerp/addons -d mycompany &"')
def test_deb(o):
- with docker('debian:stable', o.build_dir, o.pub) as wheezy:
+ with docker('odoo-debian-nightly-tests', o.build_dir, o.pub) as wheezy:
wheezy.release = '*.deb'
- wheezy.system('/usr/bin/apt-get update -qq && /usr/bin/apt-get upgrade -qq -y')
- wheezy.system("apt-get install postgresql -y")
wheezy.system("service postgresql start")
- wheezy.system('su postgres -s /bin/bash -c "pg_dropcluster --stop 9.1 main"')
- wheezy.system('su postgres -s /bin/bash -c "pg_createcluster --start -e UTF-8 9.1 main"')
wheezy.system('su postgres -s /bin/bash -c "createdb mycompany"')
wheezy.system('/usr/bin/dpkg -i /opt/release/%s' % wheezy.release)
wheezy.system('/usr/bin/apt-get install -f -y')
@@ -331,18 +339,9 @@ def test_deb(o):
wheezy.system('su odoo -s /bin/bash -c "odoo.py -c /etc/odoo/openerp-server.conf -d mycompany &"')
def test_rpm(o):
- with docker('centos:centos7', o.build_dir, o.pub) as centos7:
+ with docker('odoo-centos-nightly-tests', o.build_dir, o.pub) as centos7:
centos7.release = 'odoo.noarch.rpm'
- # Dependencies
- centos7.system('yum install -d 0 -e 0 epel-release -y')
- centos7.system('yum update -d 0 -e 0 -y')
- # Manual install/start of postgres
- centos7.system('yum install -d 0 -e 0 postgresql postgresql-server postgresql-libs postgresql-contrib postgresql-devel -y')
- centos7.system('mkdir -p /var/lib/postgres/data')
- centos7.system('chown -R postgres:postgres /var/lib/postgres/data')
- centos7.system('chmod 0700 /var/lib/postgres/data')
- centos7.system('su postgres -c "initdb -D /var/lib/postgres/data -E UTF-8"')
- centos7.system('cp /usr/share/pgsql/postgresql.conf.sample /var/lib/postgres/data/postgresql.conf')
+ # Start postgresql
centos7.system('su postgres -c "/usr/bin/pg_ctl -D /var/lib/postgres/data start"')
centos7.system('sleep 5')
centos7.system('su postgres -c "createdb mycompany"')
@@ -447,6 +446,8 @@ def options():
def main():
o = options()
_prepare_build_dir(o)
+ if not o.no_testing:
+ _prepare_testing(o)
try:
if not o.no_tarball:
build_tgz(o)