commit:     213dd7e3231033ad02a7c831df210acec32cf282
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 10 10:52:46 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 10:53:53 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=213dd7e3

scripts/auto-bootstraps/analyse_result: add links for stage2/3 fails

much like emerge -e system, stage 2 and 3 use portage, thus individual
buildlogs exist, which are much less in size than the entire stagelogs.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/auto-bootstraps/analyse_result.py | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/scripts/auto-bootstraps/analyse_result.py 
b/scripts/auto-bootstraps/analyse_result.py
index 880fd64343..459341c8c7 100755
--- a/scripts/auto-bootstraps/analyse_result.py
+++ b/scripts/auto-bootstraps/analyse_result.py
@@ -67,15 +67,27 @@ def get_err_reason(arch, dte, err):
             with open(stagelog, 'rb') as f:
                 errexp = re.compile(r'^( \* (ERROR:|Fetch failed for)|emerge: 
there are no) ')
                 for line in f:
-                    res = errexp.match(line.decode('utf-8', 'ignore'))
+                    line = line.decode('utf-8', 'ignore')
+                    res = errexp.match(line)
                     if res:
                         break
             if not line:
                 return '<a href="%s/stage%d.log">stage %d</a> failed' % \
                         (os.path.join(arch, '%d' % dte), err, err)
-            return '<a href="%s/stage%d.log">stage %d</a> failed<br />%s' % \
-                        (os.path.join(arch, '%d' % dte), err, err, \
-                         html.escape(line.decode('utf-8', 'ignore')))
+            m = re.fullmatch(
+                    r'(\* ERROR: )([a-z-]+/[a-zA-Z0-9._-]+)(::gentoo.* 
failed.*)',
+                    line.strip())
+            if m:
+                return '<a href="%s/stage%d.log">stage %d</a> failed<br />' % \
+                        (os.path.join(arch, '%d' % dte), err, err) + \
+                        '%s<a href="%s/temp/build.log">%s</a>%s' % \
+                        (html.escape(m.group(1)), \
+                        os.path.join(arch, '%d' % dte, "portage", m.group(2)), 
\
+                        html.escape(m.group(2)), html.escape(m.group(3)))
+            else:
+                return '<a href="%s/stage%d.log">stage %d</a> failed<br />%s' 
% \
+                            (os.path.join(arch, '%d' % dte), err, err, \
+                             html.escape(line))
         else:
             return 'stage %d did not start' % err
     if err == 4:

Reply via email to