diff options
| author | Christophe Monniez <moc@odoo.com> | 2020-12-17 10:14:43 +0000 |
|---|---|---|
| committer | Christophe Monniez <moc@odoo.com> | 2020-12-18 12:25:10 +0000 |
| commit | 98797332149a78262710751c67e0b95da6075da0 (patch) | |
| tree | 7f65af5da568af614daa9647545c79ca4485408f /setup | |
| parent | c5cbb9975897935e9ed4e1bce80335207758fa24 (diff) | |
[FIX] packaging: create rpm repo from container
The createrepo Debian package is not available in Ubuntu anymore, this
can cause problems on Ubuntu based build systems.
In order to solve that once and for all, with this commit the rpm repo is
generated from a Docker container.
Fixes #63419
closes odoo/odoo#63580
X-original-commit: 8f5c5e585572facd8768e9f9dfc0de9e301f0c93
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Diffstat (limited to 'setup')
| -rw-r--r-- | setup/package.dffedora | 1 | ||||
| -rwxr-xr-x | setup/package.py | 40 |
2 files changed, 23 insertions, 18 deletions
diff --git a/setup/package.dffedora b/setup/package.dffedora index 6d9075f851d..c9abac48d17 100644 --- a/setup/package.dffedora +++ b/setup/package.dffedora @@ -7,6 +7,7 @@ MAINTAINER Odoo S.A. <info@odoo.com> RUN dnf update -d 0 -e 0 -y && \ dnf install -d 0 -e 0 \ babel \ + createrepo \ pychart \ pyparsing \ python3-babel \ diff --git a/setup/package.py b/setup/package.py index 5842e84278c..c4978f61e17 100755 --- a/setup/package.py +++ b/setup/package.py @@ -145,28 +145,14 @@ def gen_deb_package(args, published_files): # --------------------------------------------------------- # Generates an RPM repo # --------------------------------------------------------- -def gen_rpm_repo(args, file_name): +def rpm_sign(args, file_name): """Genereate a rpm repo in publish directory""" # Sign the RPM rpmsign = pexpect.spawn('/bin/bash', ['-c', 'rpm --resign %s' % file_name], cwd=os.path.join(args.pub, 'rpm')) - rpmsign.expect_exact('Enter pass phrase: ') + rpmsign.expect_exact('Enter passphrase: ') rpmsign.send(GPGPASSPHRASE + '\r\n') rpmsign.expect(pexpect.EOF) - # Removes the old repodata - shutil.rmtree(os.path.join(args.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') - shutil.copy(file_name, temp_path) - - run_cmd(['createrepo', temp_path]).check_returncode() # creates a repodata folder in temp_path - shutil.copytree(os.path.join(temp_path, "repodata"), os.path.join(args.pub, 'rpm', 'repodata')) - - # Remove temp directory - shutil.rmtree(temp_path) - def _prepare_build_dir(args, win32=False, move_addons=True): """Copy files to the build directory""" @@ -185,7 +171,7 @@ def _prepare_build_dir(args, win32=False, move_addons=True): except shutil.Error as e: logging.warning("Warning '%s' while moving addon '%s", e, addon_path) if addon_path.startswith(args.build_dir) and os.path.isdir(addon_path): - logging.info("Removing ''".format(addon_path)) + logging.info("Removing '{}'".format(addon_path)) try: shutil.rmtree(addon_path) except shutil.Error as rm_error: @@ -373,6 +359,21 @@ class DockerRpm(Docker): self.test_odoo() logging.info('Finished testing rpm package') + def gen_rpm_repo(self, args, rpm_filepath): + # Removes the old repodata + shutil.rmtree(os.path.join(args.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') + shutil.copy(rpm_filepath, temp_path) + + logging.info('Start creating rpm repo') + self.run('createrepo /data/src/', temp_path, 'odoo-rpm-createrepo-%s' % TSTAMP) + shutil.copytree(os.path.join(temp_path, "repodata"), os.path.join(args.pub, 'rpm', 'repodata')) + + # Remove temp directory + shutil.rmtree(temp_path) # KVM stuffs class KVM(object): @@ -539,7 +540,10 @@ def main(args): docker_rpm.start_test() published_files = publish(args, 'rpm', ['rpm']) if args.sign: - gen_rpm_repo(args, published_files[0]) + logging.info('Signing rpm package') + rpm_sign(args, published_files[0]) + logging.info('Generate rpm repo') + docker_rpm.gen_rpm_repo(args, published_files[0]) except Exception as e: logging.error("Won't publish the rpm release.\n Exception: %s" % str(e)) if args.build_deb: |
