Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/config/, buildbot_gentoo_ci/steps/
Date: Sat, 27 Feb 2021 23:00:31
Message-Id: 1614466769.0db09acc4ba75ea8343465083d8e16d897708b47.zorry@gentoo
1 commit: 0db09acc4ba75ea8343465083d8e16d897708b47
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 27 22:59:29 2021 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 27 22:59:29 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=0db09acc
7
8 Move the steps that have with portage to do to portage
9
10 Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>
11
12 buildbot_gentoo_ci/config/buildfactorys.py | 6 +-
13 buildbot_gentoo_ci/steps/builders.py | 197 -----------------------------
14 buildbot_gentoo_ci/steps/portage.py | 197 +++++++++++++++++++++++++++++
15 3 files changed, 200 insertions(+), 200 deletions(-)
16
17 diff --git a/buildbot_gentoo_ci/config/buildfactorys.py b/buildbot_gentoo_ci/config/buildfactorys.py
18 index acafed8..b592541 100644
19 --- a/buildbot_gentoo_ci/config/buildfactorys.py
20 +++ b/buildbot_gentoo_ci/config/buildfactorys.py
21 @@ -106,15 +106,15 @@ def run_build_request():
22 #NOTE: pkgcheck do not support it as a dir
23 #f.addStep(buildbot_steps.MakeDirectory(dir="make.profile",
24 # workdir='/etc/portage/'))
25 - f.addStep(builders.SetMakeProfile())
26 + f.addStep(portage.SetMakeProfile())
27 # setup repos.conf dir
28 f.addStep(buildbot_steps.MakeDirectory(dir="repos.conf",
29 workdir='/etc/portage/'))
30 - f.addStep(builders.SetReposConf())
31 + f.addStep(portage.SetReposConf())
32 # update the repositorys listed in project_repository
33 f.addStep(builders.UpdateRepos())
34 # setup make.conf
35 - f.addStep(builders.SetMakeConf())
36 + f.addStep(portage.SetMakeConf())
37 # setup env
38 f.addStep(portage.SetEnvDefault())
39 # setup package.*
40
41 diff --git a/buildbot_gentoo_ci/steps/builders.py b/buildbot_gentoo_ci/steps/builders.py
42 index 3c19345..81d6e95 100644
43 --- a/buildbot_gentoo_ci/steps/builders.py
44 +++ b/buildbot_gentoo_ci/steps/builders.py
45 @@ -196,106 +196,6 @@ class SetupPropertys(BuildStep):
46 self.setProperty('cpv_build', False, 'cpv_build')
47 return SUCCESS
48
49 -class SetMakeProfile(BuildStep):
50 -
51 - name = 'SetMakeProfile'
52 - description = 'Running'
53 - descriptionDone = 'Ran'
54 - descriptionSuffix = None
55 - haltOnFailure = True
56 - flunkOnFailure = True
57 -
58 - def __init__(self, **kwargs):
59 - super().__init__(**kwargs)
60 -
61 - @defer.inlineCallbacks
62 - def run(self):
63 - self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
64 - portage_repos_path = self.getProperty('portage_repos_path')
65 - project_data = self.getProperty('project_data')
66 - profile_repository_data = yield self.gentooci.db.repositorys.getRepositoryByUuid(project_data['profile_repository_uuid'])
67 - makeprofiles_paths = []
68 - #NOTE: pkgcheck don't support make.profile as a dir
69 - # we only support one line in db
70 - makeprofiles_data = yield self.gentooci.db.projects.getAllProjectPortageByUuidAndDirectory(project_data['uuid'], 'make.profile')
71 - for makeprofile in makeprofiles_data:
72 - makeprofile_path = yield os.path.join(portage_repos_path, profile_repository_data['name'], 'profiles', makeprofile['value'], '')
73 - # makeprofiles_paths.append('../../..' + makeprofile_path)
74 - #separator = '\n'
75 - #makeprofile_path_string = separator.join(makeprofiles_paths)
76 - # yield self.build.addStepsAfterCurrentStep([
77 - # steps.StringDownload(makeprofile_path_string + separator,
78 - # workerdest="make.profile/parent",
79 - # workdir='/etc/portage/')
80 - # ])
81 - #NOTE: pkgcheck profile link
82 - shell_commad_list = [
83 - 'ln',
84 - '-s'
85 - ]
86 - shell_commad_list.append(makeprofile_path)
87 - shell_commad_list.append('/etc/portage/make.profile')
88 - yield self.build.addStepsAfterCurrentStep([
89 - steps.ShellCommandNewStyle(
90 - command=shell_commad_list,
91 - workdir='/'
92 - )
93 - ])
94 - return SUCCESS
95 -
96 -class SetReposConf(BuildStep):
97 -
98 - name = 'SetReposConf'
99 - description = 'Running'
100 - descriptionDone = 'Ran'
101 - descriptionSuffix = None
102 - haltOnFailure = True
103 - flunkOnFailure = True
104 -
105 - def __init__(self, **kwargs):
106 - super().__init__(**kwargs)
107 -
108 - @defer.inlineCallbacks
109 - def run(self):
110 - self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
111 - portage_repos_path = self.getProperty('portage_repos_path')
112 - project_data = self.getProperty('project_data')
113 - # setup the default.conf
114 - repos_conf_data = yield self.gentooci.db.projects.getProjectPortageByUuidAndDirectory(project_data['uuid'], 'repos.conf')
115 - if repos_conf_data is None:
116 - print('Default repo is not set in repos.conf')
117 - return FAILURE
118 - # check if repos_conf_data['value'] is vaild repo name
119 - separator = '\n'
120 - default_conf = []
121 - default_conf.append('[DEFAULT]')
122 - default_conf.append('main-repo = ' + repos_conf_data['value'])
123 - default_conf.append('auto-sync = no')
124 - default_conf_string = separator.join(default_conf)
125 - yield self.build.addStepsAfterCurrentStep([
126 - steps.StringDownload(default_conf_string + separator,
127 - workerdest="repos.conf/default.conf",
128 - workdir='/etc/portage/')
129 - ])
130 - # add all repos that project have in projects_repositorys to repos.conf/reponame.conf
131 - projects_repositorys_data = yield self.gentooci.db.projects.getRepositorysByProjectUuid(project_data['uuid'])
132 - for project_repository_data in projects_repositorys_data:
133 - repository_data = yield self.gentooci.db.repositorys.getRepositoryByUuid(project_repository_data['repository_uuid'])
134 - repository_path = yield os.path.join(portage_repos_path, repository_data['name'])
135 - repository_conf = []
136 - repository_conf.append('[' + repository_data['name'] + ']')
137 - repository_conf.append('location = ' + repository_path)
138 - repository_conf.append('sync-uri = ' + repository_data['mirror_url'])
139 - repository_conf.append('sync-type = git')
140 - repository_conf.append('auto-sync = no')
141 - repository_conf_string = separator.join(repository_conf)
142 - yield self.build.addStepsAfterCurrentStep([
143 - steps.StringDownload(repository_conf_string + separator,
144 - workerdest='repos.conf/' + repository_data['name'] + '.conf',
145 - workdir='/etc/portage/')
146 - ])
147 - return SUCCESS
148 -
149 class UpdateRepos(BuildStep):
150
151 name = 'UpdateRepos'
152 @@ -326,103 +226,6 @@ class UpdateRepos(BuildStep):
153 ])
154 return SUCCESS
155
156 -class SetMakeConf(BuildStep):
157 -
158 - name = 'SetMakeConf'
159 - description = 'Running'
160 - descriptionDone = 'Ran'
161 - descriptionSuffix = None
162 - haltOnFailure = True
163 - flunkOnFailure = True
164 -
165 - def __init__(self, **kwargs):
166 - super().__init__(**kwargs)
167 -
168 - @defer.inlineCallbacks
169 - def run(self):
170 - #FIXME: Make a dict before we pass it to the make.conf
171 - self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
172 - project_data = self.getProperty('project_data')
173 - makeconf_variables_data = yield self.gentooci.db.portages.getVariables()
174 - separator1 = '\n'
175 - separator2 = ' '
176 - makeconf_list = []
177 - for k in makeconf_variables_data:
178 - makeconf_variables_values_data = yield self.gentooci.db.projects.getProjectMakeConfById(project_data['uuid'], k['id'])
179 - makeconf_variable_list = []
180 - # we add some default values
181 - #FIXME:
182 - # we could set them in a config variables
183 - # FEATURES
184 - if k['variable'] == 'FEATURES':
185 - makeconf_variable_list.append('xattr')
186 - makeconf_variable_list.append('cgroup')
187 - makeconf_variable_list.append('-news')
188 - makeconf_variable_list.append('-collision-protect')
189 - # EMERGE_DEFAULT_OPTS
190 - if k['variable'] == 'EMERGE_DEFAULT_OPTS':
191 - makeconf_variable_list.append('--buildpkg=y')
192 - makeconf_variable_list.append('--rebuild-if-new-rev=y')
193 - makeconf_variable_list.append('--rebuilt-binaries=y')
194 - makeconf_variable_list.append('--usepkg=y')
195 - makeconf_variable_list.append('--binpkg-respect-use=y')
196 - makeconf_variable_list.append('--binpkg-changed-deps=y')
197 - makeconf_variable_list.append('--nospinner')
198 - makeconf_variable_list.append('--color=n')
199 - makeconf_variable_list.append('--ask=n')
200 - # CFLAGS
201 - if k['variable'] == 'CFLAGS' or k['variable'] == 'FCFLAGS':
202 - makeconf_variable_list.append('-O2')
203 - makeconf_variable_list.append('-pipe')
204 - makeconf_variable_list.append('-march=native')
205 - makeconf_variable_list.append('-fno-diagnostics-color')
206 - #FIXME:
207 - # Depend on worker we may have to add a diffrent march
208 - if k['variable'] == 'CXXFLAGS':
209 - makeconf_variable_list.append('${CFLAGS}')
210 - if k['variable'] == 'FFLAGS':
211 - makeconf_variable_list.append('${FCFLAGS}')
212 - if k['variable'] == 'ACCEPT_PROPERTIES':
213 - makeconf_variable_list.append('-interactive')
214 - if k['variable'] == 'ACCEPT_RESTRICT':
215 - makeconf_variable_list.append('-fetch')
216 - for v in makeconf_variables_values_data:
217 - if v['build_id'] == 0:
218 - makeconf_variable_list.append(v['value'])
219 - if k['variable'] == 'ACCEPT_LICENSE' and makeconf_variable_list != []:
220 - makeconf_variable_list.append('ACCEPT_LICENSE="*"')
221 - if makeconf_variable_list != []:
222 - makeconf_variable_string = k['variable'] + '="' + separator2.join(makeconf_variable_list) + '"'
223 - makeconf_list.append(makeconf_variable_string)
224 - # add hardcoded variables and values
225 - #FIXME:
226 - # we could set them in a config variables
227 - makeconf_list.append('LC_MESSAGES=C')
228 - makeconf_list.append('NOCOLOR="true"')
229 - makeconf_list.append('GCC_COLORS=""')
230 - makeconf_list.append('PORTAGE_TMPFS="/dev/shm"')
231 - makeconf_list.append('CLEAN_DELAY=0')
232 - makeconf_list.append('NOCOLOR=true')
233 - makeconf_list.append('PORT_LOGDIR="/var/cache/portage/logs"')
234 - makeconf_list.append('PKGDIR="/var/cache/portage/packages"')
235 - makeconf_list.append('PORTAGE_ELOG_CLASSES="qa"')
236 - makeconf_list.append('PORTAGE_ELOG_SYSTEM="save"')
237 - # add ACCEPT_KEYWORDS from the project_data info
238 - keyword_data = yield self.gentooci.db.keywords.getKeywordById(project_data['keyword_id'])
239 - if project_data['status'] == 'unstable':
240 - makeconf_keyword = '~' + keyword_data['name']
241 - else:
242 - makeconf_keyword = keyword_data['name']
243 - makeconf_list.append('ACCEPT_KEYWORDS="' + makeconf_keyword + '"')
244 - makeconf_string = separator1.join(makeconf_list)
245 - print(makeconf_string)
246 - yield self.build.addStepsAfterCurrentStep([
247 - steps.StringDownload(makeconf_string + separator1,
248 - workerdest="make.conf",
249 - workdir='/etc/portage/')
250 - ])
251 - return SUCCESS
252 -
253 class RunEmerge(BuildStep):
254
255 name = 'RunEmerge'
256
257 diff --git a/buildbot_gentoo_ci/steps/portage.py b/buildbot_gentoo_ci/steps/portage.py
258 index 52daf83..30361e6 100644
259 --- a/buildbot_gentoo_ci/steps/portage.py
260 +++ b/buildbot_gentoo_ci/steps/portage.py
261 @@ -11,6 +11,203 @@ from buildbot.process.results import SUCCESS
262 from buildbot.process.results import FAILURE
263 from buildbot.plugins import steps
264
265 +class SetMakeProfile(BuildStep):
266 +
267 + name = 'SetMakeProfile'
268 + description = 'Running'
269 + descriptionDone = 'Ran'
270 + descriptionSuffix = None
271 + haltOnFailure = True
272 + flunkOnFailure = True
273 +
274 + def __init__(self, **kwargs):
275 + super().__init__(**kwargs)
276 +
277 + @defer.inlineCallbacks
278 + def run(self):
279 + self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
280 + portage_repos_path = self.getProperty('portage_repos_path')
281 + project_data = self.getProperty('project_data')
282 + profile_repository_data = yield self.gentooci.db.repositorys.getRepositoryByUuid(project_data['profile_repository_uuid'])
283 + makeprofiles_paths = []
284 + #NOTE: pkgcheck don't support make.profile as a dir
285 + # we only support one line in db
286 + makeprofiles_data = yield self.gentooci.db.projects.getAllProjectPortageByUuidAndDirectory(project_data['uuid'], 'make.profile')
287 + for makeprofile in makeprofiles_data:
288 + makeprofile_path = yield os.path.join(portage_repos_path, profile_repository_data['name'], 'profiles', makeprofile['value'], '')
289 + # makeprofiles_paths.append('../../..' + makeprofile_path)
290 + #separator = '\n'
291 + #makeprofile_path_string = separator.join(makeprofiles_paths)
292 + # yield self.build.addStepsAfterCurrentStep([
293 + # steps.StringDownload(makeprofile_path_string + separator,
294 + # workerdest="make.profile/parent",
295 + # workdir='/etc/portage/')
296 + # ])
297 + #NOTE: pkgcheck profile link
298 + shell_commad_list = [
299 + 'ln',
300 + '-s'
301 + ]
302 + shell_commad_list.append(makeprofile_path)
303 + shell_commad_list.append('/etc/portage/make.profile')
304 + yield self.build.addStepsAfterCurrentStep([
305 + steps.ShellCommandNewStyle(
306 + command=shell_commad_list,
307 + workdir='/'
308 + )
309 + ])
310 + return SUCCESS
311 +
312 +class SetReposConf(BuildStep):
313 +
314 + name = 'SetReposConf'
315 + description = 'Running'
316 + descriptionDone = 'Ran'
317 + descriptionSuffix = None
318 + haltOnFailure = True
319 + flunkOnFailure = True
320 +
321 + def __init__(self, **kwargs):
322 + super().__init__(**kwargs)
323 +
324 + @defer.inlineCallbacks
325 + def run(self):
326 + self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
327 + portage_repos_path = self.getProperty('portage_repos_path')
328 + project_data = self.getProperty('project_data')
329 + # setup the default.conf
330 + repos_conf_data = yield self.gentooci.db.projects.getProjectPortageByUuidAndDirectory(project_data['uuid'], 'repos.conf')
331 + if repos_conf_data is None:
332 + print('Default repo is not set in repos.conf')
333 + return FAILURE
334 + # check if repos_conf_data['value'] is vaild repo name
335 + separator = '\n'
336 + default_conf = []
337 + default_conf.append('[DEFAULT]')
338 + default_conf.append('main-repo = ' + repos_conf_data['value'])
339 + default_conf.append('auto-sync = no')
340 + default_conf_string = separator.join(default_conf)
341 + yield self.build.addStepsAfterCurrentStep([
342 + steps.StringDownload(default_conf_string + separator,
343 + workerdest="repos.conf/default.conf",
344 + workdir='/etc/portage/')
345 + ])
346 + # add all repos that project have in projects_repositorys to repos.conf/reponame.conf
347 + projects_repositorys_data = yield self.gentooci.db.projects.getRepositorysByProjectUuid(project_data['uuid'])
348 + for project_repository_data in projects_repositorys_data:
349 + repository_data = yield self.gentooci.db.repositorys.getRepositoryByUuid(project_repository_data['repository_uuid'])
350 + repository_path = yield os.path.join(portage_repos_path, repository_data['name'])
351 + repository_conf = []
352 + repository_conf.append('[' + repository_data['name'] + ']')
353 + repository_conf.append('location = ' + repository_path)
354 + repository_conf.append('sync-uri = ' + repository_data['mirror_url'])
355 + repository_conf.append('sync-type = git')
356 + repository_conf.append('auto-sync = no')
357 + repository_conf_string = separator.join(repository_conf)
358 + yield self.build.addStepsAfterCurrentStep([
359 + steps.StringDownload(repository_conf_string + separator,
360 + workerdest='repos.conf/' + repository_data['name'] + '.conf',
361 + workdir='/etc/portage/')
362 + ])
363 + return SUCCESS
364 +
365 +class SetMakeConf(BuildStep):
366 +
367 + name = 'SetMakeConf'
368 + description = 'Running'
369 + descriptionDone = 'Ran'
370 + descriptionSuffix = None
371 + haltOnFailure = True
372 + flunkOnFailure = True
373 +
374 + def __init__(self, **kwargs):
375 + super().__init__(**kwargs)
376 +
377 + @defer.inlineCallbacks
378 + def run(self):
379 + #FIXME: Make a dict before we pass it to the make.conf
380 + self.gentooci = self.master.namedServices['services'].namedServices['gentooci']
381 + project_data = self.getProperty('project_data')
382 + makeconf_variables_data = yield self.gentooci.db.portages.getVariables()
383 + separator1 = '\n'
384 + separator2 = ' '
385 + makeconf_list = []
386 + for k in makeconf_variables_data:
387 + makeconf_variables_values_data = yield self.gentooci.db.projects.getProjectMakeConfById(project_data['uuid'], k['id'])
388 + makeconf_variable_list = []
389 + # we add some default values
390 + #FIXME:
391 + # we could set them in a config variables
392 + # FEATURES
393 + if k['variable'] == 'FEATURES':
394 + makeconf_variable_list.append('xattr')
395 + makeconf_variable_list.append('cgroup')
396 + makeconf_variable_list.append('-news')
397 + makeconf_variable_list.append('-collision-protect')
398 + # EMERGE_DEFAULT_OPTS
399 + if k['variable'] == 'EMERGE_DEFAULT_OPTS':
400 + makeconf_variable_list.append('--buildpkg=y')
401 + makeconf_variable_list.append('--rebuild-if-new-rev=y')
402 + makeconf_variable_list.append('--rebuilt-binaries=y')
403 + makeconf_variable_list.append('--usepkg=y')
404 + makeconf_variable_list.append('--binpkg-respect-use=y')
405 + makeconf_variable_list.append('--binpkg-changed-deps=y')
406 + makeconf_variable_list.append('--nospinner')
407 + makeconf_variable_list.append('--color=n')
408 + makeconf_variable_list.append('--ask=n')
409 + # CFLAGS
410 + if k['variable'] == 'CFLAGS' or k['variable'] == 'FCFLAGS':
411 + makeconf_variable_list.append('-O2')
412 + makeconf_variable_list.append('-pipe')
413 + makeconf_variable_list.append('-march=native')
414 + makeconf_variable_list.append('-fno-diagnostics-color')
415 + #FIXME:
416 + # Depend on worker we may have to add a diffrent march
417 + if k['variable'] == 'CXXFLAGS':
418 + makeconf_variable_list.append('${CFLAGS}')
419 + if k['variable'] == 'FFLAGS':
420 + makeconf_variable_list.append('${FCFLAGS}')
421 + if k['variable'] == 'ACCEPT_PROPERTIES':
422 + makeconf_variable_list.append('-interactive')
423 + if k['variable'] == 'ACCEPT_RESTRICT':
424 + makeconf_variable_list.append('-fetch')
425 + for v in makeconf_variables_values_data:
426 + if v['build_id'] == 0:
427 + makeconf_variable_list.append(v['value'])
428 + if k['variable'] == 'ACCEPT_LICENSE' and makeconf_variable_list != []:
429 + makeconf_variable_list.append('ACCEPT_LICENSE="*"')
430 + if makeconf_variable_list != []:
431 + makeconf_variable_string = k['variable'] + '="' + separator2.join(makeconf_variable_list) + '"'
432 + makeconf_list.append(makeconf_variable_string)
433 + # add hardcoded variables and values
434 + #FIXME:
435 + # we could set them in a config variables
436 + makeconf_list.append('LC_MESSAGES=C')
437 + makeconf_list.append('NOCOLOR="true"')
438 + makeconf_list.append('GCC_COLORS=""')
439 + makeconf_list.append('PORTAGE_TMPFS="/dev/shm"')
440 + makeconf_list.append('CLEAN_DELAY=0')
441 + makeconf_list.append('NOCOLOR=true')
442 + makeconf_list.append('PORT_LOGDIR="/var/cache/portage/logs"')
443 + makeconf_list.append('PKGDIR="/var/cache/portage/packages"')
444 + makeconf_list.append('PORTAGE_ELOG_CLASSES="qa"')
445 + makeconf_list.append('PORTAGE_ELOG_SYSTEM="save"')
446 + # add ACCEPT_KEYWORDS from the project_data info
447 + keyword_data = yield self.gentooci.db.keywords.getKeywordById(project_data['keyword_id'])
448 + if project_data['status'] == 'unstable':
449 + makeconf_keyword = '~' + keyword_data['name']
450 + else:
451 + makeconf_keyword = keyword_data['name']
452 + makeconf_list.append('ACCEPT_KEYWORDS="' + makeconf_keyword + '"')
453 + makeconf_string = separator1.join(makeconf_list)
454 + print(makeconf_string)
455 + yield self.build.addStepsAfterCurrentStep([
456 + steps.StringDownload(makeconf_string + separator1,
457 + workerdest="make.conf",
458 + workdir='/etc/portage/')
459 + ])
460 + return SUCCESS
461 +
462 class SetPackageDefault(BuildStep):
463
464 name = 'SetPackageDefault'