diff options
| -rw-r--r-- | dlang/flake.lock | 25 | ||||
| -rw-r--r-- | dlang/flake.nix | 2 | ||||
| -rw-r--r-- | gleam/flake.lock | 25 | ||||
| -rw-r--r-- | gleam/flake.nix | 2 | ||||
| -rw-r--r-- | pipeline/README.md | 7 | ||||
| -rwxr-xr-x | pipeline/build.sh | 8 | ||||
| -rwxr-xr-x | pipeline/one.sh | 6 | ||||
| -rwxr-xr-x | pipeline/pdf.sh | 2 | ||||
| -rwxr-xr-x | pipeline/read.sh | 21 | ||||
| -rwxr-xr-x | pipeline/run.sh | 2 | ||||
| -rwxr-xr-x | pipeline/write.sh | 2 |
11 files changed, 60 insertions, 42 deletions
diff --git a/dlang/flake.lock b/dlang/flake.lock index f2eda10..13a94c9 100644 --- a/dlang/flake.lock +++ b/dlang/flake.lock @@ -2,28 +2,25 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1790185690, - "narHash": "sha256-xJ+X4hBtOcAFGBOe5nAMyMUeF9foJBmIOu3NjBqBycU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4975466d324710c576dc11ad614684e6bd8cad8e", - "type": "github" + "lastModified": 1790652569, + "narHash": "sha256-k8Fu4c9Z+4Nh7mUr0cfw++ITQiyEhlWxoJBOkI3tOcQ=", + "rev": "b6c8664de9b6cc07fe5666a29f91884ba81197c4", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1082290.b6c8664de9b6/nixexprs.tar.zst" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst" } }, "ocda-lib": { "flake": false, "locked": { - "lastModified": 1790705252, - "narHash": "sha256-lMPJxbVyAiMr8/yKvuRLeJgT+aGEQv0MiW9hlQLa/os=", + "lastModified": 1791851051, + "narHash": "sha256-mVI3uGQ1z7S5OMMFjl5UoWShE3p0ucXlr6cVU1iAsgI=", "ref": "refs/heads/main", - "rev": "8b8a8c1b61c740528e1409a2429f7ec4403f9576", - "revCount": 2, + "rev": "4e4f2f8c2b2c043077390cb4ccf7ce97ffe4ac6b", + "revCount": 3, "type": "git", "url": "git://git.sisudoc.org/tools/sisudoc-ocda-lib" }, diff --git a/dlang/flake.nix b/dlang/flake.nix index 966425a..d3923f0 100644 --- a/dlang/flake.nix +++ b/dlang/flake.nix @@ -1,7 +1,7 @@ { description = "ocda-write: sample writers over the object-centric document abstraction, in D"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst"; /* The library this is built on, as a source tree rather than a flake: the build compiles its modules alongside these, which is what a dub path diff --git a/gleam/flake.lock b/gleam/flake.lock index f2eda10..13a94c9 100644 --- a/gleam/flake.lock +++ b/gleam/flake.lock @@ -2,28 +2,25 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1790185690, - "narHash": "sha256-xJ+X4hBtOcAFGBOe5nAMyMUeF9foJBmIOu3NjBqBycU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4975466d324710c576dc11ad614684e6bd8cad8e", - "type": "github" + "lastModified": 1790652569, + "narHash": "sha256-k8Fu4c9Z+4Nh7mUr0cfw++ITQiyEhlWxoJBOkI3tOcQ=", + "rev": "b6c8664de9b6cc07fe5666a29f91884ba81197c4", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1082290.b6c8664de9b6/nixexprs.tar.zst" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst" } }, "ocda-lib": { "flake": false, "locked": { - "lastModified": 1790705252, - "narHash": "sha256-lMPJxbVyAiMr8/yKvuRLeJgT+aGEQv0MiW9hlQLa/os=", + "lastModified": 1791851051, + "narHash": "sha256-mVI3uGQ1z7S5OMMFjl5UoWShE3p0ucXlr6cVU1iAsgI=", "ref": "refs/heads/main", - "rev": "8b8a8c1b61c740528e1409a2429f7ec4403f9576", - "revCount": 2, + "rev": "4e4f2f8c2b2c043077390cb4ccf7ce97ffe4ac6b", + "revCount": 3, "type": "git", "url": "git://git.sisudoc.org/tools/sisudoc-ocda-lib" }, diff --git a/gleam/flake.nix b/gleam/flake.nix index 49cd3f1..c70f739 100644 --- a/gleam/flake.nix +++ b/gleam/flake.nix @@ -1,7 +1,7 @@ { description = "ocda-write: sample writers over the object-centric document abstraction, in Gleam"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst"; /* The library this is built on, as a source tree rather than a flake. gleam.toml names it as the path dependency ./ocda-lib, which in a diff --git a/pipeline/README.md b/pipeline/README.md index 59b98dc..c5920f7 100644 --- a/pipeline/README.md +++ b/pipeline/README.md @@ -65,11 +65,13 @@ sh pipeline/one.sh md-g <doc>.ocda.db en sh pipeline/one.sh html-d <doc>.sisupod sh pipeline/one.sh dump-d <doc>.ocda.db en sh pipeline/one.sh agree-g <doc>.ssp <doc>.ocda.db +sh pipeline/one.sh read-d <doc>.sisupod en --tree ``` The tool names are `<format>-<language>`: `text`, `md`, `html`, `epub`, -`typst` for the writers, and `ssp`, `db`, `dump`, `agree` for the readers and -the library; `-d` for D and `-g` for Gleam. +`typst` for the writers, `read` for the library's reader (ocda-read, which +reads every form and takes its modes after the file), and `ssp`, `db`, `dump`, +`agree` for the older readers and the library; `-d` for D and `-g` for Gleam. Output goes to stdout, so a comparison is a pipeline. The epub and the typst name a file instead, because an epub is a zip and a `.typ` names its images by @@ -88,6 +90,7 @@ regression without reading 36 documents. | `all four dumps identical` | the library's whole claim: two serialisations, two languages, one model | |---|---| +| `ocda-read, all four identical` | the reader's tree of a document, the same from its .ssp and its .ocda.db, in D and in Gleam | | `D == Gleam, <format>` | the writers agree, in unrelated languages, neither written from the other. This is what says the model is sufficient | | `.ssp and .ocda.db give the same .typ` | a writer is not told which serialisation it was handed | | `typst compiled silently` | a link to a label that does not exist is a typst compile error, so this says every internal link in every document resolves | diff --git a/pipeline/build.sh b/pipeline/build.sh index e4eac9c..72c9b11 100755 --- a/pipeline/build.sh +++ b/pipeline/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Build every reader, every library and every writer, in both languages. # # Each project is its own flake and builds on its own. The library has no @@ -19,8 +19,10 @@ build() { # <directory> [flake output] } failed=0 -build "$OCDA_LIB/dlang" .#ocda-dump -build "$OCDA_LIB/dlang" .#ocda-agree +# the library's programs: ocda-read, ocda-dump and ocda-agree, one build, one +# result/bin. Built as two, into the one result link, the second replaced the +# first, and the dump this pipeline reads was not there. +build "$OCDA_LIB/dlang" build "$OCDA_LIB/gleam" build "$SSP_READER/dlang" build "$SSP_READER/gleam" diff --git a/pipeline/one.sh b/pipeline/one.sh index 18ffc5f..55e9ca6 100755 --- a/pipeline/one.sh +++ b/pipeline/one.sh @@ -1,10 +1,12 @@ -#!/bin/sh +#!/usr/bin/env sh # One tool, one document: the answer to "how do I run this by hand?". # # sh pipeline/one.sh <tool> <file> [lang] # # where <tool> is one of # +# read-d read-g ocda-read, the library's reader of every form; takes its +# modes after the file: one.sh read-d <file> en --tree # ssp-d ssp-g the .ssp readers, D and Gleam # db-d db-g the .ocda.db readers # dump-d dump-g the library's canonical dump of the whole model @@ -24,6 +26,8 @@ file=${2:?usage: one.sh <tool> <file> [lang]} lang=${3:-} case $tool in + read-d) shift; exec "$OCDA_LIB/dlang/result/bin/ocda-read" "$@" ;; + read-g) shift; exec "$OCDA_LIB/gleam/result/bin/ocda-read" "$@" ;; ssp-d) exec "$SSP_READER/dlang/result/bin/ssp-reader" "$file" ;; ssp-g) exec "$SSP_READER/gleam/result/bin/ssp_reader" "$file" ;; db-d) exec "$DB_READER/dlang/result/bin/ocda-db-reader" "$file" ;; diff --git a/pipeline/pdf.sh b/pipeline/pdf.sh index a769137..d31c1da 100755 --- a/pipeline/pdf.sh +++ b/pipeline/pdf.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Compile every .typ the write stage produced, into $OUT/write/pdf/. # # typst is the only thing this stage needs, and it is a single binary. A link diff --git a/pipeline/read.sh b/pipeline/read.sh index b3129a5..ddbebe4 100755 --- a/pipeline/read.sh +++ b/pipeline/read.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Every reader and both libraries, over every document, into $OUT/read/. # # What each produces: @@ -7,6 +7,8 @@ # read/db-{d,g}/<doc>.txt the .ocda.db readers' summary # read/dump-{d,g}/<doc>.ssp the library's dump, loaded from the .ssp # read/dump-{d,g}/<doc>.db the same, loaded from the .ocda.db +# read/read-{d,g}/<doc>.ssp ocda-read --tree, reading the .ssp +# read/read-{d,g}/<doc>.db the same, reading the .ocda.db # # The dumps are the interesting ones. All four of them should be identical: # the two serialisations say the same thing, and the two languages read it the @@ -15,12 +17,12 @@ set -e . "$(dirname "$0")/config.sh" : "${ARTEFACTS:?set ARTEFACTS to a directory of .ssp and .ocda.db files}" mkdir -p "$OUT/read" -for d in ssp-d ssp-g db-d db-g dump-d dump-g; do mkdir -p "$OUT/read/$d"; done +for d in ssp-d ssp-g db-d db-g dump-d dump-g read-d read-g; do mkdir -p "$OUT/read/$d"; done list=$(find "$ARTEFACTS" -name '*.ssp' | sort) [ -n "$LIMIT" ] && list=$(echo "$list" | head -n "$LIMIT") -n=0; same=0 +n=0; same=0; read_same=0 for ssp in $list; do stem=$(basename "$ssp" .ssp); lang=${stem##*.}; uid=${stem%.*} db=$(find "$ARTEFACTS" -name "$uid.ocda.db" | head -1) @@ -41,7 +43,20 @@ for ssp in $list; do then same=$((same+1)) else echo "DUMPS DIFFER $stem" fi + # ocda-read: the same from either form, and the same in either language, + # the first line, which names the file read, set aside + sh "$(dirname "$0")/one.sh" read-d "$ssp" "$lang" --tree | tail -n +2 > "$OUT/read/read-d/$stem.ssp" + sh "$(dirname "$0")/one.sh" read-g "$ssp" "$lang" --tree | tail -n +2 > "$OUT/read/read-g/$stem.ssp" + sh "$(dirname "$0")/one.sh" read-d "$db" "$lang" --tree | tail -n +2 > "$OUT/read/read-d/$stem.db" + sh "$(dirname "$0")/one.sh" read-g "$db" "$lang" --tree | tail -n +2 > "$OUT/read/read-g/$stem.db" + if cmp -s "$OUT/read/read-d/$stem.ssp" "$OUT/read/read-d/$stem.db" \ + && cmp -s "$OUT/read/read-g/$stem.ssp" "$OUT/read/read-g/$stem.db" \ + && cmp -s "$OUT/read/read-d/$stem.ssp" "$OUT/read/read-g/$stem.ssp" + then read_same=$((read_same+1)) + else echo "OCDA-READ DIFFERS $stem" + fi done echo echo "documents read: $n" echo "all four dumps identical $same" +echo "ocda-read, all four identical $read_same" diff --git a/pipeline/run.sh b/pipeline/run.sh index 811514e..f68c906 100755 --- a/pipeline/run.sh +++ b/pipeline/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # The whole pipeline: build, read, write, typeset. # # ARTEFACTS=<dir of .ssp and .ocda.db> OUT=<dir> sh pipeline/run.sh diff --git a/pipeline/write.sh b/pipeline/write.sh index 7e1bead..aeb1f18 100755 --- a/pipeline/write.sh +++ b/pipeline/write.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Every writer, in both languages, over every document, into $OUT/write/. # # write/text/{d,g}/<doc>.txt |
