Skip to content

Commit

Permalink
Add hyperlinks to build log (#2408)
Browse files Browse the repository at this point in the history
* Add hyperlinks to build log

* Update regex and cache cmssw version

* Use self.release

* Fix for python 2 (doesn't support match[...])

* Changes from review

* Improve matching

* Fix url generation
  • Loading branch information
iarspider authored Jan 20, 2025
1 parent d78b550 commit bba8c92
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion buildLogAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ def makeHTMLSummaryPage(self):

def makeHTMLLogFile(self, pkg):
"""docstring for makeHTMLFile"""
linePartsUrl = re.compile(
r"(?P<full_path>(?:.*/"
+ self.release
+ r"/)?src(?P<file>/[^:(]+)[:(](?P<line>\d+)\)?):"
)

if not pkg.name() in self.tagList:
return
Expand Down Expand Up @@ -410,6 +415,21 @@ def makeHTMLLogFile(self, pkg):
) # do this first to not escape it again in the next subs
newLine = newLine.replace("<", "&lt;").replace(">", "&gt;")
if lineNo in pkg.errLines.keys():
m = linePartsUrl.match(newLine.strip())
if m:
url = (
"https://github.com/cms-sw/cmssw/blob/"
+ self.release
+ m.group("file")
+ "#L"
+ m.group("line")
)

newLine = newLine.replace(
m.group("full_path"),
'<a href="' + url + '">' + m.group("full_path") + "</a>",
1,
)
newLine = (
"<span class="
+ self.styleClass[pkg.errLines[lineNo]]
Expand Down Expand Up @@ -770,7 +790,7 @@ def main(argv=None):
pkgList = os.getenv("CMSSW_BASE", None)
if pkgList:
pkgList += "/src/PackageList.cmssw"
rel = os.getenv("CMSSW_VERSION", None)
rel = os.getenv("CMSSW_VERSION", "master")
igWarning = []
if argv is None:
argv = sys.argv
Expand Down

0 comments on commit bba8c92

Please sign in to comment.