pacman-debian 7.2.0 → 7.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +22 -2
  2. package/README_zh-CN.md +89 -19
  3. package/dist/cli/paclink.d.ts.map +1 -0
  4. package/dist/cli/paclink.js +261 -0
  5. package/dist/cli/paclink.js.map +1 -0
  6. package/dist/cli/pacman.d.ts.map +1 -1
  7. package/dist/cli/pacman.js +64 -38
  8. package/dist/cli/pacman.js.map +1 -1
  9. package/dist/core/compress.d.ts.map +1 -1
  10. package/dist/core/compress.js +29 -0
  11. package/dist/core/compress.js.map +1 -1
  12. package/dist/core/deps.d.ts.map +1 -1
  13. package/dist/core/deps.js +133 -68
  14. package/dist/core/deps.js.map +1 -1
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/db/database.d.ts.map +1 -1
  17. package/dist/db/database.js +3 -1
  18. package/dist/db/database.js.map +1 -1
  19. package/dist/db/localdb.d.ts.map +1 -1
  20. package/dist/db/localdb.js +73 -4
  21. package/dist/db/localdb.js.map +1 -1
  22. package/dist/i18n/en.json +6 -0
  23. package/dist/i18n/index.d.ts.map +1 -1
  24. package/dist/i18n/index.js +52 -6
  25. package/dist/i18n/index.js.map +1 -1
  26. package/dist/i18n/paclink/en.d.ts.map +1 -0
  27. package/dist/i18n/paclink/en.js +62 -0
  28. package/dist/i18n/paclink/en.js.map +1 -0
  29. package/dist/i18n/paclink/zh-CN.d.ts.map +1 -0
  30. package/dist/i18n/paclink/zh-CN.js +62 -0
  31. package/dist/i18n/paclink/zh-CN.js.map +1 -0
  32. package/dist/i18n/setup/en.d.ts.map +1 -0
  33. package/dist/i18n/setup/en.js +49 -0
  34. package/dist/i18n/setup/en.js.map +1 -0
  35. package/dist/i18n/setup/zh-CN.d.ts.map +1 -0
  36. package/dist/i18n/setup/zh-CN.js +49 -0
  37. package/dist/i18n/setup/zh-CN.js.map +1 -0
  38. package/dist/i18n/zh-CN.json +6 -0
  39. package/dist/ops/install.d.ts.map +1 -1
  40. package/dist/ops/install.js +238 -45
  41. package/dist/ops/install.js.map +1 -1
  42. package/dist/ops/query.d.ts.map +1 -1
  43. package/dist/ops/query.js +25 -9
  44. package/dist/ops/query.js.map +1 -1
  45. package/dist/ops/remove.d.ts.map +1 -1
  46. package/dist/ops/remove.js +213 -42
  47. package/dist/ops/remove.js.map +1 -1
  48. package/dist/ops/upgrade.d.ts.map +1 -1
  49. package/dist/ops/upgrade.js +13 -15
  50. package/dist/ops/upgrade.js.map +1 -1
  51. package/dist/repo/repository.d.ts.map +1 -1
  52. package/dist/repo/repository.js +246 -90
  53. package/dist/repo/repository.js.map +1 -1
  54. package/dist/scripts/setup.js +119 -116
  55. package/dist/scripts/setup.js.map +1 -1
  56. package/package.json +18 -7
  57. package/README.zh.md +0 -388
  58. package/dist/ar.d.ts +0 -8
  59. package/dist/cli/pacman.d.ts +0 -2
  60. package/dist/compress.d.ts +0 -2
  61. package/dist/config.d.ts +0 -3
  62. package/dist/control.d.ts +0 -2
  63. package/dist/core/ar.d.ts +0 -7
  64. package/dist/core/compress.d.ts +0 -2
  65. package/dist/core/control.d.ts +0 -2
  66. package/dist/core/deb.d.ts +0 -4
  67. package/dist/core/deps.d.ts +0 -25
  68. package/dist/core/options.d.ts +0 -19
  69. package/dist/core/pkgfile.d.ts +0 -35
  70. package/dist/core/tar.d.ts +0 -13
  71. package/dist/core/types.d.ts +0 -83
  72. package/dist/database.d.ts +0 -20
  73. package/dist/db/database.d.ts +0 -17
  74. package/dist/db/dpkg-compat.d.ts +0 -19
  75. package/dist/db/localdb.d.ts +0 -9
  76. package/dist/db/sqlite.d.ts +0 -20
  77. package/dist/deb.d.ts +0 -5
  78. package/dist/dpkg-compat.d.ts +0 -18
  79. package/dist/i18n/index.d.ts +0 -3
  80. package/dist/index.d.ts +0 -3
  81. package/dist/install.d.ts +0 -2
  82. package/dist/makepkg/build.d.ts +0 -19
  83. package/dist/makepkg/index.d.ts +0 -3
  84. package/dist/makepkg/pkgbuild.d.ts +0 -36
  85. package/dist/ops/install.d.ts +0 -5
  86. package/dist/ops/query.d.ts +0 -9
  87. package/dist/ops/remove.d.ts +0 -3
  88. package/dist/ops/upgrade.d.ts +0 -4
  89. package/dist/pacman.d.ts +0 -2
  90. package/dist/query.d.ts +0 -5
  91. package/dist/remove.d.ts +0 -2
  92. package/dist/repo/config.d.ts +0 -3
  93. package/dist/repo/repository.d.ts +0 -10
  94. package/dist/repository.d.ts +0 -10
  95. package/dist/scripts/pacman-conf.d.ts +0 -3
  96. package/dist/scripts/setup.d.ts +0 -3
  97. package/dist/tar.d.ts +0 -17
  98. package/dist/types.d.ts +0 -80
  99. package/dist/ui/colors.d.ts +0 -13
  100. package/dist/ui/format.d.ts +0 -3
  101. package/dist/ui/progress.d.ts +0 -8
  102. package/dist/ui/prompt.d.ts +0 -4
  103. package/lib/pac4deb/Makefile +0 -26
  104. package/lib/pac4deb/README.md +0 -47
  105. package/lib/pac4deb/include/alpm.h +0 -166
  106. package/lib/pac4deb/include/alpm_list.h +0 -42
  107. package/lib/pac4deb/libalpm.so +0 -0
  108. package/lib/pac4deb/src/alpm_list.c +0 -102
  109. package/lib/pac4deb/src/genstubs.sh +0 -51
  110. package/lib/pac4deb/src/genstubs2.sh +0 -72
  111. package/lib/pac4deb/src/genstubs3.sh +0 -43
  112. package/lib/pac4deb/src/libalpm.c +0 -537
  113. package/lib/pac4deb/src/stubs_manual.c +0 -198
  114. package/lib/pac4deb/stubs.c +0 -6
  115. package/lib/pac4deb/update_header.sh +0 -15
  116. package/src/cli/pacman.ts +0 -308
  117. package/src/core/ar.ts +0 -54
  118. package/src/core/compress.ts +0 -27
  119. package/src/core/control.ts +0 -22
  120. package/src/core/deb.ts +0 -47
  121. package/src/core/deps.ts +0 -260
  122. package/src/core/options.ts +0 -20
  123. package/src/core/pkgfile.ts +0 -146
  124. package/src/core/tar.ts +0 -101
  125. package/src/core/types.ts +0 -89
  126. package/src/db/database.ts +0 -102
  127. package/src/db/dpkg-compat.ts +0 -129
  128. package/src/db/localdb.ts +0 -181
  129. package/src/i18n/en.json +0 -114
  130. package/src/i18n/index.ts +0 -32
  131. package/src/i18n/zh-CN.json +0 -114
  132. package/src/index.ts +0 -7
  133. package/src/makepkg/build.ts +0 -351
  134. package/src/makepkg/index.ts +0 -87
  135. package/src/makepkg/pkgbuild.ts +0 -146
  136. package/src/ops/install.ts +0 -260
  137. package/src/ops/query.ts +0 -117
  138. package/src/ops/remove.ts +0 -77
  139. package/src/ops/upgrade.ts +0 -87
  140. package/src/repo/config.ts +0 -96
  141. package/src/repo/repository.ts +0 -520
  142. package/src/scripts/pacman-conf.ts +0 -68
  143. package/src/scripts/setup.ts +0 -261
  144. package/src/ui/colors.ts +0 -40
  145. package/src/ui/format.ts +0 -9
  146. package/src/ui/progress.ts +0 -26
  147. package/src/ui/prompt.ts +0 -21
  148. package/tsconfig.json +0 -19
