示例#1
0
 def _create_dockerfile(self):
     _logger.info('Generating dockerfile for build:%s...' % self.id)
     content = base64.b64decode(self.branch_id.os_id.dockerfile)
     package = self.branch_id.version_id.package_ids.filtered(
         lambda package: package.os_id == self.branch_id.os_id)
     localdict = {
         'required_packages':
         package.required_packages or '',
         'optional_packages':
         package.optional_packages or '',
         'specific_packages':
         self.branch_id.specific_packages or '',
         'pip_packages':
         self.branch_id.pip_packages or '',
         'flake_8_packages':
         self.env['ir.config_parameter'].get_param('ci.flake8.extensions'),
         'configfile':
         CONFIGFILE,
         'server_cmd':
         os.path.join(self.branch_id.server_path,
                      self.branch_id.version_id.server_cmd),
         'odoo_dir':
         self.branch_id.os_id.odoo_dir,
     }
     with cd(self.directory):
         with open(DOCKERFILE, 'w') as f:
             f.write(content % localdict)
示例#2
0
 def _create_configfile(self):
     _logger.info('Generating %s for build:%s...' % (CONFIGFILE, self.id))
     options = self._get_options()
     with cd(self.directory):
         with open(CONFIGFILE, 'w') as cfile:
             cfile.write('[options]\n')
             for k, v in options.iteritems():
                 cfile.write('%s = %s\n' % (k, v))
             if self.branch_id.additional_options:
                 cfile.write(self.branch_id.additional_options)
示例#3
0
 def _add_ci_addons(self):
     for adp in addons.module.ad_paths:
         ci_addons_path = os.path.join(adp, 'smile_ci/addons')
         if os.path.exists(ci_addons_path):
             break
     else:
         raise IOError("smile_ci/addons is not found")
     ignore_patterns = shutil.ignore_patterns(*IGNORE_PATTERNS)
     with cd(self.directory):
         mergetree(ci_addons_path, 'ci-addons', ignore=ignore_patterns)
示例#4
0
 def _get_revno(self):
     self.ensure_one()
     with cd(self.directory):
         vcs = self.vcs_id
         cmd_revno = vcs.cmd_revno % {'branch': self.branch}
         cmd = cmd_revno.split(' ')
         cmd.insert(0, vcs.cmd)
         revno = check_output_chain(cmd)
         if vcs == self.env.ref('smile_scm.svn'):
             revno = revno.split(' ')[0]
         elif vcs != self.env.ref('smile_scm.git'):
             revno = literal_eval(revno)
         return revno.replace('\n', '')
示例#5
0
 def _get_last_commits(self):
     self.ensure_one()
     with cd(self.directory):
         vcs = self.vcs_id
         last_revno = self.build_ids and self.build_ids[0].revno.encode(
             'utf8') or self._get_revno()
         # TODO: check that adding one to revision number is ok
         # FIXME: last_revno == '271:HEAD...'
         # if self.build_ids and self.build_ids[0].revno and vcs == self.env.ref('smile_scm.svn'):
         #     last_revno = str(int(last_revno) + 1)
         cmd_log = vcs.cmd_log % {'last_revno': last_revno}
         cmd = cmd_log.split(' ')
         cmd.insert(0, vcs.cmd)
         last_commits = check_output_chain(cmd)
         return last_commits