pacman-debian 7.2.0

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 (233) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +440 -0
  3. package/README.zh.md +388 -0
  4. package/README_zh-CN.md +421 -0
  5. package/dist/ar.d.ts +8 -0
  6. package/dist/ar.d.ts.map +1 -0
  7. package/dist/ar.js +88 -0
  8. package/dist/ar.js.map +1 -0
  9. package/dist/cli/pacman.d.ts +2 -0
  10. package/dist/cli/pacman.d.ts.map +1 -0
  11. package/dist/cli/pacman.js +512 -0
  12. package/dist/cli/pacman.js.map +1 -0
  13. package/dist/compress.d.ts +2 -0
  14. package/dist/compress.d.ts.map +1 -0
  15. package/dist/compress.js +78 -0
  16. package/dist/compress.js.map +1 -0
  17. package/dist/config.d.ts +3 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +90 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/control.d.ts +2 -0
  22. package/dist/control.d.ts.map +1 -0
  23. package/dist/control.js +31 -0
  24. package/dist/control.js.map +1 -0
  25. package/dist/core/ar.d.ts +7 -0
  26. package/dist/core/ar.d.ts.map +1 -0
  27. package/dist/core/ar.js +45 -0
  28. package/dist/core/ar.js.map +1 -0
  29. package/dist/core/compress.d.ts +2 -0
  30. package/dist/core/compress.d.ts.map +1 -0
  31. package/dist/core/compress.js +75 -0
  32. package/dist/core/compress.js.map +1 -0
  33. package/dist/core/control.d.ts +2 -0
  34. package/dist/core/control.d.ts.map +1 -0
  35. package/dist/core/control.js +29 -0
  36. package/dist/core/control.js.map +1 -0
  37. package/dist/core/deb.d.ts +4 -0
  38. package/dist/core/deb.d.ts.map +1 -0
  39. package/dist/core/deb.js +89 -0
  40. package/dist/core/deb.js.map +1 -0
  41. package/dist/core/deps.d.ts +25 -0
  42. package/dist/core/deps.d.ts.map +1 -0
  43. package/dist/core/deps.js +230 -0
  44. package/dist/core/deps.js.map +1 -0
  45. package/dist/core/options.d.ts +19 -0
  46. package/dist/core/options.d.ts.map +1 -0
  47. package/dist/core/options.js +3 -0
  48. package/dist/core/options.js.map +1 -0
  49. package/dist/core/pkgfile.d.ts +35 -0
  50. package/dist/core/pkgfile.d.ts.map +1 -0
  51. package/dist/core/pkgfile.js +162 -0
  52. package/dist/core/pkgfile.js.map +1 -0
  53. package/dist/core/tar.d.ts +13 -0
  54. package/dist/core/tar.d.ts.map +1 -0
  55. package/dist/core/tar.js +132 -0
  56. package/dist/core/tar.js.map +1 -0
  57. package/dist/core/types.d.ts +83 -0
  58. package/dist/core/types.d.ts.map +1 -0
  59. package/dist/core/types.js +3 -0
  60. package/dist/core/types.js.map +1 -0
  61. package/dist/database.d.ts +20 -0
  62. package/dist/database.d.ts.map +1 -0
  63. package/dist/database.js +181 -0
  64. package/dist/database.js.map +1 -0
  65. package/dist/db/database.d.ts +17 -0
  66. package/dist/db/database.d.ts.map +1 -0
  67. package/dist/db/database.js +145 -0
  68. package/dist/db/database.js.map +1 -0
  69. package/dist/db/dpkg-compat.d.ts +19 -0
  70. package/dist/db/dpkg-compat.d.ts.map +1 -0
  71. package/dist/db/dpkg-compat.js +150 -0
  72. package/dist/db/dpkg-compat.js.map +1 -0
  73. package/dist/db/localdb.d.ts +9 -0
  74. package/dist/db/localdb.d.ts.map +1 -0
  75. package/dist/db/localdb.js +246 -0
  76. package/dist/db/localdb.js.map +1 -0
  77. package/dist/db/sqlite.d.ts +20 -0
  78. package/dist/db/sqlite.d.ts.map +1 -0
  79. package/dist/db/sqlite.js +309 -0
  80. package/dist/db/sqlite.js.map +1 -0
  81. package/dist/deb.d.ts +5 -0
  82. package/dist/deb.d.ts.map +1 -0
  83. package/dist/deb.js +105 -0
  84. package/dist/deb.js.map +1 -0
  85. package/dist/dpkg-compat.d.ts +18 -0
  86. package/dist/dpkg-compat.d.ts.map +1 -0
  87. package/dist/dpkg-compat.js +137 -0
  88. package/dist/dpkg-compat.js.map +1 -0
  89. package/dist/i18n/en.json +109 -0
  90. package/dist/i18n/index.d.ts +3 -0
  91. package/dist/i18n/index.d.ts.map +1 -0
  92. package/dist/i18n/index.js +36 -0
  93. package/dist/i18n/index.js.map +1 -0
  94. package/dist/i18n/zh-CN.json +109 -0
  95. package/dist/index.d.ts +3 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +9 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/install.d.ts +2 -0
  100. package/dist/install.d.ts.map +1 -0
  101. package/dist/install.js +126 -0
  102. package/dist/install.js.map +1 -0
  103. package/dist/makepkg/build.d.ts +19 -0
  104. package/dist/makepkg/build.d.ts.map +1 -0
  105. package/dist/makepkg/build.js +370 -0
  106. package/dist/makepkg/build.js.map +1 -0
  107. package/dist/makepkg/index.d.ts +3 -0
  108. package/dist/makepkg/index.d.ts.map +1 -0
  109. package/dist/makepkg/index.js +84 -0
  110. package/dist/makepkg/index.js.map +1 -0
  111. package/dist/makepkg/pkgbuild.d.ts +36 -0
  112. package/dist/makepkg/pkgbuild.d.ts.map +1 -0
  113. package/dist/makepkg/pkgbuild.js +165 -0
  114. package/dist/makepkg/pkgbuild.js.map +1 -0
  115. package/dist/ops/install.d.ts +5 -0
  116. package/dist/ops/install.d.ts.map +1 -0
  117. package/dist/ops/install.js +299 -0
  118. package/dist/ops/install.js.map +1 -0
  119. package/dist/ops/query.d.ts +9 -0
  120. package/dist/ops/query.d.ts.map +1 -0
  121. package/dist/ops/query.js +189 -0
  122. package/dist/ops/query.js.map +1 -0
  123. package/dist/ops/remove.d.ts +3 -0
  124. package/dist/ops/remove.d.ts.map +1 -0
  125. package/dist/ops/remove.js +121 -0
  126. package/dist/ops/remove.js.map +1 -0
  127. package/dist/ops/upgrade.d.ts +4 -0
  128. package/dist/ops/upgrade.d.ts.map +1 -0
  129. package/dist/ops/upgrade.js +122 -0
  130. package/dist/ops/upgrade.js.map +1 -0
  131. package/dist/pacman.d.ts +2 -0
  132. package/dist/pacman.d.ts.map +1 -0
  133. package/dist/pacman.js +165 -0
  134. package/dist/pacman.js.map +1 -0
  135. package/dist/query.d.ts +5 -0
  136. package/dist/query.d.ts.map +1 -0
  137. package/dist/query.js +143 -0
  138. package/dist/query.js.map +1 -0
  139. package/dist/remove.d.ts +2 -0
  140. package/dist/remove.d.ts.map +1 -0
  141. package/dist/remove.js +82 -0
  142. package/dist/remove.js.map +1 -0
  143. package/dist/repo/config.d.ts +3 -0
  144. package/dist/repo/config.d.ts.map +1 -0
  145. package/dist/repo/config.js +146 -0
  146. package/dist/repo/config.js.map +1 -0
  147. package/dist/repo/repository.d.ts +10 -0
  148. package/dist/repo/repository.d.ts.map +1 -0
  149. package/dist/repo/repository.js +596 -0
  150. package/dist/repo/repository.js.map +1 -0
  151. package/dist/repository.d.ts +10 -0
  152. package/dist/repository.d.ts.map +1 -0
  153. package/dist/repository.js +175 -0
  154. package/dist/repository.js.map +1 -0
  155. package/dist/scripts/pacman-conf.d.ts +3 -0
  156. package/dist/scripts/pacman-conf.d.ts.map +1 -0
  157. package/dist/scripts/pacman-conf.js +74 -0
  158. package/dist/scripts/pacman-conf.js.map +1 -0
  159. package/dist/scripts/setup.d.ts +3 -0
  160. package/dist/scripts/setup.d.ts.map +1 -0
  161. package/dist/scripts/setup.js +289 -0
  162. package/dist/scripts/setup.js.map +1 -0
  163. package/dist/tar.d.ts +17 -0
  164. package/dist/tar.d.ts.map +1 -0
  165. package/dist/tar.js +148 -0
  166. package/dist/tar.js.map +1 -0
  167. package/dist/types.d.ts +80 -0
  168. package/dist/types.d.ts.map +1 -0
  169. package/dist/types.js +3 -0
  170. package/dist/types.js.map +1 -0
  171. package/dist/ui/colors.d.ts +13 -0
  172. package/dist/ui/colors.d.ts.map +1 -0
  173. package/dist/ui/colors.js +38 -0
  174. package/dist/ui/colors.js.map +1 -0
  175. package/dist/ui/format.d.ts +3 -0
  176. package/dist/ui/format.d.ts.map +1 -0
  177. package/dist/ui/format.js +15 -0
  178. package/dist/ui/format.js.map +1 -0
  179. package/dist/ui/progress.d.ts +8 -0
  180. package/dist/ui/progress.d.ts.map +1 -0
  181. package/dist/ui/progress.js +50 -0
  182. package/dist/ui/progress.js.map +1 -0
  183. package/dist/ui/prompt.d.ts +4 -0
  184. package/dist/ui/prompt.d.ts.map +1 -0
  185. package/dist/ui/prompt.js +60 -0
  186. package/dist/ui/prompt.js.map +1 -0
  187. package/lib/pac4deb/Makefile +26 -0
  188. package/lib/pac4deb/README.md +47 -0
  189. package/lib/pac4deb/include/alpm.h +166 -0
  190. package/lib/pac4deb/include/alpm_list.h +42 -0
  191. package/lib/pac4deb/libalpm.so +0 -0
  192. package/lib/pac4deb/src/alpm_list.c +102 -0
  193. package/lib/pac4deb/src/genstubs.sh +51 -0
  194. package/lib/pac4deb/src/genstubs2.sh +72 -0
  195. package/lib/pac4deb/src/genstubs3.sh +43 -0
  196. package/lib/pac4deb/src/libalpm.c +537 -0
  197. package/lib/pac4deb/src/stubs_manual.c +198 -0
  198. package/lib/pac4deb/stubs.c +6 -0
  199. package/lib/pac4deb/update_header.sh +15 -0
  200. package/package.json +41 -0
  201. package/src/cli/pacman.ts +308 -0
  202. package/src/core/ar.ts +54 -0
  203. package/src/core/compress.ts +27 -0
  204. package/src/core/control.ts +22 -0
  205. package/src/core/deb.ts +47 -0
  206. package/src/core/deps.ts +260 -0
  207. package/src/core/options.ts +20 -0
  208. package/src/core/pkgfile.ts +146 -0
  209. package/src/core/tar.ts +101 -0
  210. package/src/core/types.ts +89 -0
  211. package/src/db/database.ts +102 -0
  212. package/src/db/dpkg-compat.ts +129 -0
  213. package/src/db/localdb.ts +181 -0
  214. package/src/i18n/en.json +114 -0
  215. package/src/i18n/index.ts +32 -0
  216. package/src/i18n/zh-CN.json +114 -0
  217. package/src/index.ts +7 -0
  218. package/src/makepkg/build.ts +351 -0
  219. package/src/makepkg/index.ts +87 -0
  220. package/src/makepkg/pkgbuild.ts +146 -0
  221. package/src/ops/install.ts +260 -0
  222. package/src/ops/query.ts +117 -0
  223. package/src/ops/remove.ts +77 -0
  224. package/src/ops/upgrade.ts +87 -0
  225. package/src/repo/config.ts +96 -0
  226. package/src/repo/repository.ts +520 -0
  227. package/src/scripts/pacman-conf.ts +68 -0
  228. package/src/scripts/setup.ts +261 -0
  229. package/src/ui/colors.ts +40 -0
  230. package/src/ui/format.ts +9 -0
  231. package/src/ui/progress.ts +26 -0
  232. package/src/ui/prompt.ts +21 -0
  233. package/tsconfig.json +19 -0
