From 2e92f39761892e0f53833e931dca06de03379899 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Wed, 18 Dec 2024 13:05:59 +0100 Subject: [PATCH 1/6] Add hyperlinks to build log --- buildLogAnalyzer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/buildLogAnalyzer.py b/buildLogAnalyzer.py index fa7445d3d3c..95387739d77 100755 --- a/buildLogAnalyzer.py +++ b/buildLogAnalyzer.py @@ -380,6 +380,7 @@ def makeHTMLSummaryPage(self): def makeHTMLLogFile(self, pkg): """docstring for makeHTMLFile""" + linePartsUrl = re.compile(r"\s*(src(/[^:]+):(\d+)):.*") if not pkg.name() in self.tagList: return @@ -410,6 +411,11 @@ def makeHTMLLogFile(self, pkg): ) # do this first to not escape it again in the next subs newLine = newLine.replace("<", "<").replace(">", ">") 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) newLine = ( "(?:.*/" + + 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 = ( "(?:.*/" - + self.cmsswVersion + + self.release + r"/)?(?Psrc/[^:(]+)[:(](?P\d+)\)?):" ) @@ -421,7 +419,7 @@ def makeHTMLLogFile(self, pkg): if m: url = ( "https://github.com/cms-sw/cmssw/blob/" - + self.cmsswVersion + + self.release + m["file"] + "#L" + m["line"] From 17bcc493673cbb19956568ac53f6e8c2c70e0755 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Wed, 18 Dec 2024 16:26:16 +0100 Subject: [PATCH 4/6] Fix for python 2 (doesn't support match[...]) --- buildLogAnalyzer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildLogAnalyzer.py b/buildLogAnalyzer.py index 34734164caa..718cc20611d 100755 --- a/buildLogAnalyzer.py +++ b/buildLogAnalyzer.py @@ -420,13 +420,13 @@ def makeHTMLLogFile(self, pkg): url = ( "https://github.com/cms-sw/cmssw/blob/" + self.release - + m["file"] + + m.group("file") + "#L" - + m["line"] + + m.group("line") ) newLine = newLine.replace( - m["full_path"], '' + m["full_path"] + "", 1 + m.group("full_path"), '' + m.group("full_path") + "", 1 ) newLine = ( "' + m.group("full_path") + "", 1 + m.group("full_path"), + '' + m.group("full_path") + "", + 1, ) newLine = ( " Date: Thu, 19 Dec 2024 10:03:27 +0100 Subject: [PATCH 6/6] Improve matching --- buildLogAnalyzer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildLogAnalyzer.py b/buildLogAnalyzer.py index e2ba990e3af..936f9e67d40 100755 --- a/buildLogAnalyzer.py +++ b/buildLogAnalyzer.py @@ -381,7 +381,7 @@ def makeHTMLSummaryPage(self): def makeHTMLLogFile(self, pkg): """docstring for makeHTMLFile""" linePartsUrl = re.compile( - r"\s+(?P(?:.*/" + r"(?P(?:.*/" + self.release + r"/)?(?Psrc/[^:(]+)[:(](?P\d+)\)?):" ) @@ -415,7 +415,7 @@ def makeHTMLLogFile(self, pkg): ) # do this first to not escape it again in the next subs newLine = newLine.replace("<", "<").replace(">", ">") if lineNo in pkg.errLines.keys(): - m = linePartsUrl.match(newLine) + m = linePartsUrl.match(newLine.strip()) if m: url = ( "https://github.com/cms-sw/cmssw/blob/"