Skip to content

Commit

Permalink
Update regex and cache cmssw version
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Dec 18, 2024
1 parent 2e92f39 commit 2a247d6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions buildLogAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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<full_path>(?:.*/"
+ self.cmsswVersion
+ r"/)?(?P<file>src/[^:(]+)[:(](?P<line>\d+)\)?):"
)

if not pkg.name() in self.tagList:
return
Expand Down Expand Up @@ -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], '<a href="' + url + '">' + m[1] + "</a>", 1)
url = (
"https://github.com/cms-sw/cmssw/blob/"
+ self.cmsswVersion
+ m["file"]
+ "#L"
+ m["line"]
)

newLine = newLine.replace(
m["full_path"], '<a href="' + url + '">' + m["full_path"] + "</a>", 1
)
newLine = (
"<span class="
+ self.styleClass[pkg.errLines[lineNo]]
Expand Down

0 comments on commit 2a247d6

Please sign in to comment.