package/README.md ADDED
@@ -0,0 +1,440 @@
1
+ # pacman-debian
2
+
3
+ A package manager that adopts the Arch Linux pacman command-line syntax while
4
+ operating directly on Debian/Ubuntu `.deb` packages. It manages packages at the
5
+ dpkg level — bypassing APT — and also supports native Arch Linux `.pkg.tar.zst`
6
+ packages (including AUR compatibility via yay with a bundled libalpm).
7
+
8
+ ## Goals
9
+
10
+ - Provide a consistent, pacman-style CLI for package management on Debian-based
11
+ systems, eliminating the conceptual overhead of switching between `apt`,
12
+ `dpkg`, and their various frontends.
13
+ - Support multi-repository setups combining Debian/Ubuntu and Arch Linux
14
+ repositories under a single tool.
15
+ - Maintain full compatibility with dpkg's database (`/var/lib/dpkg/status`),
16
+ allowing coexistence with APT and other dpkg frontends.
17
+ - Provide a libalpm ABI-compatible shared library so that Go-based AUR helpers
18
+ (yay) can work on Debian without modification.
19
+
20
+ ## Requirements
21
+
22
+ - Node.js 18+ (TypeScript, compiled with `tsc`)
23
+ - pnpm package manager
24
+ - Debian-based distribution (Debian, Ubuntu, Armbian, Linux Mint, etc.)
25
+ - Root privileges for install, remove, and upgrade operations
26
+ - Build essentials: `gcc`, `make`, `ldconfig`
27
+
28
+ ## Quick Start
29
+
30
+ ```bash
31
+ # Build TypeScript + C library
32
+ pnpm install && pnpm build
33
+
34
+ # Run interactive setup (creates config, symlinks, dpkg entry)
35
+ sudo node dist/scripts/setup.js
36
+
37
+ # Alternatively, set up manually:
38
+ sudo ln -sf "$PWD/dist/cli/pacman.js" /usr/local/bin/pacman
39
+
40
+ # Sync repositories
41
+ sudo pacman -Sy
42
+
43
+ # Search packages
44
+ pacman -Ss neofetch
45
+
46
+ # Install
47
+ sudo pacman -S neofetch
48
+
49
+ # Upgrade all packages
50
+ sudo pacman -Syu
51
+
52
+ # Remove
53
+ sudo pacman -R neofetch
54
+ ```
55
+
56
+ ## Configuration
57
+
58
+ Configuration file: `/etc/pacman-debian/pacman.conf`
59
+
60
+ The configuration uses pure Arch Linux pacman syntax with `Include` directives.
61
+ Repo-specific keys (`Type`, `Dist`, `Components` for Debian repos) go in
62
+ included files under `/etc/pacman.d/`.
63
+
64
+ Example config:
65
+
66
+ ```ini
67
+ [options]
68
+ Architecture = auto
69
+
70
+ [bookworm]
71
+ Include = /etc/pacman.d/debian-bookworm
72
+
73
+ [extra]
74
+ Include = /etc/pacman.d/arch-extra
75
+ ```
76
+
77
+ Include file example (`/etc/pacman.d/debian-bookworm`):
78
+
79
+ ```
80
+ Server = https://mirrors.tuna.tsinghua.edu.cn/debian
81
+ Type = debian
82
+ Dist = bookworm
83
+ Components = main contrib non-free non-free-firmware
84
+ ```
85
+
86
+ Include file for Arch repos (`/etc/pacman.d/arch-extra`):
87
+
88
+ ```
89
+ Server = http://mirror.archlinuxarm.org/$arch/$repo
90
+ Type = arch
91
+ Architecture = auto
92
+ ```
93
+
94
+ A symlink at `/etc/pacman.conf` → `/etc/pacman-debian/pacman.conf` is created
95
+ during setup for compatibility with tools that hardcode this path (e.g., yay).
96
+
97
+ Use `pacman-conf` to view the parsed configuration with all `Include` files
98
+ resolved and `$repo`/`$arch` variables substituted:
99
+
100
+ ```bash
101
+ $ pacman-conf
102
+ # pacman-debian configuration
103
+ [options]
104
+ Architecture = auto
105
+
106
+ [bookworm]
107
+ Server = https://mirrors.tuna.tsinghua.edu.cn/debian
108
+ Type = debian
109
+ Dist = bookworm
110
+ Components = main contrib non-free non-free-firmware
111
+
112
+ [extra]
113
+ Server = http://mirror.archlinuxarm.org/$arch/$repo
114
+ Type = arch
115
+ Architecture = auto
116
+ ```
117
+
118
+ ## Database
119
+
120
+ ### Local database: `/var/lib/pacman-debian/local/`
121
+
122
+ Uses a directory-per-package format matching Arch Linux's local DB:
123
+
124
+ ```
125
+ /var/lib/pacman-debian/local/
126
+ ├── by-name/
127
+ │ ├── fastfetch -> ../fastfetch-2.64.2-2/
128
+ │ └── ...
129
+ ├── fastfetch-2.64.2-2/
130
+ │ ├── desc # JSON metadata (name, version, deps, size, etc.)
131
+ │ └── files # File manifest
132
+ └── ...
133
+ ```
134
+
135
+ ### dpkg compatibility
136
+
137
+ Packages installed via `dpkg` or `apt` are read directly from
138
+ `/var/lib/dpkg/status` at query time (mtime-cached). When `pacman-debian`
139
+ installs a package, it writes a dpkg-compatible entry ensuring `apt` and `dpkg`
140
+ still see the package.
141
+
142
+ ### Repository cache: `/var/cache/pacman-debian/packages/`
143
+
144
+ Each repository is cached in JSON Lines chunks (5000 packages per `.jsonl`
145
+ file). During sync, a `packages.idx` index is also built — one line per
146
+ package, sorted globally, with format `pkgname description\tprovides\tchunk\toffset`.
147
+
148
+ ```
149
+ /var/cache/pacman-debian/packages/
150
+ ├── bookworm/
151
+ │ ├── 00000.jsonl # JSON Lines, ~5000 pkg per chunk
152
+ │ ├── ...
153
+ │ └── packages.idx # Global sorted index (tabs, ~200KB)
154
+ └── ...
155
+ ```
156
+
157
+ **Lookup paths:**
158
+
159
+ | Operation | Method | Why |
160
+ |-----------|--------|-----|
161
+ | `-S <pkg>` / `-Qo` | Binary search `packages.idx` → seek JSONL | O(log N), single line read |
162
+ | `-Ss` | Line-scan `packages.idx` (name + desc) → seek JSONL | ~1.4MB scan, no JSON parse |
163
+ | `-Sl` | Read `packages.idx` → seek each pkg | Lazy-load via index |
164
+ | Dependency provides | Scan `packages.idx` provides field | Index-only, no JSON parse |
165
+ | `-Qi` / `-Ql` | dpkg status or localdb | No cache involved |
166
+
167
+ ## Repository Support
168
+
169
+ - **Debian/Ubuntu**: Reads `Packages.gz` / `Packages.xz` from standard
170
+ repository indices. Supports `$repo`/`$arch` variable substitution in
171
+ `Server` URLs.
172
+ - **Arch Linux**: Reads `db.tar.gz` from Arch-compatible repositories.
173
+ Downloaded `.pkg.tar.zst` files are extracted and installed.
174
+ - **Arch ARM**: Binary packages require glibc 2.38+ — most Debian-based
175
+ distributions ship glibc 2.36 or older, so Arch ARM binary repos are
176
+ **unusable** without a glibc upgrade (which will likely break the system).
177
+ Use `makepkg` for local builds instead.
178
+
179
+ ## libalpm (libpac4deb)
180
+
181
+ A C library at `lib/pac4deb/` that implements the libalpm ABI (`alpm.h`),
182
+ allowing Go-based AUR helpers like `yay` to work on Debian without
183
+ modification. It reads:
184
+
185
+ - Local database (`/var/lib/pacman-debian/local/`) — packages installed by
186
+ pacman-debian
187
+ - dpkg status (`/var/lib/dpkg/status`) — system packages from apt/dpkg
188
+ - Sync databases (`/var/cache/pacman-debian/packages/*/` — JSONL chunks)
189
+
190
+ Over 200 stubs are provided for rarely-used functions.
191
+
192
+ ## makepkg (`src/makepkg/`)
193
+
194
+ A standalone `makepkg` implementation that builds Arch Linux packages from
195
+ PKGBUILDs without requiring `base-devel` or any Arch tools.
196
+
197
+ ```bash
198
+ # Build a package from a PKGBUILD
199
+ cd /path/to/PKGBUILD/dir
200
+ makepkg --syncdeps --install
201
+ ```
202
+
203
+ Features:
204
+
205
+ - Parses PKGBUILD via bash sourcing (`source PKGBUILD`) — supports all
206
+ standard variables (`pkgname`, `pkgver`, `source`, `depends`, `makedepps`,
207
+ `sha256sums`, etc.)
208
+ - Downloads and verifies source files (supports http/https URLs with checksum
209
+ verification)
210
+ - Extracts archives: `.tar.gz`, `.tar.xz`, `.tar.bz2`, `.tar.zst`, `.zip`
211
+ - Runs `prepare()`, `build()`, `check()`, and `package()` functions in a clean
212
+ environment
213
+ - Creates `.pkg.tar.zst` archives with valid `.PKGINFO` metadata
214
+ - Dependency resolution via `--syncdeps` — installs missing dependencies
215
+ through pacman-debian's sync databases (Debian and Arch repos)
216
+ - Supports `--install` (`-i`), `--clean` (`-c`), `--rmdeps`
217
+
218
+ Flags:
219
+
220
+ | Flag | Description |
221
+ |------|-------------|
222
+ | `-s, --syncdeps` | Install missing dependencies via pacman |
223
+ | `-i, --install` | Install the built package |
224
+ | `-c, --clean` | Clean up build files after packaging |
225
+ | `-r, --rmdeps` | Remove installed dependencies after build |
226
+ | `-f, --force` | Overwrite existing package file |
227
+ | `-o, --nobuild` | Download and extract sources only (no build) |
228
+ | `--nocolor` | Disable colored output |
229
+ | `--printsrcinfo` | Print `.SRCINFO` and exit |
230
+
231
+ ## Commands
232
+
233
+ ### Sync (-S)
234
+
235
+ | Command | Description |
236
+ |---------|-------------|
237
+ | `pacman -S <pkg>` | Install package(s) from repositories |
238
+ | `pacman -Sy` | Refresh package databases (mtime check, 24h) |
239
+ | `pacman -Syy` | Force refresh package databases |
240
+ | `pacman -Su` | Upgrade all installed packages |
241
+ | `pacman -Syu` | Refresh databases and upgrade |
242
+ | `pacman -Ss <keyword>` | Search repositories |
243
+ | `pacman -Si <pkg>` | Show remote package information |
244
+ | `pacman -Sl` | List all packages in repositories |
245
+ | `pacman -Sw <pkg>` | Download packages without installing |
246
+ | `pacman -Sc` | Remove unused cached packages |
247
+ | `pacman -Scc` | Remove all cached packages (including repos) |
248
+ | `pacman -Sp <pkg>` | Print what would be installed (dry-run) |
249
+
250
+ ### Remove (-R)
251
+
252
+ | Command | Description |
253
+ |---------|-------------|
254
+ | `pacman -R <pkg>` | Remove a package |
255
+ | `pacman -Rs <pkg>` | Remove package and unused dependencies |
256
+ | `pacman -Rn <pkg>` | Remove package and its config files (nosave) |
257
+ | `pacman -Rns <pkg>` | Remove package, dependencies, config files |
258
+ | `pacman -Rc <pkg>` | Cascade: remove packages that depend on the target |
259
+ | `pacman -Rc <pkg>` | Cascade: remove packages that depend on the target |
260
+ | `pacman -Rdd <pkg>` | Skip dependency checks during removal |
261
+ | `pacman -Rp <pkg>` | Print what would be removed (dry-run) |
262
+
263
+ ### Query (-Q)
264
+
265
+ | Command | Description |
266
+ |---------|-------------|
267
+ | `pacman -Q` | List all installed packages |
268
+ | `pacman -Qe` | List explicitly installed packages |
269
+ | `pacman -Qd` | List packages installed as dependencies |
270
+ | `pacman -Qdt` | List orphan packages (unused dependencies) |
271
+ | `pacman -Qi <pkg>` | Show detailed package information |
272
+ | `pacman -Ql <pkg>` | List files owned by a package |
273
+ | `pacman -Qo <file>` | Query which package owns a file |
274
+ | `pacman -Qs <keyword>` | Search installed packages |
275
+ | `pacman -Qk [pkg]` | Verify installed package file integrity |
276
+
277
+ ### Other
278
+
279
+ | Command | Description |
280
+ |---------|-------------|
281
+ | `pacman -U <file>` | Install a local package file (.deb/.pkg.tar.zst) |
282
+ | `pacman -D --asdeps <pkg>` | Mark package as dependency |
283
+ | `pacman -D --asexplicit <pkg>` | Mark package as explicitly installed |
284
+ | `pacman -T <pkg>` | Check if dependencies are satisfied |
285
+ | `pacman -F <file>` | Search which package provides a file |
286
+ | `pacman -V` | Show version |
287
+
288
+ ### Bundled Tools
289
+
290
+ | Command | Description |
291
+ |---------|-------------|
292
+ | `pacman-conf` | Print parsed configuration (like Arch's `pacman-conf`). View resolved Server URLs, Type, Dist, Components for each repo. |
293
+ | `makepkg` | Build Arch Linux packages from PKGBUILD files. Supports `--syncdeps`, `--install`, `--clean`, source download, and `.pkg.tar.zst` creation. |
294
+ | `pacman-debian-setup` | Interactive setup: creates config, Include files, symlinks (`/etc/pacman.conf`, `/usr/local/bin/pacman`), and virtual `pacman` dpkg entry. |
295
+
296
+ ### Global Flags
297
+
298
+ | Flag | Description |
299
+ |------|-------------|
300
+ | `--noconfirm` | Skip confirmation prompts |
301
+ | `--confirm` | Always ask for confirmation (default) |
302
+ | `--needed` | Do not reinstall packages that are already up-to-date |
303
+ | `--noscriptlet` | Do not execute install scripts |
304
+ | `--print` | Dry-run: show what would be done without executing |
305
+
306
+ ### Config Options
307
+
308
+ | Option | Description |
309
+ |--------|-------------|
310
+ | `Color` | Enable colored output (in `[options]` section) |
311
+ | `Architecture` | Set target architecture (default: `auto`) |
312
+ | `IgnorePkg` | Skip upgrade for specified packages |
313
+
314
+ ## Dependency Engine
315
+
316
+ The dependency resolver (`src/core/deps.ts`) handles:
317
+
318
+ - Package name parsing with version constraints (`>=`, `<=`, `=`)
319
+ - OR dependencies (`|`)
320
+ - Architecture qualifiers (e.g. `:arm64`, `:amd64`)
321
+ - Both Debian (comma-separated) and Arch (space-separated) formats
322
+ - BFS resolution with pre-loaded DB state
323
+ - Conflict detection across installed and to-be-installed packages
324
+ - System package protection (glibc, libc6, etc.)
325
+
326
+ Version comparison delegates to `dpkg --compare-versions` with numeric/string
327
+ fallback.
328
+
329
+ ## Architecture
330
+
331
+ ```
332
+ src/
333
+ ├── cli/pacman.ts # CLI argument parsing and dispatch
334
+ ├── core/ # Package format parsers, dependency engine
335
+ │ ├── ar.ts # ar archive parser
336
+ │ ├── tar.ts # tar extractor
337
+ │ ├── deb.ts # .deb package parser
338
+ │ ├── pkgfile.ts # .pkg.tar.zst parser
339
+ │ ├── compress.ts # gz/xz decompression
340
+ │ ├── control.ts # debian control file parser
341
+ │ └── deps.ts # Dependency resolution engine
342
+ ├── db/
343
+ │ ├── localdb.ts # Directory-based local package DB
344
+ │ ├── database.ts # DB wrapper with transactions
345
+ │ └── dpkg-compat.ts # dpkg status file read/write
346
+ ├── ops/
347
+ │ ├── install.ts # Package installation
348
+ │ ├── remove.ts # Package removal
349
+ │ ├── query.ts # All -Q queries
350
+ │ └── upgrade.ts # Sync + upgrade flow
351
+ ├── repo/
352
+ │ ├── repository.ts # Repo sync, download, JSONL cache
353
+ │ └── config.ts # pacman.conf parser with Include support
354
+ ├── scripts/
355
+ │ └── setup.ts # Interactive setup script
356
+ ├── makepkg/
357
+ │ ├── index.ts # Main makepkg entry
358
+ │ ├── pkgbuild.ts # PKGBUILD parser
359
+ │ ├── source.ts # Source download/extraction
360
+ │ ├── build.ts # build()/package() execution
361
+ │ └── printsrcinfo.ts # .SRCINFO generation
362
+ ├── ui/ # User interface (prompt, formatting)
363
+ └── index.ts # Entry point
364
+ ```
365
+
366
+ ## libalpm C Library
367
+
368
+ ```
369
+ lib/pac4deb/
370
+ ├── Makefile # Build with gcc, target libalpm.so
371
+ ├── include/
372
+ │ ├── alpm.h # Public libalpm API header
373
+ │ └── alpm_list.h # Linked list header
374
+ └── src/
375
+ ├── libalpm.c # Core implementation (handle, db, pkg, JSON parser)
376
+ ├── stubs_manual.c # ~200 stubs for rarely-used libalpm functions
377
+ └── alpm_list.c # Linked list implementation
378
+ ```
379
+
380
+ Build with: `make -C lib/pac4deb`
381
+ Install with: `sudo make -C lib/pac4deb install`
382
+
383
+ ## yay / AUR Support
384
+
385
+ `yay` works with `pacman-debian` through the bundled libalpm:
386
+
387
+ ```bash
388
+ # Install yay (Go required)
389
+ sudo apt install golang-go
390
+ git clone https://aur.archlinux.org/yay.git /tmp/yay
391
+ cd /tmp/yay && go build -o /usr/local/bin/yay
392
+
393
+ # Use with pacman-debian
394
+ PACMAN=/usr/local/bin/pacman yay -Ss ponysay
395
+ PACMAN=/usr/local/bin/pacman sudo -E yay -S ponysay
396
+ ```
397
+
398
+ Note: AUR packages that depend on `python` (not `python3`) are unresolvable
399
+ on Debian since the package is named `python3`. Install `python-is-python3`
400
+ or create a symlink to work around this.
401
+
402
+ ## Build
403
+
404
+ ```bash
405
+ pnpm install
406
+ pnpm build # tsc + C library
407
+ # Or step by step:
408
+ pnpm exec tsc
409
+ make -C lib/pac4deb # Build libalpm.so
410
+ ```
411
+
412
+ ## Project Status
413
+
414
+ This project was renamed to `pacman-debian` at v7.1.0. It is functional for
415
+ day-to-day package management on Debian-based distributions. Key features:
416
+
417
+ - **Performance**: `packages.idx` index enables sub-second single-package
418
+ lookup. `-Ss` scans index only (no JSON parsing). Full `-Sl` uses index
419
+ seek. ~64k packages across all repos, cached.
420
+ - **Parallel sync**: Repos sync concurrently with per-repo progress display.
421
+ HTTP conditional requests (304) skip unchanged repos.
422
+ - **i18n**: Full Chinese and English localization via `$LANG` detection.
423
+ Controlled by JSON message catalogs at `src/i18n/`.
424
+ - **Color**: Respects `Color` option in `pacman.conf [options]`. Matching
425
+ official pacman color scheme (magenta=repo, green=pkg, red=error).
426
+ - **Root check**: Moved into CLI code — query commands (`-Q`, `-Ss`, `-Si`,
427
+ `-Sp`, `-Rp`) work without root. Write operations require `sudo`.
428
+
429
+ Key limitations:
430
+
431
+ - **Arch ARM binary repos require glibc 2.38+** — Debian 12 ships 2.36.
432
+ Local `makepkg` builds work fine.
433
+ - **yay/AUR**: libalpm stub library enables package search and dependency
434
+ resolution, but complex AUR dependency chains may fail due to Debian/Arch
435
+ package naming differences.
436
+ - **No AUR helper integration** beyond yay (paru, pamac, etc. untested).
437
+
438
+ ## License
439
+
440
+ GNU General Public License v3.0