[Cryptech-Commits] [user/sra/pelican] 63/68: Whack some URLs to match cgit naming scheme

git at cryptech.is git at cryptech.is
Mon Jul 19 22:25:42 UTC 2021


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch pelican
in repository user/sra/pelican.

commit bfebab9957c63d460874d3ec8f6100f9b49de080
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sat Jul 10 23:26:20 2021 +0000

    Whack some URLs to match cgit naming scheme
---
 .gitignore                                       |  3 +-
 GNUmakefile                                      | 32 ++++++++++++++++++++-
 kludges.py                                       | 36 ++++++++++++++++++++++++
 pelican/content/AlphaSchematics.md               |  2 +-
 pelican/content/BuildingFromSource.md            |  2 +-
 "pelican/content/Joachim Str\303\266mbergson.md" |  4 +--
 pelican/content/ReleaseNotes.md                  |  2 +-
 7 files changed, 74 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9d2e5be..2e6cff8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,5 +5,6 @@ __pycache__
 attachments
 pelican/content/*/*
 pelican/pelicanconf.py
-trac.db
 pelican/website
+repositories.json
+trac.db
diff --git a/GNUmakefile b/GNUmakefile
deleted file mode 120000
index 326927d..0000000
--- a/GNUmakefile
+++ /dev/null
@@ -1 +0,0 @@
-tools/GNUmakefile
\ No newline at end of file
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..9e51aeb
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,31 @@
+HERE := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
+SOURCE_URL		:= https://git.cryptech.is/
+SOURCE_TRAC_DB		:= bikeshed.cryptech.is:/home/trac/db/trac.db
+SOURCE_TRAC_ATTACHMENTS := bikeshed.cryptech.is:/home/trac/files/attachments
+
+REPO_HOST := bikeshed.cryptech.is
+REPO_PATH := /usr/local/git/repositories
+
+
+all:
+	tools/extract.py --source-url ${SOURCE_URL}
+	./kludges.py
+	cd pelican; pelican --output website --settings pelicanconf.py --fatal errors content
+
+fetch:
+	rsync -aP --delete ${SOURCE_TRAC_DB} ${SOURCE_TRAC_ATTACHMENTS} .
+	ssh -n ${REPO_HOST} 'sudo find ${REPO_PATH} -name "*.git"' | \
+	sed s=${REPO_PATH}/== | sort | jq -Rn '[inputs]' >repositories.json
+
+clean:
+	rm -rf wiki pelican
+
+distclean: clean
+	rm -rf trac.db attachments
+
+webfsd:
+	@echo http://$$(hostname):8000/
+	webfsd -r pelican/website -4 -L - -F -f index.html
+
+.PHONY: all clean fetch distclean webfsd
diff --git a/kludges.py b/kludges.py
new file mode 100755
index 0000000..c0de7e1
--- /dev/null
+++ b/kludges.py
@@ -0,0 +1,36 @@
+#!/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 09b176d..89b400f 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/eagle/alpha/rev02) repository.
+PDF and Eagle files available for download here in the [hardware](https://git.cryptech.is/hardware.git/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 0190824..3ba00e5 100644
--- a/pelican/content/BuildingFromSource.md
+++ b/pelican/content/BuildingFromSource.md
@@ -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),
+[the superrepository](https://git.cryptech.is/releng/alpha.git),
 runs `make` in its top directory, and eventually
 the complete package pops out the other side.
 
diff --git "a/pelican/content/Joachim Str\303\266mbergson.md" "b/pelican/content/Joachim Str\303\266mbergson.md"
index 84ef71a..f7cd4f0 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/Cryptech_HW_status_2014-03-10.pdf)
-* [Cryptech TRNG Ideas 2014-03-17](https://git.cryptech.is/doc/presentations/Cryptech_TRNG_Ideas_2014-03-17.pdf)
+* [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)
 
 
 ### Open EDA Tools
diff --git a/pelican/content/ReleaseNotes.md b/pelican/content/ReleaseNotes.md
index a95050a..e61d696 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) 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.git) is available.  This only works with RSA for the moment, due to apparent limitations of the engine implementation.
 
 
 Getting started with 3.0:



More information about the Commits mailing list