From d85a1e4e2eaa340dc83938bfda33bf2a9e7f50f6 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 11 Jul 2021 21:14:59 +0000 Subject: More git link cleanup * Fix Trac "export:" links * Use "about" link for naked repository links so default view is the README.md * Adjust to match new cgit configuration which hides ".git" suffixes --- GNUmakefile | 2 +- kludge-cgit-urls.py | 39 ++++++++++++++++++++++++ kludges.py | 36 ---------------------- pelican/content/AlphaSchematics.md | 2 +- pelican/content/BuildingFromSource.md | 4 +-- pelican/content/Documents.md | 2 +- "pelican/content/Joachim Str\303\266mbergson.md" | 4 +-- pelican/content/ReleaseNotes.md | 2 +- 8 files changed, 47 insertions(+), 44 deletions(-) create mode 100755 kludge-cgit-urls.py delete mode 100755 kludges.py diff --git a/GNUmakefile b/GNUmakefile index 9e51aeb..95ca6fe 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,7 +10,7 @@ REPO_PATH := /usr/local/git/repositories all: tools/extract.py --source-url ${SOURCE_URL} - ./kludges.py + ./kludge-cgit-urls.py cd pelican; pelican --output website --settings pelicanconf.py --fatal errors content fetch: diff --git a/kludge-cgit-urls.py b/kludge-cgit-urls.py new file mode 100755 index 0000000..9d9feed --- /dev/null +++ b/kludge-cgit-urls.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# Kludges specific to converting the Cryptech wiki + +import os, re, json + +with open("repositories.json") as f: + repo_or = "|".join(os.path.splitext(r)[0] for r in json.load(f)) + +plain = "](https://git.cryptech.is" +export = "](export:/" +regexp = re.compile(r"(\(https://git\.cryptech\.is/(?:" + repo_or + "))([(/)])") + +for root, dirs, files in os.walk("pelican/content"): + for fn in files: + if not fn.endswith(".md"): + continue + fn = os.path.join(root, fn) + with open(fn) as f: + lines = f.readlines() + if not any(plain in line or export in line for line in lines): + continue + changes = 0 + for i, line in enumerate(lines): + if export in line: + changes = 1 + line = line.replace(export, "](https://git.cryptech.is/") + elif plain not in line: + continue + lines[i], n = regexp.subn( + lambda m: m.group(1) + ("/tree" if m.group(2) == "/" else "/about") + m.group(2), + line) + changes += n + if changes: + tn = fn + ".tmp" + with open(tn, "w") as f: + for line in lines: + f.write(line) + os.rename(tn, fn) diff --git a/kludges.py b/kludges.py deleted file mode 100755 index c0de7e1..0000000 --- a/kludges.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -# -# Kludges specific to converting the Cryptech wiki - -import os, re, json - -with open("repositories.json") as f: - repo_or = "|".join(os.path.splitext(r)[0] for r in json.load(f)) - -plain = "](https://git.cryptech.is" - -regexp = re.compile(r"(\(https://git\.cryptech\.is/(?:" + repo_or + "))([(/)])") - -for root, dirs, files in os.walk("pelican/content"): - for fn in files: - if not fn.endswith(".md"): - continue - fn = os.path.join(root, fn) - with open(fn) as f: - lines = f.readlines() - if not any(plain in line for line in lines): - continue - changes = 0 - for i, line in enumerate(lines): - if plain not in line: - continue - lines[i], n = regexp.subn( - lambda m: m.group(1) + (".git/tree" if m.group(2) == "/" else ".git") + m.group(2), - line) - changes += n - if changes: - tn = fn + ".tmp" - with open(tn, "w") as f: - for line in lines: - f.write(line) - os.rename(tn, fn) diff --git a/pelican/content/AlphaSchematics.md b/pelican/content/AlphaSchematics.md index 89b400f..6510842 100644 --- a/pelican/content/AlphaSchematics.md +++ b/pelican/content/AlphaSchematics.md @@ -4,7 +4,7 @@ Date: 2016-12-15 22:39 The Alpha schematics are almost finished! -PDF and Eagle files available for download here in the [hardware](https://git.cryptech.is/hardware.git/tree/eagle/alpha/rev02) repository. +PDF and Eagle files available for download here in the [hardware](https://git.cryptech.is/hardware/tree/eagle/alpha/rev02) repository. `https://wiki.cryptech.is/browser/hardware/eagle/alpha/rev02` diff --git a/pelican/content/BuildingFromSource.md b/pelican/content/BuildingFromSource.md index 3ba00e5..d39111d 100644 --- a/pelican/content/BuildingFromSource.md +++ b/pelican/content/BuildingFromSource.md @@ -20,7 +20,7 @@ code then run make", but the details differ. We check out copies of all the several dozen separate repositories and carefully arrange them in a tree structure which matches the official naming scheme. Yes, really. It's tedious, but we have -[a script to automate this](export:/user/sra/build-tools/https-sync-repos.py). +[a script to automate this](https://git.cryptech.is/user/sra/build-tools/tree/https-sync-repos.py). Be warned that this script is a kludge which relies on parsing XML from this Wiki; this is nasty, but reasonably stable, because the XML itself is generated by another script. @@ -39,7 +39,7 @@ goo necessary to make the whole thing work. Do `git help submodule` for an introduction to git's submodule mechanism. With this model, one just checks out a copy of -[the superrepository](https://git.cryptech.is/releng/alpha.git), +[the superrepository](https://git.cryptech.is/releng/alpha/about), runs `make` in its top directory, and eventually the complete package pops out the other side. diff --git a/pelican/content/Documents.md b/pelican/content/Documents.md index 27e4039..b988bbc 100644 --- a/pelican/content/Documents.md +++ b/pelican/content/Documents.md @@ -17,7 +17,7 @@ Remember that links from this page to files in git repositories should use the " [Alpha board strategy]({filename}AlphaBoardStrategy.md) -[Alpha board drawing](export:/doc/design/Alpha_board_drawing.pdf) +[Alpha board drawing](https://git.cryptech.is/doc/design/tree/Alpha_board_drawing.pdf) [Alpha board pictures]({filename}AlphaBoardPictures.md) diff --git "a/pelican/content/Joachim Str\303\266mbergson.md" "b/pelican/content/Joachim Str\303\266mbergson.md" index f7cd4f0..7fa6bb0 100644 --- "a/pelican/content/Joachim Str\303\266mbergson.md" +++ "b/pelican/content/Joachim Str\303\266mbergson.md" @@ -21,8 +21,8 @@ Date: 2016-12-15 22:54 ## Work Notes ### Presentations from meeting 2014-03-10 (updated and extended): -* [Cryptech HW status 2014-03-10](https://git.cryptech.is/doc/presentations.git/tree/Cryptech_HW_status_2014-03-10.pdf) -* [Cryptech TRNG Ideas 2014-03-17](https://git.cryptech.is/doc/presentations.git/tree/Cryptech_TRNG_Ideas_2014-03-17.pdf) +* [Cryptech HW status 2014-03-10](https://git.cryptech.is/doc/presentations/tree/Cryptech_HW_status_2014-03-10.pdf) +* [Cryptech TRNG Ideas 2014-03-17](https://git.cryptech.is/doc/presentations/tree/Cryptech_TRNG_Ideas_2014-03-17.pdf) ### Open EDA Tools diff --git a/pelican/content/ReleaseNotes.md b/pelican/content/ReleaseNotes.md index e61d696..ca48599 100644 --- a/pelican/content/ReleaseNotes.md +++ b/pelican/content/ReleaseNotes.md @@ -22,7 +22,7 @@ Modified: 2017-05-13 19:18 * Python client implementations of libhal RPC mechanism and PKCS #11 now installed as `cryptech.libhal` and `cryptech.py11`, respectively. * Python PKCS #11 client hacked to play nicely with `pkcs11-spy` debugging tool. * RTOS replaced by simple non-preemptive (voluntary yield) tasking system, eliminating a huge morass of potential race conditions, debugging nightmares, priority inversions, and similar horrors. Lack of preemption means that console acess may have to wait for something else to yield the ARM CPU, but it's more than worth it to get rid of all the stability problems the RTOS was causing. -* [Sample code for using the HSM as an OpenSSL engine](https://git.cryptech.is/user/sra/openssl-engine.git) is available. This only works with RSA for the moment, due to apparent limitations of the engine implementation. +* [Sample code for using the HSM as an OpenSSL engine](https://git.cryptech.is/user/sra/openssl-engine/about) is available. This only works with RSA for the moment, due to apparent limitations of the engine implementation. Getting started with 3.0: -- cgit v1.2.3