package/README.zh.md DELETED
@@ -1,388 +0,0 @@
1
- # pacman-debian
2
-
3
- 一个采用 Arch Linux pacman 命令行语法的包管理器,直接操作 Debian/Ubuntu `.deb`
4
- 包。它在 dpkg 层面管理包(绕过 APT),同时也支持原生 Arch Linux `.pkg.tar.zst`
5
- 包(通过内置 libalpm 兼容 yay 实现 AUR 支持)。
6
-
7
- ## 目标
8
-
9
- - 在基于 Debian 的系统上提供一致的 pacman 风格 CLI,消除 `apt`、`dpkg` 及
10
- 各种前端之间的切换成本。
11
- - 在单一工具下支持多仓库混合配置(Debian/Ubuntu + Arch Linux 仓库)。
12
- - 与 dpkg 数据库(`/var/lib/dpkg/status`)完全兼容,可与 APT 及其他 dpkg
13
- 前端共存。
14
- - 提供 libalpm ABI 兼容的共享库,使基于 Go 的 AUR 助手(yay)无需修改即可
15
- 在 Debian 上运行。
16
-
17
- ## 环境要求
18
-
19
- - Node.js 18+(TypeScript,通过 `tsc` 编译)
20
- - pnpm 包管理器
21
- - Debian 12 Bookworm(或兼容的 Debian 发行版),aarch64/arm64 架构
22
- - 安装、删除和升级操作需要 root 权限
23
- - 编译工具:`gcc`、`make`、`ldconfig`
24
-
25
- ## 快速开始
26
-
27
- ```bash
28
- # 编译 TypeScript + C 库
29
- pnpm install && pnpm build
30
-
31
- # 运行交互式安装(创建配置、符号链接、dpkg 条目)
32
- sudo node dist/scripts/setup.js
33
-
34
- # 或手动设置:
35
- sudo ln -sf "$PWD/dist/cli/pacman.js" /usr/local/bin/pacman
36
-
37
- # 同步仓库
38
- sudo pacman -Sy
39
-
40
- # 搜索包
41
- pacman -Ss neofetch
42
-
43
- # 安装
44
- sudo pacman -S neofetch
45
-
46
- # 升级所有包
47
- sudo pacman -Syu
48
-
49
- # 删除
50
- sudo pacman -R neofetch
51
- ```
52
-
53
- ## 配置
54
-
55
- 配置文件:`/etc/pacman-debian/pacman.conf`
56
-
57
- 配置使用纯 Arch Linux pacman 语法,支持 `Include` 指令。仓库特有键
58
- (`Type`、`Dist`、`Components` 等)放在 `/etc/pacman.d/` 的包含文件中。
59
-
60
- 配置示例:
61
-
62
- ```ini
63
- [options]
64
- Architecture = arm64
65
-
66
- [bookworm]
67
- Include = /etc/pacman.d/debian-bookworm
68
-
69
- [extra]
70
- Include = /etc/pacman.d/arch-extra
71
- ```
72
-
73
- 包含文件示例(`/etc/pacman.d/debian-bookworm`):
74
-
75
- ```
76
- Server = https://mirrors.tuna.tsinghua.edu.cn/debian
77
- Type = debian
78
- Dist = bookworm
79
- Components = main contrib non-free non-free-firmware
80
- ```
81
-
82
- Arch 仓库的包含文件(`/etc/pacman.d/arch-extra`):
83
-
84
- ```
85
- Server = http://mirror.archlinuxarm.org/$arch/$repo
86
- Type = arch
87
- Architecture = aarch64
88
- ```
89
-
90
- 安装时会创建 `/etc/pacman.conf` → `/etc/pacman-debian/pacman.conf` 符号链接,
91
- 以便硬编码该路径的工具(如 yay)正常工作。
92
-
93
- 使用 `pacman-conf` 查看解析后的配置(所有 `Include` 文件已展开,
94
- `$repo`/`$arch` 变量已替换):
95
-
96
- ```bash
97
- $ pacman-conf
98
- # pacman-debian configuration
99
- [options]
100
- Architecture = arm64
101
-
102
- [bookworm]
103
- Server = https://mirrors.tuna.tsinghua.edu.cn/debian
104
- Type = debian
105
- Dist = bookworm
106
- Components = main contrib non-free non-free-firmware
107
-
108
- [extra]
109
- Server = http://mirror.archlinuxarm.org/$arch/$repo
110
- Type = arch
111
- Architecture = aarch64
112
- ```
113
-
114
- ## 数据库
115
-
116
- ### 本地数据库:`/var/lib/pacman-debian/local/`
117
-
118
- 采用与 Arch Linux 本地 DB 一致的目录-包格式:
119
-
120
- ```
121
- /var/lib/pacman-debian/local/
122
- ├── by-name/
123
- │ ├── fastfetch -> ../fastfetch-2.64.2-2/
124
- │ └── ...
125
- ├── fastfetch-2.64.2-2/
126
- │ ├── desc # JSON 元数据(名称、版本、依赖、大小等)
127
- │ └── files # 文件清单
128
- └── ...
129
- ```
130
-
131
- ### dpkg 兼容
132
-
133
- 通过 `dpkg` 或 `apt` 安装的包在查询时直接从 `/var/lib/dpkg/status` 读取
134
- (按 mtime 缓存)。`pacman-debian` 安装包时会同时写入 dpkg 兼容的条目,
135
- 确保 `apt` 和 `dpkg` 仍能识别该包。
136
-
137
- ### 仓库缓存:`/var/cache/pacman-debian/packages/`
138
-
139
- 每个仓库以 JSON Lines 块形式缓存(每个 `.jsonl` 文件 5000 个包),
140
- 无需将全部数据加载到内存即可快速查找单个包。
141
-
142
- 单包操作如 `-S <pkg>` 使用 `findInRepo()` — 在目标 JSONL 块上进行原生
143
- Node.js 逐行扫描。由于每行都是一个完整的 JSON 对象,扫描可在
144
- O(N/分块数) 时间内找到目标包,无需解析其余 15 MB 数据。
145
-
146
- 列表操作(`-Sl`、`-Ss`、`-Su`)需要全量解析所有 JSONL 块,因为需要
147
- 获取每个包的信息。
148
-
149
- ## 仓库支持
150
-
151
- - **Debian/Ubuntu**:从标准仓库索引读取 `Packages.gz` / `Packages.xz`。
152
- 支持 `Server` URL 中的 `$repo`/`$arch` 变量替换。
153
- - **Arch Linux**:从 Arch 兼容仓库读取 `db.tar.gz`。下载的 `.pkg.tar.zst`
154
- 文件会被解包并安装。
155
- - **Arch ARM**:二进制包需要 glibc 2.38+ — Debian 12 自带 glibc 2.36,
156
- 因此在 Bookworm 上 Arch ARM 二进制仓库**无法使用**(升级 glibc 会损坏系统)。
157
- 请改用 `makepkg` 进行本地编译。
158
-
159
- ## libalpm (libpac4deb)
160
-
161
- 位于 `lib/pac4deb/` 的 C 库,实现了 libalpm ABI(`alpm.h`),使基于 Go 的
162
- AUR 助手(如 yay)无需修改即可在 Debian 上运行。它读取:
163
-
164
- - 本地数据库(`/var/lib/pacman-debian/local/`)— pacman-debian 安装的包
165
- - dpkg 状态(`/var/lib/dpkg/status`)— apt/dpkg 的系统包
166
- - 同步数据库(`/var/cache/pacman-debian/packages/*/` — JSONL 块)
167
-
168
- 提供了 200+ 个不常用函数的桩实现。
169
-
170
- ## makepkg (`src/makepkg/`)
171
-
172
- 独立的 `makepkg` 实现,无需 `base-devel` 或任何 Arch 工具即可从 PKGBUILD
173
- 构建 Arch Linux 包。
174
-
175
- ```bash
176
- # 从 PKGBUILD 构建包
177
- cd /path/to/PKGBUILD/dir
178
- makepkg --syncdeps --install
179
- ```
180
-
181
- 功能:
182
-
183
- - 通过 bash sourcing(`source PKGBUILD`)解析 PKGBUILD — 支持所有标准变量
184
- (`pkgname`、`pkgver`、`source`、`depends`、`makedepends`、
185
- `sha256sums` 等)
186
- - 下载并验证源文件(支持 http/https URL,带校验和验证)
187
- - 解压归档:`.tar.gz`、`.tar.xz`、`.tar.bz2`、`.tar.zst`、`.zip`
188
- - 在干净的环境中运行 `prepare()`、`build()`、`check()` 和 `package()` 函数
189
- - 创建带有有效 `.PKGINFO` 元数据的 `.pkg.tar.zst` 归档
190
- - 通过 `--syncdeps` 进行依赖解析 — 通过 pacman-debian 的同步数据库
191
- (Debian 和 Arch 仓库)安装缺失依赖
192
- - 支持 `--install`(`-i`)、`--clean`(`-c`)、`--rmdeps`
193
-
194
- 参数:
195
-
196
- | 参数 | 说明 |
197
- |------|------|
198
- | `-s, --syncdeps` | 通过 pacman 安装缺失依赖 |
199
- | `-i, --install` | 安装构建好的包 |
200
- | `-c, --clean` | 打包后清理构建文件 |
201
- | `-r, --rmdeps` | 构建后删除已安装的依赖 |
202
- | `-f, --force` | 覆盖已有的包文件 |
203
- | `-o, --nobuild` | 仅下载和解压源码(不构建) |
204
- | `--nocolor` | 禁用彩色输出 |
205
- | `--printsrcinfo` | 打印 `.SRCINFO` 并退出 |
206
-
207
- ## 命令
208
-
209
- ### 同步 (-S)
210
-
211
- | 命令 | 说明 |
212
- |------|------|
213
- | `pacman -S <pkg>` | 从仓库安装包 |
214
- | `pacman -Sy` | 刷新包数据库(mtime 检查,24 小时) |
215
- | `pacman -Syy` | 强制刷新包数据库 |
216
- | `pacman -Su` | 升级所有已安装的包 |
217
- | `pacman -Syu` | 刷新数据库并升级 |
218
- | `pacman -Ss <keyword>` | 搜索仓库 |
219
- | `pacman -Si <pkg>` | 显示远程包信息 |
220
- | `pacman -Sl` | 列出仓库中所有包 |
221
- | `pacman -Sw <pkg>` | 只下载不安装 |
222
- | `pacman -Sc` | 删除未使用的缓存包 |
223
- | `pacman -Scc` | 删除所有缓存(含仓库数据) |
224
- | `pacman -Sp <pkg>` | 打印将要安装的内容(干运行) |
225
-
226
- ### 删除 (-R)
227
-
228
- | 命令 | 说明 |
229
- |------|------|
230
- | `pacman -R <pkg>` | 删除包 |
231
- | `pacman -Rs <pkg>` | 删除包及未使用的依赖 |
232
- | `pacman -Rns <pkg>` | 删除包、依赖并跳过脚本 |
233
- | `pacman -Rc <pkg>` | 级联删除:删除依赖该包的所有包 |
234
- | `pacman -Rdd <pkg>` | 跳过依赖检查强制删除 |
235
- | `pacman -Rp <pkg>` | 打印将要删除的内容(干运行) |
236
-
237
- ### 查询 (-Q)
238
-
239
- | 命令 | 说明 |
240
- |------|------|
241
- | `pacman -Q` | 列出所有已安装的包 |
242
- | `pacman -Qe` | 列出显式安装的包 |
243
- | `pacman -Qd` | 列出作为依赖安装的包 |
244
- | `pacman -Qdt` | 列出孤儿包(未使用的依赖) |
245
- | `pacman -Qi <pkg>` | 显示详细包信息 |
246
- | `pacman -Ql <pkg>` | 列出包拥有的文件 |
247
- | `pacman -Qo <file>` | 查询文件属于哪个包 |
248
- | `pacman -Qs <keyword>` | 搜索已安装的包 |
249
- | `pacman -Qk [pkg]` | 验证已安装包的文件完整性 |
250
-
251
- ### 其他
252
-
253
- | 命令 | 说明 |
254
- |------|------|
255
- | `pacman -U <file>` | 安装本地包文件(.deb/.pkg.tar.zst) |
256
- | `pacman -D --asdeps <pkg>` | 将包标记为依赖 |
257
- | `pacman -D --asexplicit <pkg>` | 将包标记为显式安装 |
258
- | `pacman -T <pkg>` | 检查依赖是否满足 |
259
- | `pacman -F <file>` | 搜索提供该文件的包 |
260
- | `pacman -V` | 显示版本号 |
261
-
262
- ### 内置工具
263
-
264
- | 命令 | 说明 |
265
- |------|------|
266
- | `pacman-conf` | 打印解析后的配置(类似 Arch 的 `pacman-conf`)。查看每个仓库的 Server URL、Type、Dist、Components。 |
267
- | `makepkg` | 从 PKGBUILD 文件构建 Arch Linux 包。支持 `--syncdeps`、`--install`、`--clean`、源码下载和 `.pkg.tar.zst` 创建。 |
268
- | `pacman-debian-setup` | 交互式安装:创建配置、Include 文件、符号链接(`/etc/pacman.conf`、`/usr/local/bin/pacman`)和虚拟 `pacman` dpkg 条目。 |
269
-
270
- ### 全局参数
271
-
272
- | 参数 | 说明 |
273
- |------|------|
274
- | `--noconfirm` | 跳过确认提示 |
275
- | `--confirm` | 始终询问确认(默认) |
276
- | `--needed` | 不重新安装已是最新的包 |
277
- | `--noscriptlet` | 不执行安装脚本 |
278
- | `--print` | 干运行:显示将要执行的操作但不实际执行 |
279
-
280
- ## 依赖引擎
281
-
282
- 依赖解析器(`src/core/deps.ts`)支持:
283
-
284
- - 带版本约束的包名解析(`>=`、`<=`、`=`)
285
- - OR 依赖(`|`)
286
- - 架构限定符(`:arm64`)
287
- - Debian(逗号分隔)和 Arch(空格分隔)两种格式
288
- - 带预加载 DB 状态的 BFS 解析
289
- - 已安装和待安装包之间的冲突检测
290
- - 系统包保护(glibc、libc6 等)
291
-
292
- 版本比较委托给 `dpkg --compare-versions`,带有数字/字符串回退。
293
-
294
- ## 架构
295
-
296
- ```
297
- src/
298
- ├── cli/pacman.ts # CLI 参数解析和分发
299
- ├── core/ # 包格式解析器、依赖引擎
300
- │ ├── ar.ts # ar 归档解析器
301
- │ ├── tar.ts # tar 提取器
302
- │ ├── deb.ts # .deb 包解析器
303
- │ ├── pkgfile.ts # .pkg.tar.zst 解析器
304
- │ ├── compress.ts # gz/xz 解压缩
305
- │ ├── control.ts # Debian control 文件解析器
306
- │ └── deps.ts # 依赖解析引擎
307
- ├── db/
308
- │ ├── localdb.ts # 目录式本地包数据库
309
- │ ├── database.ts # 带事务的 DB 封装
310
- │ └── dpkg-compat.ts # dpkg 状态文件读写
311
- ├── ops/
312
- │ ├── install.ts # 包安装
313
- │ ├── remove.ts # 包删除
314
- │ ├── query.ts # 所有 -Q 查询
315
- │ └── upgrade.ts # 同步 + 升级流程
316
- ├── repo/
317
- │ ├── repository.ts # 仓库同步、下载、JSONL 缓存
318
- │ └── config.ts # pacman.conf 解析器(支持 Include)
319
- ├── scripts/
320
- │ └── setup.ts # 交互式安装脚本
321
- ├── makepkg/
322
- │ ├── index.ts # makepkg 主入口
323
- │ ├── pkgbuild.ts # PKGBUILD 解析器
324
- │ ├── source.ts # 源码下载/解压
325
- │ ├── build.ts # build()/package() 执行
326
- │ └── printsrcinfo.ts # .SRCINFO 生成
327
- ├── ui/ # 用户界面(提示、格式化)
328
- └── index.ts # 入口
329
- ```
330
-
331
- ## libalpm C 库
332
-
333
- ```
334
- lib/pac4deb/
335
- ├── Makefile # 用 gcc 构建,目标 libalpm.so
336
- ├── include/
337
- │ ├── alpm.h # 公共 libalpm API 头文件
338
- │ └── alpm_list.h # 链表头文件
339
- └── src/
340
- ├── libalpm.c # 核心实现(handle、db、pkg、JSON 解析器)
341
- ├── stubs_manual.c # ~200 个不常用 libalpm 函数的桩实现
342
- └── alpm_list.c # 链表实现
343
- ```
344
-
345
- 构建:`make -C lib/pac4deb`
346
- 安装:`sudo make -C lib/pac4deb install`
347
-
348
- ## yay / AUR 支持
349
-
350
- 通过内置 libalpm,`yay` 可与 `pacman-debian` 配合使用:
351
-
352
- ```bash
353
- # 安装 yay(需要 Go)
354
- sudo apt install golang-go
355
- git clone https://aur.archlinux.org/yay.git /tmp/yay
356
- cd /tmp/yay && go build -o /usr/local/bin/yay
357
-
358
- # 与 pacman-debian 配合使用
359
- PACMAN=/usr/local/bin/pacman yay -Ss ponysay
360
- PACMAN=/usr/local/bin/pacman sudo -E yay -S ponysay
361
- ```
362
-
363
- 注意:依赖 `python`(而非 `python3`)的 AUR 包在 Debian 12 上无法解析,
364
- 因为系统包名是 `python3`。安装 `python-is-python3` 或创建符号链接可解决。
365
-
366
- ## 构建
367
-
368
- ```bash
369
- pnpm install
370
- pnpm build # tsc + C 库
371
- # 或分步执行:
372
- pnpm exec tsc
373
- make -C lib/pac4deb # 构建 libalpm.so
374
- ```
375
-
376
- ## 项目状态
377
-
378
- 该项目在 v7.1.0 时更名为 `pacman-debian`。目前在 aarch64 Debian 12 上
379
- 可用于日常包管理。主要限制:
380
-
381
- - **Arch ARM 二进制仓库需要 glibc 2.38+** — Debian 12 自带 2.36。
382
- 本地 `makepkg` 构建可正常使用。
383
- - **yay 依赖解析**可在同步数据库中工作,但在复杂 AUR 依赖链上可能失败。
384
- - **AUR 助手集成**仅测试了 yay(paru、pamac 等未测试)。
385
-
386
- ## 许可证
387
-
388
- GNU General Public License v3.0
package/dist/ar.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export interface ArMember {
2
- name: string;
3
- size: number;
4
- data: Buffer;
5
- }
6
- export declare function parseAr(data: Buffer): ArMember[];
7
- export declare function parseDebFile(filePath: string): ArMember[];
8
- //# sourceMappingURL=ar.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function parseArgs(args: string[]): Promise<void>;
2
- //# sourceMappingURL=pacman.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function decompress(data: Buffer, filename: string): Buffer;
2
- //# sourceMappingURL=compress.d.ts.map
package/dist/config.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Config } from './types';
2
- export declare function loadConfig(): Config;
3
- //# sourceMappingURL=config.d.ts.map
package/dist/control.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function parseControlFile(content: string): Record<string, string>;
2
- //# sourceMappingURL=control.d.ts.map
package/dist/core/ar.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export interface ArMember {
2
- name: string;
3
- size: number;
4
- data: Buffer;
5
- }
6
- export declare function parseAr(data: Buffer): ArMember[];
7
- //# sourceMappingURL=ar.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function decompress(data: Buffer, filename: string): Buffer;
2
- //# sourceMappingURL=compress.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare function parseControlFile(content: string): Record<string, string>;
2
- //# sourceMappingURL=control.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { DebPackage } from './types';
2
- export declare function parseDeb(filePath: string): DebPackage;
3
- export declare function readScript(pkg: DebPackage, name: string): string | null;
4
- //# sourceMappingURL=deb.d.ts.map
@@ -1,25 +0,0 @@
1
- import type { RepoPkg } from './types';
2
- export interface Dep {
3
- name: string;
4
- version?: string;
5
- operator?: string;
6
- arch?: string;
7
- }
8
- export interface DepResult {
9
- pkg: RepoPkg;
10
- needed: boolean;
11
- reason: string;
12
- }
13
- export declare function parseDep(s: string): Dep[];
14
- export declare function resolveDeps(targets: string[]): {
15
- install: DepResult[];
16
- errors: string[];
17
- };
18
- export declare function invalidateDepCache(): void;
19
- export interface Conflict {
20
- a: string;
21
- b: string;
22
- reason: string;
23
- }
24
- export declare function detectConflicts(packages: RepoPkg[]): Conflict[];
25
- //# sourceMappingURL=deps.d.ts.map
@@ -1,19 +0,0 @@
1
- export interface InstallOptions {
2
- needed?: boolean;
3
- noscriptlet?: boolean;
4
- asdeps?: boolean;
5
- print?: boolean;
6
- }
7
- export interface RemoveOptions {
8
- recursive?: boolean;
9
- noscriptlet?: boolean;
10
- cascade?: boolean;
11
- nodeps?: boolean;
12
- nosave?: boolean;
13
- print?: boolean;
14
- }
15
- export interface DbOptions {
16
- asdeps?: boolean;
17
- asexplicit?: boolean;
18
- }
19
- //# sourceMappingURL=options.d.ts.map
@@ -1,35 +0,0 @@
1
- export interface PkgInfo {
2
- name: string;
3
- version: string;
4
- description?: string;
5
- depends?: string[];
6
- conflicts?: string[];
7
- provides?: string[];
8
- url?: string;
9
- license?: string[];
10
- arch?: string;
11
- installedSize?: number;
12
- size?: number;
13
- packager?: string;
14
- }
15
- export interface InstallScript {
16
- pre_install?: string;
17
- post_install?: string;
18
- pre_remove?: string;
19
- post_remove?: string;
20
- }
21
- export declare function parsePkgTarZst(data: Buffer): {
22
- info: PkgInfo;
23
- install?: InstallScript;
24
- files: string[];
25
- dataBlocks: {
26
- name: string;
27
- data: Buffer | null;
28
- }[];
29
- };
30
- export declare function extractArchTarEntry(name: string, dest: string, entries: {
31
- name: string;
32
- data: Buffer | null;
33
- }[]): void;
34
- export declare function parseDescFile(content: string): Record<string, string[]>;
35
- //# sourceMappingURL=pkgfile.d.ts.map
@@ -1,13 +0,0 @@
1
- export interface TarEntry {
2
- name: string;
3
- type: string;
4
- size: number;
5
- data: Buffer | null;
6
- linkname: string;
7
- mode: number;
8
- }
9
- export declare function iterateTar(buf: Buffer): Generator<TarEntry>;
10
- export declare function readFileFromTar(buf: Buffer, filePath: string): Buffer | null;
11
- export declare function extractTar(buf: Buffer, dest: string): string[];
12
- export declare function listTarEntries(buf: Buffer): string[];
13
- //# sourceMappingURL=tar.d.ts.map
@@ -1,83 +0,0 @@
1
- export interface DebControl {
2
- package: string;
3
- version: string;
4
- architecture: string;
5
- maintainer?: string;
6
- description?: string;
7
- depends?: string;
8
- 'pre-depends'?: string;
9
- conflicts?: string;
10
- provides?: string;
11
- 'installed-size'?: string;
12
- section?: string;
13
- priority?: string;
14
- homepage?: string;
15
- [key: string]: string | undefined;
16
- }
17
- export interface DebPackage {
18
- path: string;
19
- control: DebControl;
20
- controlTar: Buffer;
21
- dataTar: Buffer;
22
- }
23
- export interface InstalledPackage {
24
- name: string;
25
- version: string;
26
- architecture: string;
27
- description: string;
28
- depends?: string;
29
- 'pre-depends'?: string;
30
- conflicts?: string;
31
- provides?: string;
32
- maintainer?: string;
33
- homepage?: string;
34
- controlSection?: string;
35
- controlPriority?: string;
36
- installedSize?: number;
37
- installTime: number;
38
- reason: 'explicit' | 'dependency';
39
- files: string[];
40
- repoType?: 'debian' | 'arch';
41
- }
42
- export interface RepoPkg {
43
- package: string;
44
- version: string;
45
- architecture: string;
46
- description?: string;
47
- depends?: string;
48
- conflicts?: string;
49
- provides?: string;
50
- filename: string;
51
- size?: number;
52
- installedSize?: number;
53
- sha256?: string;
54
- repo: string;
55
- repoType: 'debian' | 'arch';
56
- }
57
- export interface RepoConfig {
58
- name: string;
59
- type?: 'debian' | 'arch';
60
- server: string;
61
- dist?: string;
62
- components?: string[];
63
- dbFile?: string;
64
- architecture?: string;
65
- }
66
- export interface Config {
67
- architecture: string;
68
- color: boolean;
69
- repos: RepoConfig[];
70
- }
71
- export interface Database {
72
- packages: Map<string, InstalledPackage>;
73
- fileIndex: Map<string, string>;
74
- }
75
- export interface Transaction {
76
- id: string;
77
- timestamp: number;
78
- action: 'install' | 'remove';
79
- package: string;
80
- version: string;
81
- completed: boolean;
82
- }
83
- //# sourceMappingURL=types.d.ts.map
@@ -1,20 +0,0 @@
1
- import type { InstalledPackage, Database, Transaction } from './types';
2
- export declare function initDb(): void;
3
- export declare function loadDatabase(): Database;
4
- export declare function saveDatabase(db: Database): void;
5
- export declare function isInstalled(db: Database, name: string): boolean;
6
- export declare function getPackage(db: Database, name: string): InstalledPackage | undefined;
7
- export declare function addPackage(db: Database, pkg: InstalledPackage): void;
8
- export declare function removePkg(db: Database, name: string): InstalledPackage | undefined;
9
- export declare function saveScript(pkgName: string, name: string, content: string): void;
10
- export declare function getScript(pkgName: string, name: string): string | null;
11
- export declare function runScript(pkgName: string, name: string, args: string[]): boolean;
12
- export declare function createTransaction(action: 'install' | 'remove', pkgName: string, version: string): Transaction;
13
- export declare function completeTransaction(txId: string): void;
14
- export interface DepEntry {
15
- name: string;
16
- constraint?: string;
17
- version?: string;
18
- }
19
- export declare function parseDepends(depStr?: string): DepEntry[];
20
- //# sourceMappingURL=database.d.ts.map
@@ -1,17 +0,0 @@
1
- import type { InstalledPackage, Database, Transaction } from '../core/types';
2
- export declare function initDb(): void;
3
- export declare function loadDatabase(): Database;
4
- export declare function saveDatabase(_db: Database): void;
5
- export declare function isInstalled(db: Database, name: string): boolean;
6
- export declare function getPackage(db: Database, name: string): InstalledPackage | undefined;
7
- export declare function addPackage(db: Database, pkg: InstalledPackage): void;
8
- export declare function removePkg(db: Database, name: string): InstalledPackage | undefined;
9
- export declare function saveScript(pkgName: string, name: string, content: string): void;
10
- export declare function runScript(pkgName: string, name: string, args: string[]): boolean;
11
- export declare function createTransaction(a: 'install' | 'remove', p: string, v: string): Transaction;
12
- export declare function completeTransaction(id: string): void;
13
- export interface DepEntry {
14
- name: string;
15
- }
16
- export declare function parseDepends(s?: string): DepEntry[];
17
- //# sourceMappingURL=database.d.ts.map
@@ -1,19 +0,0 @@
1
- import type { InstalledPackage } from '../core/types';
2
- export interface DpkgEntry {
3
- package: string;
4
- version: string;
5
- architecture: string;
6
- status: string;
7
- description?: string;
8
- maintainer?: string;
9
- depends?: string;
10
- installedSize?: number;
11
- section?: string;
12
- priority?: string;
13
- homepage?: string;
14
- }
15
- export declare function readDpkgStatus(): Map<string, DpkgEntry>;
16
- export declare function dpkgHasPackage(name: string): boolean;
17
- export declare function writeDpkgEntry(pkg: InstalledPackage): void;
18
- export declare function removeDpkgEntry(name: string): void;
19
- //# sourceMappingURL=dpkg-compat.d.ts.map
@@ -1,9 +0,0 @@
1
- import type { InstalledPackage } from '../core/types';
2
- export declare function addPackage(pkg: InstalledPackage): void;
3
- export declare function removePackage(name: string, version?: string): void;
4
- export declare function listPackageNames(): string[];
5
- export declare function getPackage(name: string): InstalledPackage | undefined;
6
- export declare function getAllPackages(): InstalledPackage[];
7
- export declare function getFileOwner(filePath: string): string | undefined;
8
- export declare function invalidateFileIndex(): void;
9
- //# sourceMappingURL=localdb.d.ts.map