diff options
Diffstat (limited to 'buildbot_gentoo_ci/steps/portage.py')
-rw-r--r-- | buildbot_gentoo_ci/steps/portage.py | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/buildbot_gentoo_ci/steps/portage.py b/buildbot_gentoo_ci/steps/portage.py index 6d838d7..74a8e37 100644 --- a/buildbot_gentoo_ci/steps/portage.py +++ b/buildbot_gentoo_ci/steps/portage.py @@ -35,6 +35,45 @@ def WriteTextToFile(path, text_list): yield f.write(separator) yield f.close +class SetPortageSettings(BuildStep): + + name = 'SetPortageSettings' + description = 'Running' + descriptionDone = 'Ran' + descriptionSuffix = None + haltOnFailure = True + flunkOnFailure = True + + def __init__(self, **kwargs): + super().__init__(**kwargs) + + @defer.inlineCallbacks + def run(self): + self.gentooci = self.master.namedServices['services'].namedServices['gentooci'] + portage_repos_path = self.getProperty('portage_repos_path') + project_data = self.getProperty('project_data') + settings_repository_data = yield self.gentooci.db.repositorys.getRepositoryByUuid(project_data['settings_repository_uuid']) + portagesetting_path = yield os.path.join(portage_repos_path, settings_repository_data['name'], 'Project', project_data['uuid'], 'portage') + shell_commad_list = [ + 'ln', + '-s' + ] + if self.getProperty('rootworkdir'): + symlink_portage_path = yield os.path.join(self.getProperty('rootworkdir'), 'etc/portage') + else: + symlink_portage_path = '/etc/portage' + shell_commad_list.append(portagesetting_path) + shell_commad_list.append(symlink_portage_path) + yield self.build.addStepsAfterCurrentStep([ + steps.ShellCommand( + command=shell_commad_list, + workdir='/' + ) + ]) + log = yield self.addLog('Portage setting') + yield log.addStdout('Portage setting path: ' + portagesetting_path + '\n') + return SUCCESS + class SetMakeProfile(BuildStep): name = 'SetMakeProfile' @@ -162,9 +201,9 @@ class SetReposConf(BuildStep): yield self.build.addStepsAfterCurrentStep(self.aftersteps_list) return SUCCESS -class SetMakeConf(BuildStep): +class SetHostConf(BuildStep): - name = 'SetMakeConf' + name = 'SetHostConf' description = 'Running' descriptionDone = 'Ran' descriptionSuffix = None @@ -188,55 +227,13 @@ class SetMakeConf(BuildStep): separator1 = '\n' separator2 = ' ' makeconf_list = [] - log = yield self.addLog('make.conf') - for k in makeconf_variables_data: - makeconf_variables_values_data = yield self.gentooci.db.projects.getProjectMakeConfById(project_data['uuid'], k['id']) - makeconf_variable_list = [] - # CFLAGS - if k['variable'] == 'CFLAGS' or k['variable'] == 'FCFLAGS': - makeconf_variable_list.append('-O2') - makeconf_variable_list.append('-pipe') - makeconf_variable_list.append('-fno-diagnostics-color') - #FIXME: - # Depend on worker we may have to add a diffrent march - makeconf_variable_list.append('-march=native') - if k['variable'] == 'CXXFLAGS': - makeconf_variable_list.append('${CFLAGS}') - if k['variable'] == 'FFLAGS': - makeconf_variable_list.append('${FCFLAGS}') - # Add default setting if use_default - if project_data['use_default']: - default_project_data = yield self.gentooci.db.projects.getProjectByName(self.gentooci.config.project['project']['update_db']) - default_makeconf_variables_values_data = yield self.gentooci.db.projects.getProjectMakeConfById(default_project_data['uuid'], k['id']) - for v in default_makeconf_variables_values_data: - if v['build_id'] == 0: - makeconf_variable_list.append(v['value']) - for v in makeconf_variables_values_data: - if v['build_id'] == 0: - makeconf_variable_list.append(v['value']) - #NOTE: set it by project - #if k['variable'] == 'ACCEPT_LICENSE' and makeconf_variable_list != []: - # makeconf_variable_list.append('ACCEPT_LICENSE="*"') - if makeconf_variable_list != []: - makeconf_variable_string = k['variable'] + '="' + separator2.join(makeconf_variable_list) + '"' - makeconf_list.append(makeconf_variable_string) - # add hardcoded variables from config file - config_makeconfig = self.gentooci.config.project['project']['config_makeconfig'] - for v in config_makeconfig: - makeconf_list.append(v) - # add ACCEPT_KEYWORDS from the project_data info - keyword_data = yield self.gentooci.db.keywords.getKeywordById(project_data['keyword_id']) - if project_data['status'] == 'unstable': - makeconf_keyword = '~' + keyword_data['name'] - else: - makeconf_keyword = keyword_data['name'] - makeconf_list.append('ACCEPT_KEYWORDS="' + makeconf_keyword + '"') + log = yield self.addLog('host.conf') makeconf_list.append('MAKEOPTS="-j14"') makeconf_string = separator1.join(makeconf_list) print(makeconf_string) yield self.build.addStepsAfterCurrentStep([ steps.StringDownload(makeconf_string + separator1, - workerdest="make.conf", + workerdest="host.conf", workdir=portage_etc_path) ]) # display the make.conf |