From 2a247d6122f123d4e8bae02bed901e178333f258 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Wed, 18 Dec 2024 15:38:59 +0100 Subject: [PATCH] Update regex and cache cmssw version --- buildLogAnalyzer.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/buildLogAnalyzer.py b/buildLogAnalyzer.py index 95387739d77..49db1827236 100755 --- a/buildLogAnalyzer.py +++ b/buildLogAnalyzer.py @@ -123,6 +123,8 @@ def __init__( "ok": "ok", } + self.cmsswVersion = os.getenv("CMSSW_VERSION", "master") + # get the lists separately for "priority" treatment ... self.errMap = {} for key in self.errorKeys: @@ -380,7 +382,11 @@ def makeHTMLSummaryPage(self): def makeHTMLLogFile(self, pkg): """docstring for makeHTMLFile""" - linePartsUrl = re.compile(r"\s*(src(/[^:]+):(\d+)):.*") + linePartsUrl = re.compile( + r"\s+(?P(?:.*/" + + self.cmsswVersion + + r"/)?(?Psrc/[^:(]+)[:(](?P\d+)\)?):" + ) if not pkg.name() in self.tagList: return @@ -413,9 +419,17 @@ def makeHTMLLogFile(self, pkg): if lineNo in pkg.errLines.keys(): m = linePartsUrl.match(newLine) if m: - branch = os.getenv("CMSSW_VERSION", "master") - url = "https://github.com/cms-sw/cmssw/blob/" + branch + m[2] + "#L" + m[3] - newLine = newLine.replace(m[1], '' + m[1] + "", 1) + url = ( + "https://github.com/cms-sw/cmssw/blob/" + + self.cmsswVersion + + m["file"] + + "#L" + + m["line"] + ) + + newLine = newLine.replace( + m["full_path"], '' + m["full_path"] + "", 1 + ) newLine = ( "