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/db/, buildbot_gentoo_ci/config/, buildbot_gentoo_ci/steps/
Date: Sun, 07 Feb 2021 09:00:59
Message-Id: 1612688473.080b3d481d7e239a941ae866d804cef49df537c5.zorry@gentoo
1 commit: 080b3d481d7e239a941ae866d804cef49df537c5
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 7 09:01:13 2021 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 7 09:01:13 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=080b3d48
7
8 Add run pretend on packages update on worker
9
10 Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>
11
12 buildbot_gentoo_ci/config/buildfactorys.py | 35 +++++++++++++++++++
13 buildbot_gentoo_ci/db/model.py | 2 +-
14 buildbot_gentoo_ci/steps/builders.py | 54 +++++++++++++++++++++++++++++-
15 buildbot_gentoo_ci/steps/update_db.py | 2 +-
16 4 files changed, 90 insertions(+), 3 deletions(-)
17
18 diff --git a/buildbot_gentoo_ci/config/buildfactorys.py b/buildbot_gentoo_ci/config/buildfactorys.py
19 index 861a4e1..2916847 100644
20 --- a/buildbot_gentoo_ci/config/buildfactorys.py
21 +++ b/buildbot_gentoo_ci/config/buildfactorys.py
22 @@ -108,4 +108,39 @@ def run_build_request():
23 f.addStep(builders.UpdateRepos())
24 # setup make.conf
25 f.addStep(builders.SetMakeConf())
26 + # setup package.*
27 + #f.addStep(portages.SetPackageUse())
28 + # setup env
29 + # setup files in /etc if needed
30 + # run --regen if needed on repo
31 + # update packages before any tests
32 + # run pretend on packages update on worker
33 + shell_commad_list = [
34 + 'emerge',
35 + '-uDNv',
36 + '--changed-deps',
37 + '--changed-use',
38 + '--pretend',
39 + '@world'
40 + ]
41 + f.addStep(buildbot_steps.SetPropertyFromCommandNewStyle(
42 + command=shell_commad_list,
43 + strip=True,
44 + extract_fn=builders.PersOutputOfEmerge,
45 + workdir='/'
46 + ))
47 + # look at the log to see if we need to do stuff
48 + # run update package on worker
49 + # check log
50 + # run pretend @preserved-rebuild if needed
51 + # look at the log to see if we need to do stuff
52 + # run @preserved-rebuild
53 + # check log
54 + # run depclean if set
55 + # depclean pretend
56 + # look at the log to see if we need to do stuff
57 + # depclean
58 + # check log
59 + # setup make.conf if build id has changes make.conf as dict from SetMakeConf
60 + # setup package.* env if build id has changes
61 return f
62
63 diff --git a/buildbot_gentoo_ci/db/model.py b/buildbot_gentoo_ci/db/model.py
64 index bd111be..4c5e04c 100644
65 --- a/buildbot_gentoo_ci/db/model.py
66 +++ b/buildbot_gentoo_ci/db/model.py
67 @@ -216,7 +216,7 @@ class Model(base.DBConnectorComponent):
68 # project's name
69 sa.Column('keyword_id', sa.Integer,
70 sa.ForeignKey('keywords.id', ondelete='CASCADE')),
71 - sa.Column('versions_uuid', sa.String(36),
72 + sa.Column('version_uuid', sa.String(36),
73 sa.ForeignKey('versions.uuid', ondelete='CASCADE')),
74 sa.Column('status', sa.Enum('stable','unstable','negative','all'), nullable=False),
75 )
76
77 diff --git a/buildbot_gentoo_ci/steps/builders.py b/buildbot_gentoo_ci/steps/builders.py
78 index 085d096..862f0d4 100644
79 --- a/buildbot_gentoo_ci/steps/builders.py
80 +++ b/buildbot_gentoo_ci/steps/builders.py
81 @@ -2,6 +2,7 @@
82 # Distributed under the terms of the GNU General Public License v2
83
84 import os
85 +import re
86
87 from twisted.internet import defer
88 from twisted.python import log
89 @@ -11,6 +12,56 @@ from buildbot.process.results import SUCCESS
90 from buildbot.process.results import FAILURE
91 from buildbot.plugins import steps
92
93 +def PersOutputOfEmerge(rc, stdout, stderr):
94 + emerge_output = {}
95 + emerge_output['rc'] = rc
96 + package_dict = {}
97 + print(stderr)
98 + for line in stdout.split('\n'):
99 + # package list
100 + subdict = {}
101 + if line.startswith('[ebuild'):
102 + # split the line
103 + # if binaries
104 + if line.startswith('[ebuild'):
105 + subdict['binary'] = False
106 + else:
107 + subdict['binary'] = True
108 + # action [ N ] stuff
109 + subdict['action'] = line[8:15].replace(' ', '')
110 + # cpv
111 + cpv_split = re.search('] (.+?) ', line).group(1).split(':')
112 + cpv = cpv_split[0]
113 + # repository
114 + # slot
115 + if cpv_split[1] == '':
116 + subdict['slot'] = None
117 + subdict['repository'] = cpv_split[2]
118 + else:
119 + subdict['slot'] = cpv_split[1]
120 + subdict['repository'] = cpv_split[3]
121 + # if action U version cpv
122 + if 'U' in subdict['action']:
123 + subdict['old_version'] = re.search(' \[(.+?)] ', line).group(1).split(':')
124 + else:
125 + subdict['old_version'] = None
126 + # Use list
127 + if 'USE=' in line:
128 + subdict['use'] = re.search('USE="(.+?)" ', line).group(1).split(' ')
129 + else:
130 + subdict['use'] = None
131 + # PYTHON_TARGETS list
132 + if 'PYTHON_TARGETS=' in line:
133 + subdict['python_targets'] = re.search('PYTHON_TARGETS="(.+?)" ', line).group(1).split(' ')
134 + else:
135 + subdict['python_targets'] = None
136 + # CPU_FLAGS_X86 list
137 + package_dict[cpv] = subdict
138 + #FIXME: Handling of stderr output
139 + return {
140 + 'emerge_output' : emerge_output
141 + }
142 +
143 class TriggerRunBuildRequest(BuildStep):
144
145 name = 'TriggerRunBuildRequest'
146 @@ -259,6 +310,7 @@ class SetMakeConf(BuildStep):
147 makeconf_variable_list.append('--rebuild-if-new-rev=y')
148 makeconf_variable_list.append('--rebuilt-binaries=y')
149 makeconf_variable_list.append('--usepkg=y')
150 + makeconf_variable_list.append('--binpkg-respect-use=y')
151 makeconf_variable_list.append('--nospinner')
152 makeconf_variable_list.append('--color=n')
153 makeconf_variable_list.append('--ask=n')
154 @@ -279,7 +331,7 @@ class SetMakeConf(BuildStep):
155 if k['variable'] == 'ACCEPT_RESTRICT':
156 makeconf_variable_list.append('-fetch')
157 for v in makeconf_variables_values_data:
158 - if v['build_id'] is 0:
159 + if v['build_id'] == 0:
160 makeconf_variable_list.append(v['value'])
161 if k['variable'] == 'ACCEPT_LICENSE' and makeconf_variable_list != []:
162 makeconf_variable_list.append('ACCEPT_LICENSE="*"')
163
164 diff --git a/buildbot_gentoo_ci/steps/update_db.py b/buildbot_gentoo_ci/steps/update_db.py
165 index 1ffbbff..ee2ba88 100644
166 --- a/buildbot_gentoo_ci/steps/update_db.py
167 +++ b/buildbot_gentoo_ci/steps/update_db.py
168 @@ -124,7 +124,7 @@ class CheckCPVGentooCiProject(BuildStep):
169 def run(self):
170 #self.cpv_changes = self.getProperty("cpv_changes")
171 self.cpv_changes = []
172 - self.cpv_changes.append('dev-lang/python-3.9.1-r1')
173 + self.cpv_changes.append('dev-python/django-3.1.5')
174 self.cpv_changes.append('dev-python/scrypt-0.8.16')
175 print(self.cpv_changes)
176 print(self.getProperty("repository_data"))