diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-10-01 19:18:14 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-10-01 19:18:14 +0200 |
| commit | 709c9868de7c4ac4985ed4e0055ae3e3e49742ad (patch) | |
| tree | e90227a947bddf47b3043fcbe8b99529a22aa7dd /setup/package.py | |
| parent | 85f26244a71a0b9a7faa283d6d24fdde6bae899a (diff) | |
| parent | e8831932464814ed5f9e3a0af33f98891a466417 (diff) | |
[MERGE] forward port of branch 8.0 up to e883193
Diffstat (limited to 'setup/package.py')
| -rwxr-xr-x | setup/package.py | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/setup/package.py b/setup/package.py index 1e8b9efb310..7f90c5cea9c 100755 --- a/setup/package.py +++ b/setup/package.py @@ -25,12 +25,13 @@ import os import pexpect import shutil import signal +import subprocess +import tempfile import time import xmlrpclib from contextlib import contextmanager from glob import glob from os.path import abspath, dirname, join -from subprocess import check_output from tempfile import NamedTemporaryFile @@ -38,6 +39,8 @@ from tempfile import NamedTemporaryFile # Utils #---------------------------------------------------------- execfile(join(dirname(__file__), '..', 'openerp', 'release.py')) +version = version.split('-')[0] + timestamp = time.strftime("%Y%m%d-%H%M%S", time.gmtime()) PUBLISH_DIRS = { 'tar.gz': 'src', @@ -73,9 +76,18 @@ def _rpc_count_modules(addr='http://127.0.0.1', port=8069, dbname='mycompany'): modules = xmlrpclib.ServerProxy('%s:%s/xmlrpc/object' % (addr, port)).execute( dbname, 1, 'admin', 'ir.module.module', 'search', [('state', '=', 'installed')] ) - if modules: - print("Package test: successfuly installed %s modules" % len(modules)) + if modules and len(modules) > 1: + time.sleep(1) + toinstallmodules = xmlrpclib.ServerProxy('%s:%s/xmlrpc/object' % (addr, port)).execute( + dbname, 1, 'admin', 'ir.module.module', 'search', [('state', '=', 'to install')] + ) + if toinstallmodules: + print("Package test: FAILED. Not able to install dependencies of base.") + raise Exception("Installation of package failed") + else: + print("Package test: successfuly installed %s modules" % len(modules)) else: + print("Package test: FAILED. Not able to install base.") raise Exception("Installation of package failed") def publish(o, releases): @@ -90,6 +102,13 @@ def publish(o, releases): system('mkdir -p %s' % join(o.pub, release_dir)) shutil.move(join(o.build_dir, release), release_path) + if release_extension == 'deb': + temp_path = tempfile.mkdtemp(suffix='debPackages') + system(['cp', release_path, temp_path]) + with open(os.path.join(o.pub, 'deb', 'Packages'), 'w') as out: + subprocess.call(['dpkg-scanpackages', '.'], stdout=out, cwd=temp_path) + shutil.rmtree(temp_path) + # Latest/symlink handler release_abspath = abspath(release_path) latest_abspath = release_abspath.replace(timestamp, 'latest') @@ -127,7 +146,7 @@ class OdooDocker(object): ) time.sleep(2) # let the bash start self.docker.logfile_read = self.log_file - self.id = check_output('docker ps -l -q', shell=True) + self.id = subprocess.check_output('docker ps -l -q', shell=True) def end(self): try: @@ -219,9 +238,9 @@ class KVMWinTestExe(KVM): self.rsync('"%s" %s@127.0.0.1:' % (setuppath, self.login)) self.ssh("TEMP=/tmp ./%s /S" % setupfile) - self.ssh('PGPASSWORD=openpgpwd /cygdrive/c/"Program Files"/"OpenERP %s"/PostgreSQL/bin/createdb.exe -e -U openpg mycompany' % setupversion) - self.ssh('/cygdrive/c/"Program Files"/"OpenERP %s"/server/openerp-server.exe -d mycompany -i base --stop-after-init' % setupversion) - self.ssh(['/cygdrive/c/"Program Files"/"OpenERP %s"/server/openerp-server.exe -d mycompany &' % setupversion, '&']) + self.ssh('PGPASSWORD=openpgpwd /cygdrive/c/"Program Files"/"Odoo %s"/PostgreSQL/bin/createdb.exe -e -U openpg mycompany' % setupversion) + self.ssh('/cygdrive/c/"Program Files"/"Odoo %s"/server/openerp-server.exe -d mycompany -i base --stop-after-init' % setupversion) + self.ssh('net start odoo-server-8.0') _rpc_count_modules(port=18069) #---------------------------------------------------------- @@ -239,10 +258,10 @@ def build_tgz(o): def build_deb(o): system(['dpkg-buildpackage', '-rfakeroot', '-uc', '-us'], o.build_dir) - system(['cp', glob('%s/../openerp_*.deb' % o.build_dir)[0], '%s/odoo.deb' % o.build_dir]) - system(['cp', glob('%s/../openerp_*.dsc' % o.build_dir)[0], '%s/odoo.dsc' % o.build_dir]) - system(['cp', glob('%s/../openerp_*_amd64.changes' % o.build_dir)[0], '%s/odoo_amd64.changes' % o.build_dir]) - system(['cp', glob('%s/../openerp_*.tar.gz' % o.build_dir)[0], '%s/odoo.deb.tar.gz' % o.build_dir]) + system(['cp', glob('%s/../odoo_*.deb' % o.build_dir)[0], '%s/odoo.deb' % o.build_dir]) + system(['cp', glob('%s/../odoo_*.dsc' % o.build_dir)[0], '%s/odoo.dsc' % o.build_dir]) + system(['cp', glob('%s/../odoo_*_amd64.changes' % o.build_dir)[0], '%s/odoo_amd64.changes' % o.build_dir]) + system(['cp', glob('%s/../odoo_*.tar.gz' % o.build_dir)[0], '%s/odoo.deb.tar.gz' % o.build_dir]) def build_rpm(o): system(['python2', 'setup.py', '--quiet', 'bdist_rpm'], o.build_dir) @@ -291,7 +310,7 @@ def test_deb(o): def test_rpm(o): with docker('centos:centos7', o.build_dir, o.pub) as centos7: centos7.release = 'odoo.noarch.rpm' - centos7.system('rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm') + centos7.system('rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm') centos7.system('yum update -y && yum upgrade -y') centos7.system('yum install python-pip gcc python-devel -y') centos7.system('pip install pydot pyPdf vatnumber xlwt http://download.gna.org/pychart/PyChart-1.39.tar.gz') @@ -348,7 +367,6 @@ def options(): def main(): o = options() _prepare_build_dir(o) - try: if not o.no_tarball: build_tgz(o) @@ -364,7 +382,6 @@ def main(): try: test_deb(o) publish(o, ['odoo.deb', 'odoo.dsc', 'odoo_amd64.changes', 'odoo.deb.tar.gz']) - system('dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz', join(o.pub, 'deb')) except Exception, e: print("Won't publish the deb release.\n Exception: %s" % str(e)) if not o.no_rpm: @@ -386,7 +403,7 @@ def main(): except: pass finally: - for leftover in glob('%s/../openerp_*' % o.build_dir): + for leftover in glob('%s/../odoo_*' % o.build_dir): os.remove(leftover) shutil.rmtree(o.build_dir) |
