Skip to content

Commit 2a247d6

Browse files
committed
Update regex and cache cmssw version
1 parent 2e92f39 commit 2a247d6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

buildLogAnalyzer.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def __init__(
123123
"ok": "ok",
124124
}
125125

126+
self.cmsswVersion = os.getenv("CMSSW_VERSION", "master")
127+
126128
# get the lists separately for "priority" treatment ...
127129
self.errMap = {}
128130
for key in self.errorKeys:
@@ -380,7 +382,11 @@ def makeHTMLSummaryPage(self):
380382

381383
def makeHTMLLogFile(self, pkg):
382384
"""docstring for makeHTMLFile"""
383-
linePartsUrl = re.compile(r"\s*(src(/[^:]+):(\d+)):.*")
385+
linePartsUrl = re.compile(
386+
r"\s+(?P<full_path>(?:.*/"
387+
+ self.cmsswVersion
388+
+ r"/)?(?P<file>src/[^:(]+)[:(](?P<line>\d+)\)?):"
389+
)
384390

385391
if not pkg.name() in self.tagList:
386392
return
@@ -413,9 +419,17 @@ def makeHTMLLogFile(self, pkg):
413419
if lineNo in pkg.errLines.keys():
414420
m = linePartsUrl.match(newLine)
415421
if m:
416-
branch = os.getenv("CMSSW_VERSION", "master")
417-
url = "https://github.com/cms-sw/cmssw/blob/" + branch + m[2] + "#L" + m[3]
418-
newLine = newLine.replace(m[1], '<a href="' + url + '">' + m[1] + "</a>", 1)
422+
url = (
423+
"https://github.com/cms-sw/cmssw/blob/"
424+
+ self.cmsswVersion
425+
+ m["file"]
426+
+ "#L"
427+
+ m["line"]
428+
)
429+
430+
newLine = newLine.replace(
431+
m["full_path"], '<a href="' + url + '">' + m["full_path"] + "</a>", 1
432+
)
419433
newLine = (
420434
"<span class="
421435
+ self.styleClass[pkg.errLines[lineNo]]

0 commit comments

Comments
 (0)