Compare commits
11 Commits
a646f1089f
...
b887a61349
| Author | SHA1 | Date |
|---|---|---|
|
|
b887a61349 | 4 days ago |
|
|
917916c5be | 4 days ago |
|
|
5c34951441 | 4 days ago |
|
|
d9061b90ce | 4 days ago |
|
|
3a52f02773 | 5 days ago |
|
|
c172912f4b | 5 days ago |
|
|
7d56aa00ff | 5 days ago |
|
|
0abd07ecd7 | 5 days ago |
|
|
5f3cea1954 | 5 days ago |
|
|
f5e3ed1ce0 | 5 days ago |
|
|
ac7dcdb02a | 5 days ago |
26 changed files with 3980 additions and 433 deletions
@ -0,0 +1,104 @@
|
||||
# G-122 make.tcl host/target platform split: bake by target, not host personality |
||||
|
||||
Status: proposed |
||||
Scope: src/make.tcl (target-platform derivation; store folder, exe suffixing, kit naming, presence checks and process-sweep tooling keyed by target; platform-canon inline copy; zipfs-less zip-type assembly fallback); src/modules/punk/platform-999999.0a1.0.tm (stable canon tags for cygwin-family hosts, help platforms doc); src/runtime/mapvfs.config (per-entry target platform via minimal compatible extension - format ownership coordinated with G-024); bin/runtime/<platform>/ store tiers (as consumed; fixture tier for tests); src/tests/shell/testsuites/punkexe/ (characterization) |
||||
Goal: make.tcl's kit surfaces (bake/bakelist/bin) operate on an explicit target platform rather than the driving tclsh's personality: any capable host (native windows tclsh, msys/cygwin-runtime tclsh, a FreeBSD host running linux binaries) addresses the same per-target runtime store, artifact naming and process handling for the kits it reports/bakes; non-native-personality runtime tiers (e.g third-party mingw64 builds served from punkbin or an alternative artifact server) are representable as first-class mapping entries with their own store tier; and zip-type kit assembly no longer requires zipfs in the driving tcl. |
||||
Acceptance: an msys/cygwin-runtime tclsh driving bakelist/bake on windows reports - and for a changed kit, bakes and deploys - the same win32-x86_64 kit set with identical names and store addressing as a native tclsh, with the pre-deploy process sweep using windows tooling for win32 targets regardless of host personality; punk::platform and the make.tcl inline canon map MSYS_NT/MINGW64_NT/CYGWIN_NT/UCRT64-class hosts to stable documented tags (MSYSTEM-variance documented, no windows build number in the tag) and 'help platforms' lists them; a mapvfs entry declaring a non-default target platform lists in bakelist with its own tier's store presence and bakes to a correctly suffixed artifact, verified against a fixture store tier (a real third-party runtime is not required); a zipfs-less driving tcl (8.6) assembles a zip-type kit via runtime split + punk::zip::mkzip + concatenation (archive-start-relative offsets) and the artifact boots on a zipfs-capable runtime; the linuxulator expectation (a linux-personality tclsh on FreeBSD 14/15 addresses the linux-x86_64 store unchanged) is recorded here with verification deferred to the planned linux-kit-on-FreeBSD trial; native-windows behaviour stays characterization-stable (existing punkexe maketcl tests pass unchanged). |
||||
|
||||
## Context |
||||
|
||||
Field session 2026-07-26: the scoop msys2 tclsh8.6 driving `src/make.tcl |
||||
bakelist` on windows showed every configured kit as runtime=missing (and |
||||
deployed absent) from two compounding causes: the store folder derives from the |
||||
HOST's platform canon (observed `mingw64-x86_64` under a MINGW64_NT os string - |
||||
note the tag follows the MSYSTEM environment, so the same binary can canonize |
||||
as msys/ucrt64/mingw64 in different shells), and the platform=unix branch |
||||
probes suffixless filenames - an assumption that is false for the entire |
||||
cygwin family, whose executables are `.exe` files (the msys tclsh itself is |
||||
`tclsh8.6.exe`). The interim self-diagnosis shipped in punkshell 0.24.1 |
||||
(bakelist store-folder WARNING with the canon derivation + `(FOLDER MISSING)` |
||||
header mark; bake's no-runtimes exit note) tells the user what happened; this |
||||
goal makes the tooling actually cater for it. |
||||
|
||||
The underlying defect is a conflation: make.tcl's scattered |
||||
`$::tcl_platform(platform) eq "windows"` tests mix three separable concerns - |
||||
host process semantics (cp vs `cmd /c copy`, `ps`/`kill` vs |
||||
tasklist/taskkill, path personality), target artifact naming (`.exe` |
||||
suffixing, kit/output names), and store addressing (`bin/runtime/<canon>`). |
||||
An msys host pulls them apart. The process sweep is the sharpest edge: msys |
||||
`ps` sees only msys-descendant processes, so a natively-launched kit exe is |
||||
invisible to the pre-deploy sweep (taskkill remains exec-able from msys). |
||||
|
||||
Direction (user, 2026-07-26): even if msys never becomes a zig buildsuite |
||||
target, third-party-built runtime tiers (e.g an msys2-packaged tclsh) served |
||||
from punkbin or an alternative artifact server must be supportable as kit |
||||
runtimes - REPRESENTATION (mapping entry + store tier) belongs here; |
||||
publication/fetch is the flagged follow-on goal. |
||||
|
||||
FreeBSD linuxulator parallel (user): a linux-personality tclsh running on |
||||
FreeBSD via the linux compat layer is expected to self-identify as linux and |
||||
address `bin/runtime/linux-x86_64` correctly - the planned |
||||
linux-kit-on-FreeBSD-14/15 trial doubles as verification that target-keyed |
||||
stores follow runtime personality, not host OS identity. |
||||
|
||||
Zip offsets (user correction, 2026-07-26): tcl zipfs kits mount with |
||||
archive-start-relative offsets - cat-style construction (split the original |
||||
runtime first, then append a freshly written zip) is valid; `zipfs mkimg`'s |
||||
file-relative offset adjustment is one convention, not a mounting |
||||
requirement. The existing zipcat kit type is the in-repo proof, and its |
||||
machinery already has zipfs-less fallbacks. |
||||
|
||||
## Approach |
||||
|
||||
- One `target_platform` derivation: default from the host canon, with |
||||
cygwin-family hosts on windows defaulting to target `win32-x86_64`; |
||||
per-entry mapping override for non-default tiers (a minimal compatible |
||||
extension of the current vfsconfig entry - e.g a fourth element - whose |
||||
schema home is G-024's toml conversion; the parsed-model seam (G-121, |
||||
achieved - see goals/archive/G-121-bakelist-selective-bake.md) keeps every |
||||
consumer format-agnostic while the format moves). |
||||
- Key store folder, suffixing, kit/artifact naming, presence checks and the |
||||
process-sweep tool selection by TARGET; keep copy commands, path handling |
||||
and prompt behaviour host-driven. |
||||
- punk::platform canon: explicit MSYS_NT/MINGW64_NT/CYGWIN_NT/UCRT64 mapping |
||||
to stable documented tags with the MSYSTEM-variance caveat; the make.tcl |
||||
inline canon copy stays in sync per its existing comment contract. |
||||
- zip-type fallback for zipfs-less driving tcls: reuse the zipcat machinery |
||||
(extract_preamble split + punk::zip::mkzip + concatenation). |
||||
- Characterization against a fixture store tier so no real third-party |
||||
runtime is required; the msys-hosted acceptance run uses the dev machine's |
||||
msys tclsh where present (else recorded env-gated, per punkexe suite |
||||
conventions). |
||||
|
||||
## Alternatives considered |
||||
|
||||
- Per-site host patches (special-case each windows test) - rejected: the |
||||
three-concern conflation just re-accumulates with each new host class. |
||||
- Full self-hosted msys platform lineage (msys-personality kits, accelerator |
||||
builds, own test baselines) - out of scope: the third-party tier direction |
||||
covers the need without a new first-party build lineage. |
||||
- Status quo (require a native tclsh to drive make.tcl) - rejected: field |
||||
friction (the all-missing bakelist), and upcoming linux/FreeBSD hosts make |
||||
host-personality assumptions untenable regardless of msys. |
||||
|
||||
## Notes |
||||
|
||||
- Related: G-024 - owns the mapping format; the per-entry target platform is |
||||
drafted as a minimal compatible extension and its schema home is that |
||||
goal's toml conversion (make.tcl's own comments already pair the platform |
||||
column with the toml change). |
||||
- Related: G-105 - cross-target zig builds populate first-party non-native |
||||
store tiers; this goal is the consuming/addressing side. |
||||
- Related: G-114 - same punk::platform canon vocabulary, applied to |
||||
per-platform tm module roots. |
||||
- Related: G-101 - 8.6 kit containers ride the same mapping/store surfaces; |
||||
lister/bake stay kit-type-agnostic (per the archived G-121 decision). |
||||
- Related: G-057 - per-entry mapping extension precedent (per-vfs icon |
||||
override rides the same entry shape). |
||||
- Related: G-023 - kit naming schemes; target-keyed naming must not collide |
||||
with its version-named binaries direction. |
||||
- Follow-on: G-123 (drafted 2026-07-26, user-approved) - third-party runtime |
||||
tier publication/fetch via punkbin or alternative servers, with schema-v2 |
||||
provenance labeling and server-trust-keyed consent. |
||||
- Out of scope: msys pty raw-mode console/repl behaviour - the cursor-row-1 |
||||
field finding of 2026-07-26 is recorded in G-013's Notes. |
||||
@ -0,0 +1,88 @@
|
||||
# G-123 Third-party runtime tiers via artifact servers: per-target publish, list, fetch, materialize |
||||
|
||||
Status: proposed |
||||
Scope: src/scriptapps/punk-runtime.ps1 + src/scriptapps/bin/punk-runtime.bash + punk-runtime_wrap.toml (named-tier operations in both payloads; bin/punk-runtime.cmd via the established re-wrap channel); punkbin artifact repo (external, c:/repo/jn/punkbin - per-tier layout, defaults, sha1sums, schema-v2 provenance sidecars incl. retroactive backfill, layout docs); src/buildsuites/suite_tcl90/ (family_artifacts.tcl schema-v2 emission for suite-built artifacts); alternative-server override + trusted-server set (PUNKBIN_URL pattern; consent surface coordinated with G-006); src/tests/shell/testsuites/binscripts/ (fixture-server characterization); bin/runtime/<tier>/ stores (as materialization targets) |
||||
Goal: runtime artifacts for tiers beyond the host-native platform - third-party-built personalities (e.g an msys2-packaged mingw64-x86_64 tclsh) and cross-personality consumers (a linux tier used from FreeBSD) - are first-class on punkbin or an alternative artifact server: punk-runtime lists/fetches/uses artifacts for an explicitly named target tier from both payloads, materializing sha1-verified -r<N> artifacts + toml metadata into bin/runtime/<tier>/, with build-origin provenance (suite-built vs third-party) labeled on every artifact, consent keyed to server trust rather than artifact origin, and the G-122 chain completed from server artifact to a bakeable mapping entry. |
||||
Acceptance: against a fixture artifact server (httpfixture precedent) carrying a non-native tier, punk-runtime supports an explicit target-tier argument on list/use (and the fetch path) in BOTH payloads - ps1 driven as the committed bin/punk-runtime.cmd under cmd.exe, bash driven under msys bash - with row/verdict parity and the established single-line row vocabulary scoped to the named tier; 'use' materializes the tier's working copy under bin/runtime/<tier>/ with sha1 verification and beside-toml metadata, and freshness verdicts compare against that tier's server default; artifact-toml schema v2 provenance distinguishes suite-built from third-party (class/builder/source_url/upstream_ref/retrieved), with third-party rows carrying a compact origin tag in list -remote's sparse notes column and full fields in the per-name detail view while suite-built rows are unchanged; existing punkbin third-party artifacts (e.g win32-x86_64/tclsfe-x64.exe, tclkit86bi.exe) gain retroactive schema-v2 sidecars additively (artifact bytes, bare pre-family names and sha1sums.txt authority unchanged; toml-less entries continue to degrade as no-basis rows); consent is keyed to SERVER TRUST - fetches from the trusted set (default: the canonical punkbin origin) prompt nothing, leaving existing unattended flows unchanged, while the first fetch from an untrusted/alternative server gates on an explicit acknowledgement (G-006's mechanism when landed, else an interim documented flag) that surfaces the artifact's provenance class; an end-to-end fixture demonstration wires a fetched fixture-tier runtime through a G-122 non-default-target mapping entry to a bakelist row showing the runtime present; the punkbin layout docs record the per-tier + schema-v2 extension and existing native-tier clients are unaffected (existing binscripts tests pass unchanged). |
||||
|
||||
## Context |
||||
|
||||
Direction (user, 2026-07-26, recorded at G-122's drafting): runtime tiers may be |
||||
third-party built - e.g an msys2-packaged tclsh - and served from punkbin or a |
||||
punkbin-alternative artifact server, even if such platforms are never zig |
||||
buildsuite targets. G-122 owns REPRESENTATION (stable canon tag, store tier, |
||||
non-default-target mapping entry); this goal owns SOURCING (publish, list, |
||||
fetch, materialize). |
||||
|
||||
Current punkbin state (surveyed 2026-07-26): the suite-built family artifacts |
||||
carry rich G-117 schema-v1 sidecars ([artifact] facts including packager - with |
||||
minisign sidecars already anticipated in its comment - plus [provenance] |
||||
suite/toolchain/checkout hashes and [tests] gate results), while the |
||||
third-party binaries beside them (win32-x86_64: tclsfe-x64.exe = |
||||
apnadkarni/tcl-sfe release, tclkit86bi.exe, tclkit902.exe, tclsh901k/t.exe, |
||||
tclsh902z*.exe - the last looking locally built pre-suite) have NO sidecars at |
||||
all, only sha1sums.txt coverage. Nothing machine-readable distinguishes build |
||||
origin; this goal fills that gap with the same schema rather than a parallel |
||||
mechanism. |
||||
|
||||
Consent decision (user, 2026-07-26): keyed to SERVER TRUST, not artifact |
||||
origin - curating an artifact onto one's own punkbin is the consent act, so |
||||
labels are transparency and prompts appear only for servers outside the |
||||
trusted set. No new prompts may appear in existing flows, e.g the unattended |
||||
constraint fetch of tclsfe-x64 for the static-runtime suite (G-058, achieved - |
||||
see goals/archive/G-058-static-runtime-packages.md). |
||||
|
||||
## Approach |
||||
|
||||
- Extend, don't fork, the archived machinery: the -r<N> immutable artifact |
||||
tier + working-copy materialization + platforms/defaults server manifests |
||||
(G-103, achieved - see goals/archive/G-103-runtime-kit-family.md) and the |
||||
freshness verdict, httpfixture test harness and row vocabulary (G-119, |
||||
achieved - see goals/archive/G-119-runtime-active-freshness.md). |
||||
- Explicit target-tier argument on list/use/fetch in both payloads; ps1+bash |
||||
single-line row parity and restrained width per the established listing |
||||
conventions; third-party rows get a compact origin tag in the sparse notes |
||||
column of list -remote, full provenance in per-name detail; suite-built |
||||
rows stay quiet (expected state). |
||||
- Artifact-toml schema v2 (successor to the G-117 schema v1, achieved - see |
||||
goals/archive/G-117-self-describing-runtimes.md; the schema field exists |
||||
for this): [provenance] class = suite-built|third-party|local, builder, |
||||
source_url, upstream_ref, retrieved. The builder-vs-packager split is |
||||
deliberate: builder compiled the binary, packager (existing field) curated |
||||
it onto the server. Emission: family_artifacts.tcl for suite artifacts; |
||||
authored sidecars for third-party ingests; retroactive backfill for the |
||||
existing third-party items is ADDITIVE ONLY (artifact bytes, bare |
||||
pre-family names and the sha1sums.txt integrity authority untouched). |
||||
- Trusted-server set: the canonical punkbin origin trusted by default; the |
||||
configuration surface (list membership, acknowledgement recording) is |
||||
settled in the work, coordinated with G-006's consent pattern. |
||||
|
||||
## Alternatives considered |
||||
|
||||
- Artifact-origin-keyed consent - rejected (user decision 2026-07-26): it |
||||
adds prompts to already-curated flows; server-set membership is the real |
||||
trust boundary today. |
||||
- Signing/attestation in this goal - deferred deliberately (user: "signing |
||||
for down the track"): minisign sidecars are already anticipated by the |
||||
schema's packager comment and become the natural successor goal when |
||||
third-party tiers or alternative servers are routine. Until then sha1sums |
||||
remain transport-integrity only, and the docs say so plainly. |
||||
- A separate server namespace for third-party artifacts - rejected: |
||||
provenance belongs on the artifact record, not the URL layout; mirrors |
||||
would lose it. |
||||
|
||||
## Notes |
||||
|
||||
- Depends on: G-122 (canon tags, target-keyed stores, non-default-target |
||||
mapping entries - the end-to-end acceptance item consumes its fixture-tier |
||||
support). |
||||
- Related: G-006 - consent-gated binary downloads; the untrusted-server gate |
||||
here is a concrete consumer (interim documented flag if this lands first). |
||||
- Related: G-067 - artifact-channel kinship (module tier vs runtime tier); |
||||
G-116 already points punkbin publication at the G-067 library class. |
||||
- Related: G-105 - first-party cross-target tiers arrive via zig -target and |
||||
ride the same server surfaces this goal extends. |
||||
- Related: G-101 - a served 8.6-container tier would ride this mechanism. |
||||
- Signing deferred by user decision 2026-07-26 ("server trust ... with |
||||
signing for down the track") - flag a dedicated signing/attestation goal |
||||
when the first genuinely external tier or server appears. |
||||
@ -1,4 +1,4 @@
|
||||
[project] |
||||
name = "punkshell" |
||||
version = "0.23.1" |
||||
version = "0.24.1" |
||||
license = "BSD-2-Clause" |
||||
|
||||
Binary file not shown.
@ -0,0 +1,237 @@
|
||||
# -*- tcl -*- |
||||
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt |
||||
# |
||||
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem. |
||||
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository. |
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
# (C) 2026 |
||||
# |
||||
# @@ Meta Begin |
||||
# Application punk::platform 0.1.0 |
||||
# Meta platform tcl |
||||
# Meta license BSD |
||||
# @@ Meta End |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
## Requirements |
||||
package require platform ;#Tcl's own platform package (vendored 1.0.19 in kits; 1.1.x in tcl9 core) - the RAW identifier underneath this module's normalization |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
namespace eval punk::platform { |
||||
#punk::platform - the CANONICAL punkshell platform naming layer (2026-07-22 |
||||
#platform-folder synchronization; groundwork for the G-105 cross-target arc). |
||||
# |
||||
#punkshell artifact trees are organized by PLATFORM-DIR names of the form |
||||
#<os>-<cpu> (e.g win32-x86_64), used by: the punkbin artifact repo's top-level |
||||
#folders, bin/runtime/<platform>/ (the runtime store punk-runtime manages), |
||||
#lib_tclX/<platform> + vendorlib_tclX/<platform> auto_path dirs (wired by the |
||||
#boot machinery), and the G-103 runtime artifact metadata 'target' field. |
||||
# |
||||
#Tcl's platform package remains the raw identifier (platform::generic / |
||||
#platform::identify) but its outputs vary by version and pass some machine |
||||
#names through unmapped - the differences this module's normalize absorbs: |
||||
# - cpu 'amd64' (BSD machine names) -> x86_64 |
||||
# - cpu 'aarch64' (linux arm64) -> arm64 |
||||
# - os 'macos' (platform 1.1.x on osVersion>19; older versions and the |
||||
# boot's snipped copy say 'macosx') -> macosx |
||||
# - macosx cpu 'arm' -> arm64 (platform::generic's 'arm*' glob collapses |
||||
# the darwin 'arm64' machine name to 'arm'; Apple silicon is 64-bit only, |
||||
# so the arm token on macosx always means arm64. Elsewhere 'arm' is a |
||||
# genuine 32-bit token and is preserved.) |
||||
#The special name 'macosx' (no cpu suffix) is the RUNTIME-tier convention for |
||||
#universal (multi-arch) macOS binaries - punkbin and bin/runtime keep one |
||||
#universal folder; the per-arch macosx-x86_64/macosx-arm64 names serve the |
||||
#lib-tree tier where per-arch payloads are the norm. |
||||
# |
||||
#The boot machinery (punkboot::lib in src/vfs/_config/punk_main.tcl / |
||||
#project_main.tcl and src/make.tcl) cannot 'package require' at its stage and |
||||
#carries a snipped platform::generic plus an inline copy of THIS module's |
||||
#normalization mapping - if the mapping here changes, those copies must |
||||
#change with it (each carries a pointer comment to this module). |
||||
|
||||
namespace eval argdoc { |
||||
variable PUNKARGS |
||||
} |
||||
|
||||
#canonical platform records. status: |
||||
# supported - a punkshell target: artifact trees exist or are planned and |
||||
# tooling/build arcs (G-103/G-105) treat it as a real target |
||||
# dormant - recognized and folders may exist, but utility is under review |
||||
# recognized - a name the naming scheme reserves; no artifacts or tooling yet |
||||
#tiers: which artifact-tree tiers use the name - |
||||
# runtime = punkbin platform folders + bin/runtime/<platform>/ |
||||
# lib = lib_tclX/<platform> + vendorlib_tclX/<platform> auto_path dirs |
||||
#buildsuite: whether OUR zig buildsuite system (src/buildsuites; G-103 kit |
||||
#family, G-105 cross-target) produces runtimes for the platform. A SEPARATE |
||||
#AXIS from tiers deliberately: punkbin (or a third-party repo using the same |
||||
#structure) can host runtimes built by any mechanism - a platform can be |
||||
#runtime-tier hosted while buildsuite=none (we may never build it ourselves). |
||||
# supported - a tracked suite produces family artifacts today |
||||
# planned - named in an active/proposed goal (e.g G-105 linux-first) |
||||
# candidate - plausible zig target, no committed goal |
||||
# none - no build intention; hosted/third-party runtimes only |
||||
variable platforms { |
||||
win32-x86_64 {status supported tiers {runtime lib} buildsuite supported notes "primary development platform (suite_tcl90)"} |
||||
win32-ix86 {status supported tiers {runtime lib} buildsuite candidate notes "32-bit x86; hosting for available third-party runtimes/libs - zig can target it but a buildsuite is undetermined"} |
||||
linux-x86_64 {status supported tiers {runtime lib} buildsuite planned notes "G-105 first cross-target, WSL-verified"} |
||||
linux-arm64 {status supported tiers {runtime lib} buildsuite candidate notes "aarch64; punkbin's existing arm kit predates the arm64 name and sits in linux-arm"} |
||||
linux-arm {status supported tiers {runtime lib} buildsuite candidate notes "32-bit arm"} |
||||
macosx {status supported tiers {runtime} buildsuite candidate notes "universal (multi-arch) macOS binaries - runtime tier keeps one folder; zig darwin cross needs SDK work"} |
||||
macosx-x86_64 {status supported tiers {lib} buildsuite none notes "would follow a macosx runtime arc"} |
||||
macosx-arm64 {status supported tiers {lib} buildsuite none notes "Apple silicon; would follow a macosx runtime arc"} |
||||
freebsd-x86_64 {status supported tiers {runtime lib} buildsuite candidate notes ""} |
||||
freebsd-arm64 {status supported tiers {runtime lib} buildsuite candidate notes "no artifacts yet"} |
||||
msys-x86_64 {status dormant tiers {lib} buildsuite none notes "msys/cygwin-built tclsh runtimes; utility under review"} |
||||
openbsd-x86_64 {status recognized tiers {runtime} buildsuite none notes "hosted third-party runtimes possible"} |
||||
netbsd-x86_64 {status recognized tiers {runtime} buildsuite none notes "hosted third-party runtimes possible"} |
||||
dragonflybsd-x86_64 {status recognized tiers {runtime} buildsuite none notes "hosted third-party runtimes possible"} |
||||
} |
||||
|
||||
namespace eval argdoc { |
||||
variable PUNKARGS |
||||
lappend PUNKARGS [list { |
||||
@id -id ::punk::platform::platforms |
||||
@cmd -name punk::platform::platforms\ |
||||
-summary\ |
||||
"Canonical punkshell platform records."\ |
||||
-help\ |
||||
"Return the canonical punkshell platform-name records as a dict |
||||
keyed by platform-dir name (e.g win32-x86_64). Each value is a |
||||
dict with keys: |
||||
status supported|dormant|recognized |
||||
tiers which artifact-tree tiers use the name |
||||
(runtime = punkbin + bin/runtime folders, |
||||
lib = lib_tclX/vendorlib_tclX auto_path dirs) |
||||
buildsuite supported|planned|candidate|none - whether the |
||||
punkshell zig buildsuite system produces |
||||
runtimes for the platform. Deliberately a |
||||
separate axis from tiers: punkbin-structured |
||||
repos can host runtimes built by any mechanism, |
||||
so a platform can be runtime-tier hosted while |
||||
buildsuite=none. |
||||
notes free-text qualifiers |
||||
These names are the contract for punkbin platform folders, |
||||
bin/runtime/<platform>/, lib_tclX/vendorlib_tclX platform |
||||
dirs and the G-103 runtime-artifact metadata target field. |
||||
See also 'help platforms' in the punk shell." |
||||
@values -min 0 -max 0 |
||||
}] |
||||
} |
||||
proc platforms {} { |
||||
variable platforms |
||||
return $platforms |
||||
} |
||||
|
||||
namespace eval argdoc { |
||||
variable PUNKARGS |
||||
lappend PUNKARGS [list { |
||||
@id -id ::punk::platform::normalize |
||||
@cmd -name punk::platform::normalize\ |
||||
-summary\ |
||||
"Normalize a platform identifier to the canonical punkshell name."\ |
||||
-help\ |
||||
"Normalize a platform::generic-style <os>-<cpu> identifier (or an |
||||
already-canonical punkshell name) to the canonical punkshell |
||||
platform-dir name: |
||||
cpu amd64 -> x86_64, aarch64 -> arm64 |
||||
os macos -> macosx (Tcl platform 1.1.x renamed modern macOS) |
||||
macosx cpu arm -> arm64 (platform::generic's arm* glob folds |
||||
the darwin arm64 machine name to arm; Apple silicon is |
||||
64-bit only - non-macosx 'arm' stays 32-bit arm) |
||||
Unrecognized os/cpu tokens pass through unchanged - normalize |
||||
never invents names, it only folds known aliases." |
||||
@values -min 1 -max 1 |
||||
platform -type string -help\ |
||||
"Platform identifier, e.g the result of platform::generic." |
||||
}] |
||||
} |
||||
proc normalize {platform} { |
||||
set parts [split $platform -] |
||||
if {[llength $parts] < 2} { |
||||
#single-token names (e.g the universal 'macosx') - fold macos only |
||||
if {$platform eq "macos"} { |
||||
return macosx |
||||
} |
||||
return $platform |
||||
} |
||||
#os may itself contain a dash in principle - treat last token as cpu |
||||
set cpu [lindex $parts end] |
||||
set os [join [lrange $parts 0 end-1] -] |
||||
switch -- $os { |
||||
macos {set os macosx} |
||||
} |
||||
switch -- $cpu { |
||||
amd64 {set cpu x86_64} |
||||
aarch64 {set cpu arm64} |
||||
i386 - i486 - i586 - i686 {set cpu ix86} |
||||
arm { |
||||
if {$os eq "macosx"} { |
||||
set cpu arm64 |
||||
} |
||||
} |
||||
} |
||||
return "${os}-${cpu}" |
||||
} |
||||
|
||||
namespace eval argdoc { |
||||
variable PUNKARGS |
||||
lappend PUNKARGS [list { |
||||
@id -id ::punk::platform::local |
||||
@cmd -name punk::platform::local\ |
||||
-summary\ |
||||
"Canonical punkshell platform name of the running interpreter."\ |
||||
-help\ |
||||
"Return the canonical punkshell platform-dir name for the running |
||||
interpreter: platform::generic normalized per |
||||
punk::platform::normalize. |
||||
With -tier runtime, macosx per-arch names collapse to the |
||||
universal 'macosx' (the runtime-store convention: punkbin and |
||||
bin/runtime keep one universal macOS folder; the same collapse |
||||
src/make.tcl applies when locating bin/runtime/<platform>). |
||||
-tier lib (the default) returns the per-arch name used by the |
||||
lib_tclX/vendorlib_tclX auto_path dirs." |
||||
@opts |
||||
-tier -type string -default lib -choices {lib runtime} -help\ |
||||
"Artifact-tree tier the name is for." |
||||
@values -min 0 -max 0 |
||||
}] |
||||
} |
||||
proc local {args} { |
||||
set tier lib |
||||
foreach {k v} $args { |
||||
switch -- $k { |
||||
-tier { |
||||
if {$v ni {lib runtime}} { |
||||
error "punk::platform::local - invalid -tier '$v' (expected lib|runtime)" |
||||
} |
||||
set tier $v |
||||
} |
||||
default { |
||||
error "punk::platform::local - unknown option '$k' (known: -tier)" |
||||
} |
||||
} |
||||
} |
||||
set p [normalize [::platform::generic]] |
||||
if {$tier eq "runtime" && [string match macosx-* $p]} { |
||||
return macosx |
||||
} |
||||
return $p |
||||
} |
||||
} |
||||
|
||||
|
||||
namespace eval ::punk::args::register { |
||||
#use fully qualified so 8.6 doesn't find existing var in global namespace |
||||
lappend ::punk::args::register::NAMESPACES ::punk::platform |
||||
} |
||||
|
||||
|
||||
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++ |
||||
## Ready |
||||
package provide punk::platform [namespace eval punk::platform { |
||||
variable version |
||||
set version 0.1.0 |
||||
}] |
||||
return |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
package require tcltest |
||||
|
||||
#Piped characterization of the make.tcl bakelist report and the bake-side selective |
||||
#kit-name validation (goal G-121). Runs the WORKING TREE's src/make.tcl under the |
||||
#built punk executable's 'script' subcommand with output captured through a pipe, |
||||
#and pins: |
||||
# - 'bakelist' exits 0, output is ESC-free (G-113 piped policy), the stable header |
||||
# row is present and the punk91 row carries the expected type/runtime/vfs columns |
||||
# with a deployed state from the documented vocabulary |
||||
# - 'bakelist <kitname>' filters to the named entry and appends the per-kit detail |
||||
# block; unfiltered rows do not appear |
||||
# - 'bakelist <unknown>' exits 1 naming the unknown and listing the configured names |
||||
# - 'bake <unknown>' exits 1 BEFORE any build ("nothing built"), listing the |
||||
# configured names - the no-build guarantee of selective bake |
||||
#The row pins are characterization of the current src/runtime/mapvfs.config kit |
||||
#matrix (punk91 = tclsfe-x64 + punk9wintk903.vfs, zip) - a deliberate config change |
||||
#legitimately updates them. |
||||
# |
||||
#Target executable resolved from env(PUNK_SHELL_TEST_EXE), else <projectroot>/bin/punk902z.exe |
||||
#then <projectroot>/bin/punkshell902. Skipped (constraint punkexeavailable) if none found. |
||||
|
||||
namespace eval ::testspace { |
||||
namespace import ::tcltest::* |
||||
|
||||
variable testdir [file dirname [file normalize [info script]]] |
||||
#<projectroot>/src/tests/shell/testsuites/punkexe -> 5 levels up to <projectroot> |
||||
variable projectroot [file normalize [file join $testdir .. .. .. .. ..]] |
||||
variable maketcl [file join $projectroot src make.tcl] |
||||
|
||||
variable punkexe "" |
||||
if {[info exists ::env(PUNK_SHELL_TEST_EXE)] && $::env(PUNK_SHELL_TEST_EXE) ne ""} { |
||||
set punkexe [file normalize $::env(PUNK_SHELL_TEST_EXE)] |
||||
} else { |
||||
foreach candidate [list [file join $projectroot bin punk902z.exe] [file join $projectroot bin punkshell902]] { |
||||
if {[file exists $candidate]} { |
||||
set punkexe $candidate |
||||
break |
||||
} |
||||
} |
||||
} |
||||
testConstraint punkexeavailable [expr {$punkexe ne "" && [file exists $punkexe]}] |
||||
|
||||
variable maketcl_run_timeout_ms 60000 |
||||
|
||||
variable runstate |
||||
array set runstate {} |
||||
|
||||
proc maketcl_run_read {chan} { |
||||
variable runstate |
||||
append runstate(output) [read $chan] |
||||
if {[chan eof $chan]} { |
||||
chan event $chan readable {} |
||||
set runstate(done) eof |
||||
} |
||||
} |
||||
|
||||
#Run <punkexe> script src/make.tcl <subcommand...> with output captured through a |
||||
#pipe (stdin half-closed for immediate EOF - make.tcl must never wait on stdin for |
||||
#these subcommands). Returns dict: timedout 0|1, exitcode <int|"">, output |
||||
#<combined stdout+stderr>. |
||||
proc maketcl_run {cmdargs} { |
||||
variable runstate |
||||
variable maketcl_run_timeout_ms |
||||
variable punkexe |
||||
variable maketcl |
||||
array unset runstate |
||||
set runstate(output) "" |
||||
set runstate(done) "" |
||||
|
||||
set chan [open |[list $punkexe script $maketcl {*}$cmdargs 2>@1] r+] |
||||
chan configure $chan -blocking 0 -translation binary |
||||
catch {chan close $chan write} ;#no stdin for the child - immediate EOF |
||||
set timerid [after $maketcl_run_timeout_ms [list set [namespace current]::runstate(done) timeout]] |
||||
chan event $chan readable [list [namespace current]::maketcl_run_read $chan] |
||||
while {$runstate(done) eq ""} { |
||||
vwait [namespace current]::runstate(done) |
||||
} |
||||
after cancel $timerid |
||||
set timedout [expr {$runstate(done) eq "timeout"}] |
||||
set exitcode "" |
||||
if {$timedout} { |
||||
catch {exec {*}[auto_execok taskkill] /F /T /PID [lindex [pid $chan] 0]} |
||||
catch {chan close $chan} |
||||
} else { |
||||
chan configure $chan -blocking 1 |
||||
if {[catch {chan close $chan} errdata errdict]} { |
||||
set exitcode [lindex [dict get $errdict -errorcode] end] |
||||
} else { |
||||
set exitcode 0 |
||||
} |
||||
} |
||||
return [dict create timedout $timedout exitcode $exitcode output $runstate(output)] |
||||
} |
||||
|
||||
proc esc_count {text} { |
||||
return [regexp -all {\x1b} $text] |
||||
} |
||||
|
||||
#added 2026-07-26 (agent, G-121) |
||||
test maketcl_bakelist_full_report {piped make.tcl bakelist: exit 0, ESC-free, header row + punk91 row with documented deployed vocabulary} -constraints {punkexeavailable} -body { |
||||
set r [maketcl_run {bakelist}] |
||||
set out [dict get $r output] |
||||
set result [list] |
||||
lappend result timedout [dict get $r timedout] exitcode [dict get $r exitcode] |
||||
lappend result esc [esc_count $out] |
||||
lappend result header [regexp {(?n)^kit\s+type\s+runtime\s+vfs\s+deployed\s*$} $out] |
||||
lappend result punk91row [regexp {(?n)^punk91\s+zip\s+tclsfe-x64\s+punk9wintk903\.vfs\s+(current|stale|absent|nobuild)\y} $out] |
||||
set result |
||||
} -result {timedout 0 exitcode 0 esc 0 header 1 punk91row 1} |
||||
|
||||
#added 2026-07-26 (agent, G-121) |
||||
test maketcl_bakelist_filtered_detail {bakelist punk91 filters to the named entry and appends the per-kit detail block} -constraints {punkexeavailable} -body { |
||||
set r [maketcl_run {bakelist punk91}] |
||||
set out [dict get $r output] |
||||
set result [list] |
||||
lappend result timedout [dict get $r timedout] exitcode [dict get $r exitcode] |
||||
lappend result punk91row [regexp {(?n)^punk91\s+zip\s+} $out] |
||||
lappend result otherrows [regexp {(?n)^(punk905|punkbi|punksys|punk86)\s} $out] |
||||
lappend result detailblock [regexp {(?n)^detail: punk91\s*$} $out] |
||||
lappend result detailpaths [regexp {(?n)^\s+build product: src/_build/punk91} $out] |
||||
set result |
||||
} -result {timedout 0 exitcode 0 punk91row 1 otherrows 0 detailblock 1 detailpaths 1} |
||||
|
||||
#added 2026-07-26 (agent, G-121) |
||||
test maketcl_bakelist_unknown_name {bakelist with an unknown kit name exits 1 naming it and listing the configured names} -constraints {punkexeavailable} -body { |
||||
set r [maketcl_run {bakelist nosuchkitxyz}] |
||||
set out [dict get $r output] |
||||
set result [list] |
||||
lappend result timedout [dict get $r timedout] exitcode [dict get $r exitcode] |
||||
lappend result named [regexp {bakelist: unknown kit name\(s\): nosuchkitxyz} $out] |
||||
lappend result confignames [regexp {configured kit outputs: .*punk91} $out] |
||||
set result |
||||
} -result {timedout 0 exitcode 1 named 1 confignames 1} |
||||
|
||||
#added 2026-07-26 (agent, G-121) |
||||
test maketcl_bake_unknown_name_no_build {bake with an unknown kit name exits 1 before any build, listing the configured names} -constraints {punkexeavailable} -body { |
||||
set r [maketcl_run {bake nosuchkitxyz}] |
||||
set out [dict get $r output] |
||||
set result [list] |
||||
lappend result timedout [dict get $r timedout] exitcode [dict get $r exitcode] |
||||
lappend result nothingbuilt [regexp {make\.tcl bake: unknown kit name\(s\): nosuchkitxyz - nothing built} $out] |
||||
lappend result confignames [regexp {configured kit outputs: .*punk91} $out] |
||||
#the run must never reach the kit machinery (no vfs scan / kit processing output) |
||||
lappend result nomachinery [expr {![regexp {processing targetkit:} $out]}] |
||||
set result |
||||
} -result {timedout 0 exitcode 1 nothingbuilt 1 confignames 1 nomachinery 1} |
||||
|
||||
cleanupTests |
||||
} |
||||
namespace delete ::testspace |
||||
Loading…
Reference in new issue