Pure-MoonBit toolkit to build, inspect and verify Linux deb and rpm packages, without dpkg-deb or rpmbuild
Dependencies
状态:0.2.0 已发布到 mooncakes(Xpeng/linuxpkg)。deb 和 rpm 的构建、检查、校验都已可用。
| 功能 | 状态 |
|---|---|
| 构建 .deb(control、md5sums、conffiles、维护者脚本、软链接、目录、属主属组) | ✅ |
| 读取 / 检查 .deb(inspect,含 --json) | ✅ |
| 校验 .deb(verify:md5sums、gzip 校验和、路径安全) | ✅ |
| tar(ustar / PAX / GNU 长名)读写、ar 读写 | ✅ |
| linuxpkg.json 配置、依赖关系(libc6 (>= 2.31)) | ✅ |
| 构建 .rpm(文件摘要 SHA-256、头部摘要、payload 摘要、依赖关系、脚本、配置文件) | ✅ |
| 读取 / 检查 / 校验 .rpm(头部摘要、payload 摘要、每个文件的摘要) | ✅ |
| cpio(newc)读写 | ✅ |
| 依赖关系:depends、recommends、suggests、conflicts、replaces、provides(带版本约束) | ✅ |
| 读取 xz / zstd 压缩的包的元数据(inspect) | ✅ |
| 校验 xz / zstd 压缩的包的文件内容 | ❌ 明确报 unsupported |
moon add Xpeng/linuxpkgmoonx Xpeng/linuxpkg/cmd/main@0.2.0 inspect /绝对路径/hello_1.0.0-1_all.deb
moonx Xpeng/linuxpkg/cmd/main@0.2.0 verify /绝对路径/hello-1.0.0-1.noarch.rpmgit clone https://github.com/pxgt/linuxpkg
cd linuxpkg
moon build --target native cmd/main # Windows 上请用 wasm-gc,或在 WSL 里用 native
moon run cmd/main --target wasm-gc -- --helplinuxpkg init # 写出一份示例 linuxpkg.json
linuxpkg build examples/hello/linuxpkg.json --out dist # 同时生成 deb 和 rpm(--format deb|rpm|all)
linuxpkg inspect dist/hello_1.0.0-1_all.deb # 看元数据和文件列表
linuxpkg inspect dist/hello-1.0.0-1.noarch.rpm --json
linuxpkg verify dist/hello-1.0.0-1.noarch.rpm # 退出码 0 表示通过{
"name": "hello",
"version": "1.0.0",
"release": "1",
"arch": "all",
"maintainer": "Your Name <you@example.org>",
"description": "一行摘要\n后面几行是详细说明",
"mtime": 1700000000,
"depends": ["libc6 (>= 2.31)"],
"contents": [
{ "src": "hello.sh", "dst": "/usr/bin/hello", "mode": "0755" },
{ "src": "hello", "dst": "/usr/bin/hi", "type": "symlink" },
{ "src": "hello.conf", "dst": "/etc/hello.conf", "type": "config" },
{ "dst": "/var/lib/hello", "type": "dir" }
],
"scripts": { "postinstall": "scripts/postinst.sh" }
}moon fmt --check
moon info && git diff --exit-code # 公开接口 pkg.generated.mbti 要保持最新
moon check --target all --deny-warn
moon test --target wasm-gc # 也可以换 js、wasm;native 在 Linux/WSL 上跑
tools/oracle/run.sh # 需要 dpkg-deb、dpkg、sudo(可选 lintian)let VERSION : StringInstall
Download zipPure-MoonBit toolkit to build, inspect and verify Linux deb and rpm packages, without dpkg-deb or rpmbuild
Dependencies