Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/auto-bootstraps/
Date: Tue, 02 Jul 2019 09:37:13
Message-Id: 1562060110.ad69711ccdffa7081597a063b1709c7abfcb9929.grobian@gentoo
1 commit: ad69711ccdffa7081597a063b1709c7abfcb9929
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 2 09:35:10 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 2 09:35:10 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ad69711c
7
8 scripts/auto-bootstraps/analyse_result: split out properties per run
9
10 success and failed runs aren't the same thing, so split out the tags for
11 them (libressl and bootstrap snapshot)
12
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 scripts/auto-bootstraps/analyse_result.py | 98 ++++++++++++++++++-------------
16 1 file changed, 57 insertions(+), 41 deletions(-)
17
18 diff --git a/scripts/auto-bootstraps/analyse_result.py b/scripts/auto-bootstraps/analyse_result.py
19 index b67e494bd7..2b0e04a101 100755
20 --- a/scripts/auto-bootstraps/analyse_result.py
21 +++ b/scripts/auto-bootstraps/analyse_result.py
22 @@ -116,40 +116,48 @@ with os.scandir(resultsdir) as it:
23 arch = f.name
24 fail, state, suc = analyse_arch(os.path.join(resultsdir, arch))
25
26 - elapsedtime = None
27 - haslssl = False
28 - snapshot = None
29 - if suc:
30 - elapsedf = os.path.join(resultsdir, arch, "%s" % suc, "elapsedtime")
31 + infos = {}
32 + for d in [ fail, suc ]:
33 + elapsedtime = None
34 + haslssl = False
35 + snapshot = None
36 +
37 + elapsedf = os.path.join(resultsdir, arch, "%s" % d, "elapsedtime")
38 if os.path.exists(elapsedf):
39 with open(elapsedf, 'rb') as f:
40 l = f.readline()
41 if l is not '':
42 elapsedtime = int(l)
43
44 - mconf = os.path.join(resultsdir, arch, "%s" % suc, "make.conf")
45 - if os.path.exists(mconf):
46 - with open(mconf, 'rb') as f:
47 - l = [x.decode('utf-8', 'ignore') for x in f.readlines()]
48 - l = list(filter(lambda x: 'USE=' in x, l))
49 - for x in l:
50 - if 'libressl' in x:
51 - haslssl = True
52 -
53 - mconf = os.path.join(resultsdir, arch, "%s" % suc, "stage1.log")
54 - if os.path.exists(mconf):
55 - with open(mconf, 'rb') as f:
56 - l = [x.decode('utf-8', 'ignore') for x in f.readlines()]
57 - for x in l:
58 - if 'Fetching ' in x:
59 - if 'portage-latest.tar.bz2' in x:
60 - snapshot = 'latest'
61 - elif 'prefix-overlay-' in x:
62 - snapshot = re.split('[-.]', x)[2]
63 - elif 'total size is' in x:
64 - snapshot = 'rsync'
65 -
66 - archs[arch] = (fail, state, suc, elapsedtime, haslssl, snapshot)
67 + mconf = os.path.join(resultsdir, arch, "%s" % d, "make.conf")
68 + if os.path.exists(mconf):
69 + with open(mconf, 'rb') as f:
70 + l = [x.decode('utf-8', 'ignore') for x in f.readlines()]
71 + l = list(filter(lambda x: 'USE=' in x, l))
72 + for x in l:
73 + if 'libressl' in x:
74 + haslssl = True
75 +
76 + mconf = os.path.join(resultsdir, arch, "%s" % d, "stage1.log")
77 + if os.path.exists(mconf):
78 + with open(mconf, 'rb') as f:
79 + l = [x.decode('utf-8', 'ignore') for x in f.readlines()]
80 + for x in l:
81 + if 'Fetching ' in x:
82 + if 'portage-latest.tar.bz2' in x:
83 + snapshot = 'latest'
84 + elif 'prefix-overlay-' in x:
85 + snapshot = re.split('[-.]', x)[2]
86 + elif 'total size is' in x:
87 + snapshot = 'rsync'
88 +
89 + infos[d] = {
90 + 'etime': elapsedtime,
91 + 'libressl': haslssl,
92 + 'snapshot': snapshot
93 + }
94 +
95 + archs[arch] = (fail, state, suc, infos)
96 if not suc:
97 color = '\033[1;31m' # red
98 elif fail and suc < fail:
99 @@ -161,6 +169,23 @@ with os.scandir(resultsdir) as it:
100
101 sarchs = sorted(archs, key=lambda a: '-'.join(a.split('-')[::-1]))
102
103 +def gentags(infos):
104 + tags = ''
105 + if infos.get('libressl', None):
106 + tags = tags + '''
107 +<span style="border-radius: 5px; background-color: purple; color: white;
108 +display: inline-block; font-size: x-small; padding: 3px 4px; text-transform: uppercase !important;">libressl</span>
109 +'''
110 +
111 + snap = infos.get('snapshot', None)
112 + if snap:
113 + tags = tags + '''
114 +<span style="border-radius: 5px; background-color: darkblue; color: white;
115 +display: inline-block; font-size: x-small; padding: 3px 4px; text-transform: uppercase !important;">''' + snap + '''</span>
116 +'''
117 +
118 + return tags
119 +
120 # generate html edition
121 with open(os.path.join(resultsdir, 'index.html'), "w") as h:
122 h.write("<html>")
123 @@ -172,7 +197,7 @@ with open(os.path.join(resultsdir, 'index.html'), "w") as h:
124 h.write("<th>last successful run</th><th>last failed run</th>")
125 h.write("<th>failure</th>")
126 for arch in sarchs:
127 - fail, errcode, suc, et, lssl, snap = archs[arch]
128 + fail, errcode, suc, infos = archs[arch]
129 if not suc:
130 state = 'red'
131 elif fail and suc < fail:
132 @@ -180,18 +205,6 @@ with open(os.path.join(resultsdir, 'index.html'), "w") as h:
133 else:
134 state = 'limegreen'
135
136 - tags = ''
137 - if lssl:
138 - tags = tags + '''
139 -<span style="border-radius: 5px; background-color: purple; color: white;
140 -display: inline-block; font-size: x-small; padding: 3px 4px; text-transform: uppercase !important;">libressl</span>
141 -'''
142 - if snap:
143 - tags = tags + '''
144 -<span style="border-radius: 5px; background-color: darkblue; color: white;
145 -display: inline-block; font-size: x-small; padding: 3px 4px; text-transform: uppercase !important;">''' + snap + '''</span>
146 -'''
147 -
148 h.write('<tr>')
149
150 h.write('<td bgcolor="%s" nowrap="nowrap">' % state)
151 @@ -200,7 +213,9 @@ display: inline-block; font-size: x-small; padding: 3px 4px; text-transform: upp
152
153 h.write("<td>")
154 if suc:
155 + tags = gentags(infos[suc])
156 etxt = ''
157 + et = infos[suc].get('elapsedtime', None)
158 if et:
159 if et > 86400:
160 etxt = ' (%.1f days)' % (et / 86400)
161 @@ -215,6 +230,7 @@ display: inline-block; font-size: x-small; padding: 3px 4px; text-transform: upp
162
163 h.write("<td>")
164 if fail:
165 + tags = gentags(infos[fail])
166 h.write('<a href="%s/%s">%s</a>%s' % (arch, fail, fail, tags))
167 else:
168 h.write('<i>never</i>')