summaryrefslogtreecommitdiff
path: root/setup
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
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')
-rw-r--r--setup/package.dfcentos49
-rw-r--r--setup/package.dfdebian70
-rwxr-xr-xsetup/package.py45
3 files changed, 142 insertions, 22 deletions
diff --git a/setup/package.dfcentos b/setup/package.dfcentos
new file mode 100644
index 00000000000..cd494534c51
--- /dev/null
+++ b/setup/package.dfcentos
@@ -0,0 +1,49 @@
+# Please note that this Dockerfile is used for testing nightly builds and should
+# not be used to deploy Odoo
+FROM centos:centos7
+MAINTAINER Odoo S.A. <info@odoo.com>
+
+# Dependencies and postgres
+RUN yum install -d 0 -e 0 epel-release -y && \
+ yum update -d 0 -e 0 -y && \
+ yum install -d 0 -e 0 \
+ babel \
+ libxslt-python \
+ pychart \
+ pyparsing \
+ python-dateutil \
+ python-decorator \
+ python-docutils \
+ python-feedparser \
+ python-imaging \
+ python-jinja2 \
+ python-ldap \
+ python-lxml \
+ python-mako \
+ python-mock \
+ python-openid \
+ python-passlib \
+ python-psutil \
+ python-psycopg2 \
+ python-reportlab \
+ python-requests \
+ python-simplejson \
+ python-unittest2 \
+ python-vobject \
+ python-werkzeug \
+ python-yaml \
+ pytz \
+ postgresql \
+ postgresql-server \
+ postgresql-libs \
+ postgresql-contrib \
+ postgresql-devel -y && \
+ yum clean all
+
+RUN easy_install pyPdf vatnumber pydot psycogreen
+
+# Manual start of postgres
+RUN mkdir -p /var/lib/postgres/data
+RUN chown -R postgres:postgres /var/lib/postgres/data
+RUN su postgres -c "initdb -D /var/lib/postgres/data -E UTF-8"
+RUN cp /usr/share/pgsql/postgresql.conf.sample /var/lib/postgres/data/postgresql.conf \ No newline at end of file
diff --git a/setup/package.dfdebian b/setup/package.dfdebian
new file mode 100644
index 00000000000..8afcad6431b
--- /dev/null
+++ b/setup/package.dfdebian
@@ -0,0 +1,70 @@
+# Please note that this Dockerfile is used for testing nightly builds and should
+# not be used to deploy Odoo
+FROM debian:stable
+MAINTAINER Odoo S.A. <info@odoo.com>
+
+# Change policy-rc.d so that services start automatically once installed
+RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
+
+RUN apt-get update && \
+ apt-get install -y locales && \
+ rm -rf /var/lib/apt/lists/*
+
+# Reconfigure locales such that postgresql uses UTF-8 encoding
+RUN dpkg-reconfigure locales && \
+ locale-gen C.UTF-8 && \
+ /usr/sbin/update-locale LANG=C.UTF-8
+ENV LC_ALL C.UTF-8
+
+RUN apt-get update -qq && \
+ apt-get upgrade -qq -y && \
+ apt-get install \
+ postgresql \
+ postgresql-server-dev-all \
+ postgresql-client \
+ adduser \
+ libxml2-dev \
+ libxslt1-dev \
+ libldap2-dev \
+ libsasl2-dev \
+ libssl-dev \
+ libjpeg-dev \
+ python-dev \
+ python-pip \
+ build-essential \
+ python \
+ python-dateutil \
+ python-decorator \
+ python-docutils \
+ python-feedparser \
+ python-imaging \
+ python-jinja2 \
+ python-ldap \
+ python-libxslt1 \
+ python-lxml \
+ python-mako \
+ python-mock \
+ python-openid \
+ python-passlib \
+ python-psutil \
+ python-psycopg2 \
+ python-pybabel \
+ python-pychart \
+ python-pydot \
+ python-pyparsing \
+ python-pypdf \
+ python-reportlab \
+ python-requests \
+ python-simplejson \
+ python-tz \
+ python-unittest2 \
+ python-vatnumber \
+ python-vobject \
+ python-werkzeug \
+ python-xlwt \
+ python-yaml -y && \
+ rm -rf /var/lib/apt/lists/*
+
+COPY requirements.txt /opt/release/requirements.txt
+
+RUN pip install -r /opt/release/requirements.txt
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)