Skip to content

Commit a1ee8aa

Browse files
committed
chore: migrate descriptors to SPEC-001 short-name identity (mcpp 0.0.106)
mcpp 0.0.106 restores the canonical identity form: `namespace` carries the hierarchy, `name` is a single atomic segment. 0.0.105 briefly required the opposite (name spelled as the fully-qualified `<namespace>.<name>`), which was an encoding constraint rather than a design rule — it existed only because mcpp re-derived the wire name instead of using the literal it had already read. namespace = "compat", name = "compat.zlib" -> name = "zlib" 45 descriptors migrated; the 3 namespace-less public module packages (imgui/ffmpeg/opencv) are unchanged — a bare name IS their full identity. Three short names now repeat across namespaces: `imgui`, `ffmpeg` and `lua` (compat's versus the default namespace's, and compat's `lua` versus mcpplibs.capi's). That is legal — identity is the PAIR, and only the pair has to be unique. It needs xlings >= 0.4.69 (openxlings/xlings#381), which keys the index by (namespace, name); 0.0.106 bundles it. Verified against a local path index: bare `imgui` resolves to `mcpplibs:imgui` and `[dependencies.compat] imgui` resolves to `compat:imgui`, each installing to its own store dir. check_package_name.lua is inverted to match: `name` must be atomic, hierarchy belongs in `namespace`, and the legacy fully-qualified spelling stays accepted (the prefix is stripped before judging) so nothing published before this is invalidated. No filename lint — the filename is not part of identity. min_mcpp/latest_mcpp move to 0.0.106 in lock-step with the CI pin. This one is NOT optional: a client older than 0.0.106 re-derives `<ns>.<short>`, misses the short-name key, and reports a bare E_NOT_FOUND with nothing pointing at the cause. Verified locally: all 48 descriptors pass the inverted lint; identity pairs are unique; no `name` still carries a dot; the three counterexamples (non-atomic short name, dotted name without a namespace, legacy FQN) each behave as specified.
1 parent 2ede9bd commit a1ee8aa

49 files changed

Lines changed: 137 additions & 93 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/validate.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ on:
1111
workflow_dispatch:
1212

1313
env:
14+
# 0.0.106: SPEC-001 package identity (mcpp#280). `package.name` is a SINGLE
15+
# ATOMIC SEGMENT — all hierarchy lives in `package.namespace` — and mcpp
16+
# addresses a package by the LITERAL name it read, so descriptors no longer
17+
# repeat their namespace inside `name`. This index is migrated to the short
18+
# form, which is why min_mcpp/latest_mcpp move in lock-step: an older client
19+
# re-derives `<ns>.<short>`, misses, and reports a bare E_NOT_FOUND. Bundles
20+
# xlings 0.4.69, which keys its index by (namespace, name) so two packages
21+
# sharing a short name in one index are both addressable (xlings#381) — this
22+
# index now has three such pairs (imgui / ffmpeg / lua under compat vs the
23+
# default namespace).
1424
# 0.0.102: windows command-line ceiling (mcpp#261 — the clang scan rule got
1525
# its P1689 JSON through shell redirection, which forced a `cmd /c` wrapper
1626
# and with it cmd.exe's 8191-char limit; clang-scan-deps -o removes both, and
@@ -47,7 +57,7 @@ env:
4757
# 0.0.94 fixed feature-gated `sources` under `mcpp test` (mcpp#218); 0.0.91
4858
# added standard = "c++fly" to the resolver grammar, so c++fly descriptors
4959
# get the lint WARN below, not a hard grammar-parse rejection.
50-
MCPP_VERSION: "0.0.102"
60+
MCPP_VERSION: "0.0.106"
5161

5262
jobs:
5363
lint:
@@ -90,14 +100,11 @@ jobs:
90100
if ! lua5.4 tests/check_mirror_urls.lua "$f"; then
91101
fail=1
92102
fi
93-
# 5. `name` must be the fully-qualified `<namespace>.<short>`.
94-
# The split form (namespace = "chriskohlhoff", name = "asio")
95-
# parses and passes `mcpp xpkg parse`, but xlings keys the index
96-
# on the literal `name` while mcpp asks for the reconstructed
97-
# FQN — they never meet, so the package is uninstallable on
98-
# every platform (mcpp-community/mcpp#278). This check is cheap
99-
# and catches in seconds what otherwise fails an hour into the
100-
# workspace job.
103+
# 5. `name` must be a SINGLE ATOMIC SEGMENT; hierarchy belongs in
104+
# `namespace` (mcpp SPEC-001 §3.2). The legacy fully-qualified
105+
# spelling stays accepted. Cheap second gate: it runs before the
106+
# pinned mcpp is even downloaded, and mcpp >= 0.0.106 enforces
107+
# the same rule inside `mcpp xpkg parse`.
101108
if ! lua5.4 tests/check_package_name.lua "$f"; then
102109
fail=1
103110
fi
@@ -207,21 +214,21 @@ jobs:
207214
ext: tar.gz
208215
mcpp: bin/mcpp
209216
xlings: registry/bin/xlings
210-
mcpp_version: "0.0.102" # keep in sync with env.MCPP_VERSION
217+
mcpp_version: "0.0.106" # keep in sync with env.MCPP_VERSION
211218
- platform: macos
212219
os: macos-15
213220
suffix: macosx-arm64
214221
ext: tar.gz
215222
mcpp: bin/mcpp
216223
xlings: registry/bin/xlings
217-
mcpp_version: "0.0.102" # keep in sync with env.MCPP_VERSION
224+
mcpp_version: "0.0.106" # keep in sync with env.MCPP_VERSION
218225
- platform: windows
219226
os: windows-latest
220227
suffix: windows-x86_64
221228
ext: zip
222229
mcpp: bin/mcpp.exe
223230
xlings: registry/bin/xlings.exe
224-
mcpp_version: "0.0.102" # keep in sync with env.MCPP_VERSION
231+
mcpp_version: "0.0.106" # keep in sync with env.MCPP_VERSION
225232
env:
226233
MCPP_EFFECTIVE: ${{ matrix.mcpp_version }}
227234
steps:

docs/repository-and-schema.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ tests/examples/<member>/ 每库测试工程(workspace 成员;<member> 为包
1313
([target.'cfg(...)'])
1414
tests/*.cpp 行为断言(独立 main,退出码非 0 即失败)
1515
tests/check_mirror_urls.lua lint:GLOBAL+CN 表完整性,以及 CN 指向 mcpp-res
16+
tests/check_package_name.lua lint:身份形态(name 为单一原子段,层级归 namespace)
1617
tests/list_cn_urls.lua 抽取 CN url,供 mirror-cn-reachable 使用
1718
README.md 索引说明与贡献入口
1819
.github/workflows/validate.yml CI:lint / mirror-cn-reachable / workspace(3 平台矩阵)
@@ -37,6 +38,24 @@ tools/compat-ffmpeg/ 等 compat 大包的描述符再生成流水线
3738

3839
`package` 必填字段:`spec``namespace``name``description``licenses``repo``type="package"``xpm``mcpp`
3940

41+
### 包身份:`(namespace, name)`
42+
43+
身份是二元组 —— **`namespace` 是点分层级路径,`name` 是单一原子段**。层级一律放 `namespace`(mcpp SPEC-001 §3.2,`docs/spec/package-identity.md`):
44+
45+
```lua
46+
namespace = "compat", name = "zlib" --
47+
namespace = "mcpplibs.capi", name = "lua" -- ✅ 多级命名空间
48+
namespace = "mcpplibs", name = "capi.lua" -- ❌ 短名仍带点
49+
```
50+
51+
最后一种被拒绝而非重新解读:`name` 里多出的点描述的是一个**没人声明过的命名空间**。mcpp 曾按最后一个点切分、静默造出 `(mcpplibs.capi, lua)`,0.0.106 起改为拒绝。
52+
53+
**兼容形态**:SPEC-001 之前发布的描述符把命名空间重复写在 `name` 里(`namespace="compat", name="compat.zlib"`),仍被接受 —— 前缀会先剥离再判定,wire key 是字面 `name`,两种写法都可安装。本仓已统一迁到短名形态。
54+
55+
**同短名不同命名空间可共存**:本仓现有三对 —— `compat:imgui` 与默认命名空间的 `imgui``compat:ffmpeg``ffmpeg``compat:lua``mcpplibs.capi:lua`。需要 xlings ≥ 0.4.69([xlings#381](https://github.com/openxlings/xlings/issues/381));`(namespace, name)` 唯一即可,`name` 本身不必唯一。
56+
57+
**文件名不参与解析**,可以任意。推荐 `<name>.lua``<namespace>.<name>.lua`(命中 mcpp 的快路径),但描述符按**声明的身份**被发现,叫别的名字也能解析。
58+
4059
`xpm.<linux|macosx|windows>.<裸版本>`:
4160

4261
- `url`:字符串,或 `{ GLOBAL=…, CN=… }` 表(本仓统一使用表形式)。
@@ -76,7 +95,9 @@ mcpp 跑 `xpkg parse`(strict:未知键即失败),所以需要更新文法/键的
7695
- 触发条件:PR(改动 `pkgs/**/*.lua``tests/**``README.md` 或本 workflow)、push 至 main、nightly cron、手动触发。
7796
- `env.MCPP_VERSION` 为全部 job 使用的 mcpp 版本,本地验证应与之对齐。
7897
- `lint`(始终运行):lua 语法 `loadfile(f,'t')`;须含 `spec=`/`name=`/`xpm=`;禁止前导 v 版本;执行
79-
`check_mirror_urls.lua`;再用 CI pin 的 mcpp 对每个描述符跑 `mcpp xpkg parse`(strict,未知键即失败)。
98+
`check_mirror_urls.lua`;执行 `check_package_name.lua`(身份形态,见上文「包身份」);再用 CI pin 的
99+
mcpp 对每个描述符跑 `mcpp xpkg parse`(strict,未知键即失败)。mcpp ≥ 0.0.106 的 `xpkg parse` 自身
100+
也强制身份形态,lua lint 因此是更早、更便宜的冗余闸门。
80101
- `mirror-cn-reachable`(始终运行):逐个 `curl` CN url,均须返回 200。
81102
- `workspace (linux|macos|windows)`:整个测试面就是一个 mcpp workspace,**唯一的构建/运行通道**——
82103
没有任何 shell 驱动的例外(公开模块包 imgui/ffmpeg/opencv/tinyhttps 也是普通成员,经成员级
@@ -96,6 +117,7 @@ for f in pkgs/*/*.lua; do
96117
for n in 'spec *=' 'name *=' 'xpm *='; do grep -q "$n" "$f" || { echo "MISS $n $f"; fail=1; }; done
97118
grep -nqE '\["v[0-9]+|\["[^"]+"\][[:space:]]*=[[:space:]]*"v[0-9]+' "$f" && { echo "LEADING-V $f"; fail=1; }
98119
lua5.4 tests/check_mirror_urls.lua "$f" >/dev/null 2>&1 || { echo "MIRROR $f"; fail=1; }
120+
lua5.4 tests/check_package_name.lua "$f" || fail=1
99121
done
100122
[ $fail -eq 0 ] && echo "ALL LINT PASS"
101123
```

index.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
# "floor first, new grammar after" rollout rule mechanically.
88
[index]
99
spec = "1"
10-
min_mcpp = "0.0.102"
11-
latest_mcpp = "0.0.102"
10+
min_mcpp = "0.0.106"
11+
latest_mcpp = "0.0.106"

pkgs/c/chriskohlhoff.asio.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ package = {
4646
-- identity normalizes both spellings) but registers the index entry under
4747
-- `asio`, which no consumer request can ever hit → E_NOT_FOUND at install.
4848
-- See mcpp-community/mcpp#278; the lint in validate.yml enforces this.
49-
name = "chriskohlhoff.asio",
49+
name = "asio",
5050
description = "Standalone asio exposed as the C++23 module `asio` (separate compilation)",
5151
licenses = {"BSL-1.0"},
5252
repo = "https://github.com/chriskohlhoff/asio",

pkgs/c/cmdline.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package = {
1212
spec = "1",
1313
namespace = "mcpplibs",
14-
name = "mcpplibs.cmdline",
14+
name = "cmdline",
1515
description = "A simple command-line parsing library/framework for modern C++",
1616
licenses = {"Apache-2.0"},
1717
repo = "https://github.com/mcpplibs/cmdline",

pkgs/c/compat.bzip2.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package = {
22
spec = "1",
33
namespace = "compat",
4-
name = "compat.bzip2",
4+
name = "bzip2",
55
description = "A freely available high-quality data compressor",
66
licenses = {"bzip2-1.0.6"},
77
repo = "https://sourceware.org/bzip2/",

pkgs/c/compat.cjson.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package = {
1212
spec = "1",
1313
namespace = "compat",
14-
name = "compat.cjson",
14+
name = "cjson",
1515
description = "Ultralightweight JSON parser in ANSI C",
1616
licenses = {"MIT"},
1717
repo = "https://github.com/DaveGamble/cJSON",

pkgs/c/compat.eigen.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
package = {
6464
spec = "1",
6565
namespace = "compat",
66-
name = "compat.eigen",
66+
name = "eigen",
6767
description = "C++ template library for linear algebra (header-only)",
6868
licenses = {"MPL-2.0"},
6969
repo = "https://gitlab.com/libeigen/eigen",

pkgs/c/compat.ffmpeg.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-- include_dirs_after (-idirafter, mcpp#249) so libc++ <version> is not shadowed
88
-- by ffmpeg's VERSION file on case-insensitive macOS.
99
package = {
10-
spec = "1", namespace = "compat", name = "compat.ffmpeg",
10+
spec = "1", namespace = "compat", name = "ffmpeg",
1111
description = "FFmpeg 8.1.2 multimedia libraries, full source build (LGPL profile, multi-platform)",
1212
licenses = {"LGPL-2.1-or-later"}, repo = "https://ffmpeg.org", type = "package",
1313
xpm = {

pkgs/c/compat.ftxui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
package = {
1212
spec = "1",
1313
namespace = "compat",
14-
name = "compat.ftxui",
14+
name = "ftxui",
1515
description = "C++ Functional Terminal User Interface (screen + dom + component)",
1616
licenses = {"MIT"},
1717
repo = "https://github.com/ArthurSonzogni/FTXUI",

0 commit comments

Comments
 (0)