added whitelist and parse script. changed Makefile

This commit is contained in:
Kevin Putnam
2018-12-18 11:37:46 -08:00
parent aca22ba939
commit 44978b744d
3 changed files with 88 additions and 3 deletions
+19
View File
@@ -0,0 +1,19 @@
http://www.intel.com/content/www/us/en/virtualization/virtualization-technology/intel-virtualization-technology.html
https://software.intel.com/en-us/articles/intel-virtualization-technology-for-directed-io-vt-d-enhancing-intel-platforms-for-efficient-virtualization-of-io-devices
http://www.intel.com/content/www/us/en/virtualization/virtualization-technology/intel-virtualization-technology.html
https://software.intel.com/en-us/articles/intel-virtualization-technology-for-directed-io-vt-d-enhancing-intel-platforms-for-efficient-virtualization-of-io-devices
https://software.intel.com/en-us/articles/intel-virtualization-technology-for-directed-io-vt-d-enhancing-intel-platforms-for-efficient-virtualization-of-io-devices
https://www.intel.com/content/www/us/en/virtualization/virtualization-technology/intel-virtualization-technology.html
https://www.intel.com/content/www/us/en/virtualization/virtualization-technology/intel-virtualization-technology.html
https://github.com/clearlinux/common#build-rpms-for-a-package
https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html
http://ark.intel.com
https://clearlinux.org/documentation/clear-linux/concepts/bundles-about#related-concepts
https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer
https://github.com/kata-containers/documentation/blob/master/Upgrading.md#maintenance-warning
https://github.com/clearcontainers/runtime#configuration
https://github.com/kata-containers/runtime#configuration
https://kubernetes.io/docs/user-journeys/users/application-developer/foundational/#section-3
https://kubernetes.io/docs/user-journeys/users/application-developer/foundational/#section-2
https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html
http://www.intel.com/content/www/us/en/nuc/nuc-kit-nuc6i5syh.html
@@ -0,0 +1,67 @@
#!/usr/bin/env python
import sys
import re
import os
fileName = "output.txt"
outFile = "broken_links.html"
whitelistFile = "link-whitelist.txt"
if len(sys.argv) < 2:
print ("Enter path of input directory")
sys.exit()
scriptPath = sys.argv[0]
outputPath = sys.argv[1]
fileNamePath = outputPath + "/" + fileName
outFilePath = outputPath + "/" + outFile
whitelistFilePath = os.path.dirname(scriptPath) + "/" + whitelistFile
with open (whitelistFilePath) as w:
whLines = w.readlines()
whitelist = []
for line in whLines:
link = line.rstrip()
whitelist.append(link)
with open (fileNamePath) as f:
lines = f.readlines()
numBrokenLinks = 0
numWhiteListMatches = 0
newLines = ["<!DOCTYPE html><html><head><style>body {font-family: sans-serif;}</style></head><body>"]
whiteListLines = []
for line in lines:
if "[broken]" in line:
strings = line.split(" ")
link = strings[2][:-1]
link = link.strip()
if link in whitelist:
whiteListLines.append("<b>" + strings[0] + "</b>\n<blockquote><a href=\"" + link + "\">[whitelist] " + link + "</a></blockquote>\n")
numWhiteListMatches += 1
else:
newLines.append("<b>" + strings[0] + "</b>\n<blockquote><a href=\"" + link + "\">[broken] " + link + "</a></blockquote>\n")
numBrokenLinks += 1
newLines.insert(0,"<h1>" + str(numBrokenLinks + numWhiteListMatches) + " broken links found in Sphinx link check</h1>\n")
newLines.insert(1,"<h2>" + str(numBrokenLinks) + " unmatched broken links</h2>\n")
newLines.append("<h2>" + str(numWhiteListMatches) + " links matched whitelist</h2>\n")
for line in whiteListLines:
newLines.append(line)
newLines.append("</body></html>")
with open (outFilePath, "w") as outF:
for line in newLines:
outF.write(line)
print("See ./" + outFilePath + " for a detailed breakdown of broken links.")
if numBrokenLinks != 0:
print (numBrokenLinks + " detected. Exiting with error code 255.")
sys.exit(-1)
else:
print ("No unexpected broken links detected.")