From cc11331733a5cb8aff6c7f0d4def1404e83b80e8 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 21 Nov 2014 13:40:17 +0100 Subject: [FIX] Packaging: allow publishing releases in --no-testing --- setup/package.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index 7f90c5cea9c..7040f38824f 100755 --- a/setup/package.py +++ b/setup/package.py @@ -370,36 +370,36 @@ def main(): try: if not o.no_tarball: build_tgz(o) - if not o.no_testing: - try: + try: + if not o.no_testing: test_tgz(o) - publish(o, 'odoo.tar.gz') - except Exception, e: - print("Won't publish the tgz release.\n Exception: %s" % str(e)) + publish(o, 'odoo.tar.gz') + except Exception, e: + print("Won't publish the tgz release.\n Exception: %s" % str(e)) if not o.no_debian: build_deb(o) - if not o.no_testing: - try: + try: + if not o.no_testing: test_deb(o) - publish(o, ['odoo.deb', 'odoo.dsc', 'odoo_amd64.changes', 'odoo.deb.tar.gz']) - except Exception, e: - print("Won't publish the deb release.\n Exception: %s" % str(e)) + publish(o, ['odoo.deb', 'odoo.dsc', 'odoo_amd64.changes', 'odoo.deb.tar.gz']) + except Exception, e: + print("Won't publish the deb release.\n Exception: %s" % str(e)) if not o.no_rpm: build_rpm(o) - if not o.no_testing: - try: + try: + if not o.no_testing: test_rpm(o) - publish(o, ['odoo.noarch.rpm', 'odoo.src.rpm']) - except Exception, e: - print("Won't publish the rpm release.\n Exception: %s" % str(e)) + publish(o, ['odoo.noarch.rpm', 'odoo.src.rpm']) + except Exception, e: + print("Won't publish the rpm release.\n Exception: %s" % str(e)) if not o.no_windows: build_exe(o) - if not o.no_testing: - try: + try: + if not o.no_testing: test_exe(o) - publish(o, 'odoo.exe') - except Exception, e: - print("Won't publish the exe release.\n Exception: %s" % str(e)) + publish(o, 'odoo.exe') + except Exception, e: + print("Won't publish the exe release.\n Exception: %s" % str(e)) except: pass finally: -- cgit v1.2.3 From 1c41f3699303da770797002025b7c8226fb562eb Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 24 Nov 2014 16:24:46 +0100 Subject: [IMP] Packaging: Debian: sign packages with gpg key --- setup/package.py | 63 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 13 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index 7040f38824f..a1330261ecb 100755 --- a/setup/package.py +++ b/setup/package.py @@ -41,7 +41,7 @@ from tempfile import NamedTemporaryFile execfile(join(dirname(__file__), '..', 'openerp', 'release.py')) version = version.split('-')[0] -timestamp = time.strftime("%Y%m%d-%H%M%S", time.gmtime()) +timestamp = time.strftime("%Y%m%d", time.gmtime()) PUBLISH_DIRS = { 'tar.gz': 'src', 'exe': 'exe', @@ -96,19 +96,18 @@ def publish(o, releases): release_extension = PUBLISH_DIRS[extension][1] if isinstance(PUBLISH_DIRS[extension], list) else extension release_dir = PUBLISH_DIRS[extension][0] if isinstance(PUBLISH_DIRS[extension], list) else PUBLISH_DIRS[extension] - release_filename = 'odoo_%s-%s.%s' % (version, timestamp, release_extension) + arch = "" + if release_extension == 'deb': + arch = "_all" + elif release_extension == "changes": + arch = "_amd64" + + release_filename = 'odoo_%s.%s%s.%s' % (version, timestamp, arch, release_extension) release_path = join(o.pub, release_dir, release_filename) 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') @@ -118,11 +117,15 @@ def publish(o, releases): os.symlink(release_abspath, latest_abspath) + return release_path + + published = [] if isinstance(releases, basestring): - _publish(o, releases) + published.append(_publish(o, releases)) elif isinstance(releases, list): for release in releases: - _publish(o, release) + published.append(_publish(o, release)) + return published class OdooDocker(object): def __init__(self): @@ -257,7 +260,7 @@ def build_tgz(o): system(['cp', glob('%s/dist/openerp-*.tar.gz' % o.build_dir)[0], '%s/odoo.tar.gz' % o.build_dir]) def build_deb(o): - system(['dpkg-buildpackage', '-rfakeroot', '-uc', '-us'], o.build_dir) + system(['dpkg-buildpackage', '-rfakeroot'], 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]) @@ -331,6 +334,38 @@ def test_rpm(o): def test_exe(o): KVMWinTestExe(o, o.vm_winxp_image, o.vm_winxp_ssh_key, o.vm_winxp_login).start() +#--------------------------------------------------------- +# Generates Packages, Sources and Release files of debian package +#--------------------------------------------------------- +def gen_deb_package(o, published_files): + # Executes command to produce file_name in path, and moves it to o.pub/deb + def _gen_file(o, (command, file_name), path): + cur_tmp_file_path = os.path.join(path, file_name) + with open(cur_tmp_file_path, 'w') as out: + subprocess.call(command, stdout=out, cwd=path) + system(['cp', cur_tmp_file_path, os.path.join(o.pub, 'deb', file_name)]) + + # Copy files to a temp directory (required because the working directory must contain only the files of the last release) + temp_path = tempfile.mkdtemp(suffix='debPackages') + for pub_file_path in published_files: + system(['cp', pub_file_path, temp_path]) + + commands = [ + (['dpkg-scanpackages', '.'], "Packages"), # Generate Packages file + (['dpkg-scansources', '.'], "Sources"), # Generate Sources file + (['apt-ftparchive', 'release', '.'], "Release") # Generate Release file + ] + # Generate files + for command in commands: + _gen_file(o, command, temp_path) + # Remove temp directory + shutil.rmtree(temp_path) + + # Generate Release.gpg (= signed Release) + # Options -abs: -a (Create ASCII armored output), -b (Make a detach signature), -s (Make a signature) + subprocess.call(['rm', 'Release.gpg'], cwd=os.path.join(o.pub, 'deb')) + subprocess.call(['gpg', '-abs', '-o', 'Release.gpg', 'Release'], cwd=os.path.join(o.pub, 'deb')) + #---------------------------------------------------------- # Options and Main #---------------------------------------------------------- @@ -362,6 +397,7 @@ def options(): o.version_full = '%s-%s' % (o.version, timestamp) o.work = join(o.build_dir, 'openerp-%s' % o.version_full) o.work_addons = join(o.work, 'openerp', 'addons') + return o def main(): @@ -381,7 +417,8 @@ def main(): try: if not o.no_testing: test_deb(o) - publish(o, ['odoo.deb', 'odoo.dsc', 'odoo_amd64.changes', 'odoo.deb.tar.gz']) + published_files = publish(o, ['odoo.deb', 'odoo.dsc', 'odoo_amd64.changes', 'odoo.deb.tar.gz']) + gen_deb_package(o, published_files) except Exception, e: print("Won't publish the deb release.\n Exception: %s" % str(e)) if not o.no_rpm: -- cgit v1.2.3 From 50a4da99f051d125b8435477657ee2b115a8e0bd Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Tue, 25 Nov 2014 12:25:01 +0100 Subject: [FIX] Packaging: better filename handling Allow to 1) avoid a special case for debian packages in _publish function 2) publish debian packages with correct filename (ie keeping _amd64, _all) --- setup/package.py | 92 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 39 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index a1330261ecb..f8a90555e59 100755 --- a/setup/package.py +++ b/setup/package.py @@ -43,15 +43,19 @@ version = version.split('-')[0] timestamp = time.strftime("%Y%m%d", time.gmtime()) PUBLISH_DIRS = { - 'tar.gz': 'src', - 'exe': 'exe', - 'deb': 'deb', - 'dsc': 'deb', - 'changes': 'deb', - 'deb.tar.gz': ['deb', 'tar.gz'], - 'noarch.rpm': 'rpm', - 'src.rpm': 'rpm', + 'debian': 'deb', + 'redhat': 'rpm', + 'tarball': 'src', + 'windows': 'exe', } +EXTENSIONS = [ + '.tar.gz', + '.deb', + '.dsc', + '.changes', + '.noarch.rpm', + '.exe', +] def mkdir(d): if not os.path.isdir(d): @@ -90,19 +94,26 @@ def _rpc_count_modules(addr='http://127.0.0.1', port=8069, dbname='mycompany'): print("Package test: FAILED. Not able to install base.") raise Exception("Installation of package failed") -def publish(o, releases): +def publish(o, type, releases): def _publish(o, release): - extension = ''.join(release.split('.', 1)[1]) - release_extension = PUBLISH_DIRS[extension][1] if isinstance(PUBLISH_DIRS[extension], list) else extension - release_dir = PUBLISH_DIRS[extension][0] if isinstance(PUBLISH_DIRS[extension], list) else PUBLISH_DIRS[extension] - - arch = "" - if release_extension == 'deb': - arch = "_all" - elif release_extension == "changes": - arch = "_amd64" - - release_filename = 'odoo_%s.%s%s.%s' % (version, timestamp, arch, release_extension) + arch = '' + filename = release.split(os.path.sep)[-1] + + extension = None + for EXTENSION in EXTENSIONS: + if filename.endswith(EXTENSION): + extension = EXTENSION + filename = filename.replace(extension, '') + break + if extension is None: + raise Exception("Extension of %s is not handled" % filename) + + # keep _all or _amd64 + if filename.count('_') > 1: + arch = '_' + filename.split('_')[-1] + + release_dir = PUBLISH_DIRS[type] + release_filename = 'odoo_%s.%s%s%s' % (version, timestamp, arch, extension) release_path = join(o.pub, release_dir, release_filename) system('mkdir -p %s' % join(o.pub, release_dir)) @@ -261,10 +272,10 @@ def build_tgz(o): def build_deb(o): system(['dpkg-buildpackage', '-rfakeroot'], 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]) + system(['mv', glob('%s/../odoo_*.deb' % o.build_dir)[0], '%s' % o.build_dir]) + system(['mv', glob('%s/../odoo_*.dsc' % o.build_dir)[0], '%s' % o.build_dir]) + system(['mv', glob('%s/../odoo_*_amd64.changes' % o.build_dir)[0], '%s' % o.build_dir]) + system(['mv', glob('%s/../odoo_*.tar.gz' % o.build_dir)[0], '%s' % o.build_dir]) def build_rpm(o): system(['python2', 'setup.py', '--quiet', 'bdist_rpm'], o.build_dir) @@ -298,7 +309,7 @@ def test_tgz(o): def test_deb(o): with docker('debian:stable', o.build_dir, o.pub) as wheezy: - wheezy.release = 'odoo.deb' + 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") @@ -345,16 +356,17 @@ def gen_deb_package(o, published_files): subprocess.call(command, stdout=out, cwd=path) system(['cp', cur_tmp_file_path, os.path.join(o.pub, 'deb', file_name)]) - # Copy files to a temp directory (required because the working directory must contain only the files of the last release) + # Copy files to a temp directory (required because the working directory must contain only the + # files of the last release) temp_path = tempfile.mkdtemp(suffix='debPackages') for pub_file_path in published_files: system(['cp', pub_file_path, temp_path]) commands = [ - (['dpkg-scanpackages', '.'], "Packages"), # Generate Packages file - (['dpkg-scansources', '.'], "Sources"), # Generate Sources file - (['apt-ftparchive', 'release', '.'], "Release") # Generate Release file - ] + (['dpkg-scanpackages', '.'], "Packages"), # Generate Packages file + (['dpkg-scansources', '.'], "Sources"), # Generate Sources file + (['apt-ftparchive', 'release', '.'], "Release") # Generate Release file + ] # Generate files for command in commands: _gen_file(o, command, temp_path) @@ -363,8 +375,7 @@ def gen_deb_package(o, published_files): # Generate Release.gpg (= signed Release) # Options -abs: -a (Create ASCII armored output), -b (Make a detach signature), -s (Make a signature) - subprocess.call(['rm', 'Release.gpg'], cwd=os.path.join(o.pub, 'deb')) - subprocess.call(['gpg', '-abs', '-o', 'Release.gpg', 'Release'], cwd=os.path.join(o.pub, 'deb')) + subprocess.call(['gpg', '--yes', '-abs', '-o', 'Release.gpg', 'Release'], cwd=os.path.join(o.pub, 'deb')) #---------------------------------------------------------- # Options and Main @@ -409,7 +420,7 @@ def main(): try: if not o.no_testing: test_tgz(o) - publish(o, 'odoo.tar.gz') + published_files = publish(o, 'tarball', ['odoo.tar.gz']) except Exception, e: print("Won't publish the tgz release.\n Exception: %s" % str(e)) if not o.no_debian: @@ -417,7 +428,13 @@ def main(): try: if not o.no_testing: test_deb(o) - published_files = publish(o, ['odoo.deb', 'odoo.dsc', 'odoo_amd64.changes', 'odoo.deb.tar.gz']) + + to_publish = [] + to_publish.append(glob("%s/odoo_*.deb" % o.build_dir)[0]) + to_publish.append(glob("%s/odoo_*.dsc" % o.build_dir)[0]) + to_publish.append(glob("%s/odoo_*.changes" % o.build_dir)[0]) + to_publish.append(glob("%s/odoo_*.tar.gz" % o.build_dir)[0]) + published_files = publish(o, 'debian', to_publish) gen_deb_package(o, published_files) except Exception, e: print("Won't publish the deb release.\n Exception: %s" % str(e)) @@ -426,7 +443,7 @@ def main(): try: if not o.no_testing: test_rpm(o) - publish(o, ['odoo.noarch.rpm', 'odoo.src.rpm']) + published_files = publish(o, 'redhat', ['odoo.noarch.rpm']) except Exception, e: print("Won't publish the rpm release.\n Exception: %s" % str(e)) if not o.no_windows: @@ -434,15 +451,12 @@ def main(): try: if not o.no_testing: test_exe(o) - publish(o, 'odoo.exe') + published_files = publish(o, 'windows', ['odoo.exe']) except Exception, e: print("Won't publish the exe release.\n Exception: %s" % str(e)) except: pass finally: - for leftover in glob('%s/../odoo_*' % o.build_dir): - os.remove(leftover) - shutil.rmtree(o.build_dir) print('Build dir %s removed' % o.build_dir) -- cgit v1.2.3 From be96dd85959528b86f7535b9b4cc0dc86981ca33 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 26 Nov 2014 14:08:05 +0100 Subject: [FIX] Packaging: RedHat: install in /usr and add systemd unit file By default, the package was installed in /usr/local/lib/python2.7 in CentOS7. It is problematic because most of other python packages are installed in /usr/lib and also because /usr/local/lib is not in the default PYTHONPATH. It's fixed by overriding the install script and forcing prefix to be /usr. Added a minimal systemd unitfile. Adapted tests accordingly. --- setup/package.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index f8a90555e59..ec95448bcf6 100755 --- a/setup/package.py +++ b/setup/package.py @@ -324,21 +324,23 @@ 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-2.noarch.rpm') - centos7.system('yum update -y && yum upgrade -y') - centos7.system('yum install python-pip gcc python-devel -y') + # Dependencies + centos7.system('yum install -d 0 -e 0 epel-release -y') + centos7.system('yum update -d 0 -e 0 -y') + centos7.system('yum install -d 0 -e 0 python-pip gcc python-devel -y') centos7.system('pip install pydot pyPdf vatnumber xlwt http://download.gna.org/pychart/PyChart-1.39.tar.gz') - centos7.system('yum install postgresql postgresql-server postgresql-libs postgresql-contrib postgresql-devel -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') 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"') - centos7.system('export PYTHONPATH=${PYTHONPATH}:/usr/local/lib/python2.7/dist-packages') - centos7.system('su postgres -c "createdb mycompany"') - centos7.system('yum install /opt/release/%s -y' % centos7.release) + # Odoo install + centos7.system('yum install -d 0 -e 0 /opt/release/%s -y' % centos7.release) centos7.system('su odoo -s /bin/bash -c "openerp-server -c /etc/odoo/openerp-server.conf -d mycompany -i base --stop-after-init"') centos7.system('su odoo -s /bin/bash -c "openerp-server -c /etc/odoo/openerp-server.conf -d mycompany &"') -- cgit v1.2.3 From 56b61da16387e642130477e604022207a77e3f74 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 26 Nov 2014 15:53:36 +0100 Subject: [FIX] Packaging: RedHat: dependencies management PyChart is now in the EPEL repo so we now list it as required in setup.cfg. The other mandatory lib not provided by EPEL are pyPdf, vatnumber and pydot and are now installed by easy_install during the post install. --- setup/package.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index ec95448bcf6..f803c688676 100755 --- a/setup/package.py +++ b/setup/package.py @@ -327,8 +327,6 @@ def test_rpm(o): # Dependencies centos7.system('yum install -d 0 -e 0 epel-release -y') centos7.system('yum update -d 0 -e 0 -y') - centos7.system('yum install -d 0 -e 0 python-pip gcc python-devel -y') - centos7.system('pip install pydot pyPdf vatnumber xlwt http://download.gna.org/pychart/PyChart-1.39.tar.gz') # 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') -- cgit v1.2.3 From e874cdafaa9675251cd7852b8e9b1662cee7d19a Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 26 Nov 2014 17:45:39 +0100 Subject: [IMP] Packaging: RedHat: sign packages with gpg key --- setup/package.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index f803c688676..c4f2f48458f 100755 --- a/setup/package.py +++ b/setup/package.py @@ -377,6 +377,27 @@ def gen_deb_package(o, published_files): # Options -abs: -a (Create ASCII armored output), -b (Make a detach signature), -s (Make a signature) subprocess.call(['gpg', '--yes', '-abs', '-o', 'Release.gpg', 'Release'], cwd=os.path.join(o.pub, 'deb')) +#--------------------------------------------------------- +# Generates an RPM repo +#--------------------------------------------------------- +def gen_rpm_repo(o, file_name): + # Sign the RPM + subprocess.call(['rpm', '--resign', file_name], cwd=os.path.join(o.pub, 'rpm')) + + # Removes the old repodata + subprocess.call(['rm', '-rf', os.path.join(o.pub, 'rpm', 'repodata')]) + + # Copy files to a temp directory (required because the working directory must contain only the + # files of the last release) + temp_path = tempfile.mkdtemp(suffix='rpmPackages') + subprocess.call(['cp', file_name, temp_path]) + + subprocess.call(['createrepo', temp_path]) # creates a repodata folder in temp_path + subprocess.call(['cp', '-r', os.path.join(temp_path, "repodata"), os.path.join(o.pub, 'rpm')]) + + # Remove temp directory + shutil.rmtree(temp_path) + #---------------------------------------------------------- # Options and Main #---------------------------------------------------------- @@ -444,6 +465,7 @@ def main(): if not o.no_testing: test_rpm(o) published_files = publish(o, 'redhat', ['odoo.noarch.rpm']) + gen_rpm_repo(o, published_files[0]) except Exception, e: print("Won't publish the rpm release.\n Exception: %s" % str(e)) if not o.no_windows: -- cgit v1.2.3 From d26a354c99565e4954f7e7f49af089f2c7c092b0 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 26 Nov 2014 21:42:24 +0100 Subject: [FIX] Packaging: lib name from openerp to odoo It's about time --- setup/package.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index c4f2f48458f..bf109ace223 100755 --- a/setup/package.py +++ b/setup/package.py @@ -268,7 +268,7 @@ def _prepare_build_dir(o): def build_tgz(o): system(['python2', 'setup.py', '--quiet', 'sdist'], o.build_dir) - system(['cp', glob('%s/dist/openerp-*.tar.gz' % o.build_dir)[0], '%s/odoo.tar.gz' % o.build_dir]) + system(['cp', glob('%s/dist/odoo-*.tar.gz' % o.build_dir)[0], '%s/odoo.tar.gz' % o.build_dir]) def build_deb(o): system(['dpkg-buildpackage', '-rfakeroot'], o.build_dir) @@ -279,8 +279,7 @@ def build_deb(o): def build_rpm(o): system(['python2', 'setup.py', '--quiet', 'bdist_rpm'], o.build_dir) - system(['cp', glob('%s/dist/openerp-*.noarch.rpm' % o.build_dir)[0], '%s/odoo.noarch.rpm' % o.build_dir]) - system(['cp', glob('%s/dist/openerp-*.src.rpm' % o.build_dir)[0], '%s/odoo.src.rpm' % o.build_dir]) + system(['cp', glob('%s/dist/odoo-*.noarch.rpm' % o.build_dir)[0], '%s/odoo.noarch.rpm' % o.build_dir]) def build_exe(o): KVMWinBuildExe(o, o.vm_winxp_image, o.vm_winxp_ssh_key, o.vm_winxp_login).start() -- cgit v1.2.3 From b0722d3e5d6bebdf19dc29b8ba04651ae508839f Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 27 Nov 2014 14:29:43 +0100 Subject: [FIX] Packaging: batch the signing procedure --- setup/package.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'setup/package.py') diff --git a/setup/package.py b/setup/package.py index bf109ace223..3047be9dc64 100755 --- a/setup/package.py +++ b/setup/package.py @@ -32,6 +32,7 @@ import xmlrpclib from contextlib import contextmanager from glob import glob from os.path import abspath, dirname, join +from sys import stdout from tempfile import NamedTemporaryFile @@ -40,7 +41,8 @@ from tempfile import NamedTemporaryFile #---------------------------------------------------------- execfile(join(dirname(__file__), '..', 'openerp', 'release.py')) version = version.split('-')[0] - +GPGPASSPHRASE = os.getenv('GPGPASSPHRASE') +GPGID = os.getenv('GPGID') timestamp = time.strftime("%Y%m%d", time.gmtime()) PUBLISH_DIRS = { 'debian': 'deb', @@ -271,7 +273,13 @@ def build_tgz(o): system(['cp', glob('%s/dist/odoo-*.tar.gz' % o.build_dir)[0], '%s/odoo.tar.gz' % o.build_dir]) def build_deb(o): - system(['dpkg-buildpackage', '-rfakeroot'], o.build_dir) + deb = pexpect.spawn('dpkg-buildpackage -rfakeroot -k%s' % GPGID, cwd=o.build_dir) + deb.logfile = stdout + deb.expect_exact('Enter passphrase: ', timeout=1200) + deb.send(GPGPASSPHRASE + '\r\n') + deb.expect_exact('Enter passphrase: ') + deb.send(GPGPASSPHRASE + '\r\n') + deb.expect(pexpect.EOF) system(['mv', glob('%s/../odoo_*.deb' % o.build_dir)[0], '%s' % o.build_dir]) system(['mv', glob('%s/../odoo_*.dsc' % o.build_dir)[0], '%s' % o.build_dir]) system(['mv', glob('%s/../odoo_*_amd64.changes' % o.build_dir)[0], '%s' % o.build_dir]) @@ -374,14 +382,17 @@ def gen_deb_package(o, published_files): # Generate Release.gpg (= signed Release) # Options -abs: -a (Create ASCII armored output), -b (Make a detach signature), -s (Make a signature) - subprocess.call(['gpg', '--yes', '-abs', '-o', 'Release.gpg', 'Release'], cwd=os.path.join(o.pub, 'deb')) + subprocess.call(['gpg', '--default-key', GPGID, '--passphrase', GPGPASSPHRASE, '--yes', '-abs', '--no-tty', '-o', 'Release.gpg', 'Release'], cwd=os.path.join(o.pub, 'deb')) #--------------------------------------------------------- # Generates an RPM repo #--------------------------------------------------------- def gen_rpm_repo(o, file_name): # Sign the RPM - subprocess.call(['rpm', '--resign', file_name], cwd=os.path.join(o.pub, 'rpm')) + rpmsign = pexpect.spawn('/bin/bash', ['-c', 'rpm --resign %s' % file_name], cwd=os.path.join(o.pub, 'rpm')) + rpmsign.expect_exact('Enter pass phrase: ') + rpmsign.send(GPGPASSPHRASE + '\r\n') + rpmsign.expect(pexpect.EOF) # Removes the old repodata subprocess.call(['rm', '-rf', os.path.join(o.pub, 'rpm', 'repodata')]) -- cgit v1.2.3