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 2c26584
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions buildLogAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def __init__(
"ignoreWarning": "compWarn",
"ok": "ok",
}

self.cmsswVersion = os.getenv("CMSSW_VERSION", "master")

# get the lists separately for "priority" treatment ...
self.errMap = {}
Expand Down Expand Up @@ -380,8 +382,8 @@ 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
htmlDir = "../html/" + pkg.name() + "/"
Expand Down Expand Up @@ -413,9 +415,9 @@ 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 2c26584

Please sign in to comment.