summaryrefslogtreecommitdiffstats
path: root/tools/site/check_site.py
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-12 00:47:10 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-12 00:47:10 -0400
commit5857587697d358206775b3dea532b2d47ef51e8c (patch)
tree70099221ba41843f679b305dedb1347181e6c4fd /tools/site/check_site.py
parentcff1461ef459e98dea063abc72ae0819fea7b5ce (diff)
downloadopen-iov-5857587697d358206775b3dea532b2d47ef51e8c.tar.gz
open-iov-5857587697d358206775b3dea532b2d47ef51e8c.zip
site: repository links use cgit tree URLs; external repo-link audit
- titles.json: map relative doc links to https://git.vgpu.io/open-iov.git/tree/... (the host runs cgit; /blob/ URLs do not exist) - check_site.py: verify every git.vgpu.io URL on every page resolves (HTTP status check, cached, with backoff) - site pages: repository home links point at the .git/ URL - .publish-manifest.json: revised revision records
Diffstat (limited to 'tools/site/check_site.py')
-rw-r--r--tools/site/check_site.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/site/check_site.py b/tools/site/check_site.py
index e56d0c0..e79af25 100644
--- a/tools/site/check_site.py
+++ b/tools/site/check_site.py
@@ -72,6 +72,32 @@ def all_titles():
return titles
+def check_external(url_cache, url, problems, title):
+ """HEAD/GET-check a git.vgpu.io URL once; report non-OK statuses."""
+ if url in url_cache:
+ ok, note = url_cache[url]
+ else:
+ ok, note = False, "unchecked"
+ for attempt in range(4):
+ try:
+ req = urllib.request.Request(url, headers=UA, method="GET")
+ with urllib.request.urlopen(req, timeout=60) as r:
+ ok = r.status in (200, 301, 302)
+ note = str(r.status)
+ r.read(1)
+ break
+ except urllib.error.HTTPError as e:
+ ok, note = e.code in (200, 301, 302), str(e.code)
+ if e.code not in (429, 500, 502, 503):
+ break
+ except Exception as e: # noqa: BLE001
+ note = type(e).__name__
+ time.sleep(2 * (attempt + 1))
+ url_cache[url] = (ok, note)
+ if not ok:
+ problems.append(f"repo link {note}: {url}")
+
+
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--pages", nargs="*", default=[])
@@ -79,6 +105,7 @@ def main():
titles = args.pages or all_titles()
existing = {t.lower(): t for t in all_titles()}
+ repo_url_cache = {}
problems = 0
for title in titles:
@@ -117,6 +144,10 @@ def main():
continue
if tgt.lower() not in existing:
issues.append(f"unresolved link [[{tgt}]]")
+ for u in set(re.findall(r"https?://git\.vgpu\.io[^\s\]\}<>\"|]*", c)):
+ u = u.rstrip(".,;:)")
+ check_external(repo_url_cache, u, issues, title)
+ time.sleep(0.2)
if issues:
problems += 1
print(f"BAD {title}")