pacman-debian 7.3.10 → 7.3.13

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 (83) hide show
  1. package/README.md +52 -463
  2. package/README_zh-CN.md +50 -492
  3. package/dist/ar.d.ts +8 -0
  4. package/dist/cli/archlinux-java.d.ts +3 -0
  5. package/dist/cli/fix_default.d.ts +3 -0
  6. package/dist/cli/paclink.d.ts +3 -0
  7. package/dist/cli/pacman.d.ts +2 -0
  8. package/dist/cli/update-ca-trust.d.ts +3 -0
  9. package/dist/compress.d.ts +2 -0
  10. package/dist/config.d.ts +3 -0
  11. package/dist/control.d.ts +2 -0
  12. package/dist/core/ar.d.ts +7 -0
  13. package/dist/core/compress.d.ts +4 -0
  14. package/dist/core/control.d.ts +2 -0
  15. package/dist/core/deb.d.ts +4 -0
  16. package/dist/core/deps.d.ts +28 -0
  17. package/dist/core/options.d.ts +19 -0
  18. package/dist/core/pkgfile.d.ts +35 -0
  19. package/dist/core/tar.d.ts +13 -0
  20. package/dist/core/types.d.ts +83 -0
  21. package/dist/database.d.ts +20 -0
  22. package/dist/db/database.d.ts +17 -0
  23. package/dist/db/dpkg-compat.d.ts +19 -0
  24. package/dist/db/dpkg-compat.d.ts.map +1 -1
  25. package/dist/db/dpkg-compat.js +16 -1
  26. package/dist/db/dpkg-compat.js.map +1 -1
  27. package/dist/db/localdb.d.ts +9 -0
  28. package/dist/db/sqlite.d.ts +20 -0
  29. package/dist/deb.d.ts +5 -0
  30. package/dist/dpkg-compat.d.ts +18 -0
  31. package/dist/i18n/index.d.ts +4 -0
  32. package/dist/i18n/paclink/en.d.ts +3 -0
  33. package/dist/i18n/paclink/zh-CN.d.ts +3 -0
  34. package/dist/i18n/setup/en.d.ts +3 -0
  35. package/dist/i18n/setup/zh-CN.d.ts +3 -0
  36. package/dist/index.d.ts +3 -0
  37. package/dist/install.d.ts +2 -0
  38. package/dist/makepkg/build.d.ts +19 -0
  39. package/dist/makepkg/index.d.ts +3 -0
  40. package/dist/makepkg/pkgbuild.d.ts +36 -0
  41. package/dist/ops/install.d.ts +5 -0
  42. package/dist/ops/query.d.ts +9 -0
  43. package/dist/ops/remove.d.ts +4 -0
  44. package/dist/ops/upgrade.d.ts +4 -0
  45. package/dist/pacman.d.ts +2 -0
  46. package/dist/query.d.ts +5 -0
  47. package/dist/remove.d.ts +2 -0
  48. package/dist/repo/config.d.ts +3 -0
  49. package/dist/repo/repository.d.ts +20 -0
  50. package/dist/repository.d.ts +10 -0
  51. package/dist/scripts/pacman-conf.d.ts +3 -0
  52. package/dist/scripts/setup.d.ts +3 -0
  53. package/dist/tar.d.ts +17 -0
  54. package/dist/types.d.ts +80 -0
  55. package/dist/ui/colors.d.ts +13 -0
  56. package/dist/ui/format.d.ts +3 -0
  57. package/dist/ui/progress.d.ts +8 -0
  58. package/dist/ui/prompt.d.ts +4 -0
  59. package/docs/en/architecture.md +188 -0
  60. package/docs/en/configuration.md +84 -0
  61. package/docs/en/installation.md +67 -0
  62. package/docs/en/makepkg.md +38 -0
  63. package/docs/en/paclink.md +73 -0
  64. package/docs/en/usage.md +91 -0
  65. package/docs/en/yay-aur.md +65 -0
  66. package/docs/zh-CN/architecture.md +171 -0
  67. package/docs/zh-CN/configuration.md +80 -0
  68. package/docs/zh-CN/installation.md +65 -0
  69. package/docs/zh-CN/makepkg.md +32 -0
  70. package/docs/zh-CN/paclink.md +70 -0
  71. package/docs/zh-CN/usage.md +90 -0
  72. package/docs/zh-CN/yay-aur.md +44 -0
  73. package/lib/pac4deb/Makefile +26 -0
  74. package/lib/pac4deb/README.md +47 -0
  75. package/lib/pac4deb/include/alpm.h +166 -0
  76. package/lib/pac4deb/include/alpm_list.h +43 -0
  77. package/lib/pac4deb/src/alpm_list.c +120 -0
  78. package/lib/pac4deb/src/genstubs.sh +51 -0
  79. package/lib/pac4deb/src/genstubs2.sh +72 -0
  80. package/lib/pac4deb/src/genstubs3.sh +43 -0
  81. package/lib/pac4deb/src/libalpm.c +964 -0
  82. package/lib/pac4deb/src/stubs_manual.c +452 -0
  83. package/package.json +19 -1
package/README.md CHANGED
@@ -5,7 +5,9 @@ operating directly on Debian/Ubuntu `.deb` packages. It manages packages at the
5
5
  dpkg level — bypassing APT — and also supports native Arch Linux `.pkg.tar.zst`
6
6
  packages (including AUR compatibility via yay with a bundled libalpm).
7
7
 
8
- ## Goals
8
+ ## Introduction
9
+
10
+ ### Goals
9
11
 
10
12
  - Provide a consistent, pacman-style CLI for package management on Debian-based
11
13
  systems, eliminating the conceptual overhead of switching between `apt`,
@@ -17,497 +19,84 @@ packages (including AUR compatibility via yay with a bundled libalpm).
17
19
  - Provide a libalpm ABI-compatible shared library so that Go-based AUR helpers
18
20
  (yay) can work on Debian without modification.
19
21
 
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
22
+ ### Project Status
51
23
 
52
- # Remove
53
- sudo pacman -R neofetch
54
- ```
24
+ Functional for day-to-day package management on Debian-based distributions.
25
+ See [Project Status](docs/en/architecture.md#project-status) for details.
55
26
 
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
- ```
27
+ ## Installation
76
28
 
77
- Include file example (`/etc/pacman.d/debian-bookworm`):
29
+ ### Requirements
78
30
 
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).
31
+ - Node.js 18+
32
+ - Debian-based distribution (Debian, Ubuntu, Armbian, Linux Mint, etc.)
33
+ - Root privileges for write operations
34
+ - Build essentials: `gcc`, `make`, `ldconfig` (for libalpm C library)
96
35
 
97
- Use `pacman-conf` to view the parsed configuration with all `Include` files
98
- resolved and `$repo`/`$arch` variables substituted:
36
+ ### Install
99
37
 
100
38
  ```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
-
39
+ npm install -g pacman-debian@latest
40
+ sudo $(which pacman-debian-setup)
124
41
  ```
125
- /var/lib/pacman-debian/local/
126
- ├── index.json # name → dir mapping (base64 encoded paths)
127
- ├── by-name/
128
- │ ├── fastfetch -> ../fastfetch-2.64.2-2/
129
- │ └── ...
130
- ├── fastfetch-2.64.2-2/
131
- │ ├── desc # JSON metadata (name, version, deps, size, etc.)
132
- │ └── files # File manifest
133
- └── ...
134
- ```
135
-
136
- A flat `index.json` file maps package names to their directories (one `name:base64path`
137
- per line). This is the primary lookup path for removals and queries, and is
138
- automatically rebuilt from the filesystem if missing or corrupted.
139
-
140
- ### dpkg compatibility
141
-
142
- Packages installed via `dpkg` or `apt` are read directly from
143
- `/var/lib/dpkg/status` at query time (mtime-cached). When `pacman-debian`
144
- installs a package, it writes a dpkg-compatible entry ensuring `apt` and `dpkg`
145
- still see the package.
146
-
147
- ### Repository cache: `/var/cache/pacman-debian/packages/`
148
-
149
- Each repository is cached in JSON Lines chunks (5000 packages per `.jsonl`
150
- file). During sync, a `packages.idx` index is also built — one line per
151
- package, sorted globally, with format `pkgname description\tprovides\tchunk\toffset`.
152
-
153
- ```
154
- /var/cache/pacman-debian/packages/
155
- ├── bookworm/
156
- │ ├── 00000.jsonl # JSON Lines, ~5000 pkg per chunk
157
- │ ├── ...
158
- │ └── packages.idx # Global sorted index (tabs, ~200KB)
159
- └── ...
160
- ```
161
-
162
- **Lookup paths:**
163
-
164
- | Operation | Method | Why |
165
- |-----------|--------|-----|
166
- | `-S <pkg>` / `-Qo` | Binary search `packages.idx` → seek JSONL | O(log N), single line read |
167
- | `-Ss` | Line-scan `packages.idx` (name + desc) → seek JSONL | ~1.4MB scan, no JSON parse |
168
- | `-Sl` | Read `packages.idx` → seek each pkg | Lazy-load via index |
169
- | Dependency provides | Scan `packages.idx` provides field | Index-only, no JSON parse |
170
- | `-Qi` / `-Ql` | dpkg status or localdb | No cache involved |
171
-
172
- ## Repository Support
173
-
174
- - **Debian/Ubuntu**: Reads `Packages.gz` / `Packages.xz` from standard
175
- repository indices. Supports `$repo`/`$arch` variable substitution in
176
- `Server` URLs.
177
- - **Arch Linux**: Reads `db.tar.gz` from Arch-compatible repositories.
178
- Downloaded `.pkg.tar.zst` files are extracted and installed.
179
- - **Arch ARM**: Binary packages require glibc 2.38+ — most Debian-based
180
- distributions ship glibc 2.36 or older, so Arch ARM binary repos are
181
- **unusable** without a glibc upgrade (which will likely break the system).
182
- Use `makepkg` for local builds instead.
183
-
184
- ## libalpm (libpac4deb)
185
42
 
186
- A C library at `lib/pac4deb/` that implements the libalpm ABI (`alpm.h`),
187
- allowing Go-based AUR helpers like `yay` to work on Debian without
188
- modification. It reads:
43
+ > [!WARNING]
44
+ > `npm install -g` **must** be run under `sudo` or as the `root` user.
45
+ > If you install as a regular user, Node.js will place `pacman-debian` into
46
+ > your home directory (`~/.npm-global/` or similar), making it susceptible to
47
+ > tampering, malicious modification, or breakage by other users or scripts on
48
+ > the system. Always use `sudo npm install -g`.
189
49
 
190
- - Local database (`/var/lib/pacman-debian/local/`) — packages installed by
191
- pacman-debian
192
- - dpkg status (`/var/lib/dpkg/status`) — system packages from apt/dpkg
193
- - Sync databases (`/var/cache/pacman-debian/packages/*/` — JSONL chunks)
194
-
195
- Over 200 stubs are provided for rarely-used functions.
196
-
197
- Key implementation details:
198
-
199
- - **packages.idx binary search (C)**: `alpm_db_get_pkg` and `alpm_find_dbs_satisfier`
200
- use binary search on the sorted index, then read a single JSONL line by byte
201
- offset — no full JSONL loading.
202
- - **Auto-register sync DBs**: `ensure_syncdbs` scans `/var/cache/pacman-debian/packages/`
203
- on first `alpm_get_syncdbs`, registering all available repos lazily.
204
- - **Package DB pointer**: `pkg_internal.db` field tracks owning database;
205
- `alpm_pkg_get_db` returns it, preventing `DB().Name()` nil dereference.
206
- - **idx-based search**: `alpm_db_search` scans index lines for pattern matching
207
- instead of loading all packages. ~1.5s for -Ss with 6 repos / 15k packages.
208
- - **dpkg Provides parsing**: `load_dpkg_status` reads the `Provides:` field from
209
- dpkg status, so Debian packages that declare virtual names (e.g. `7zip` → `p7zip`)
210
- are discoverable by yay via `alpm_pkg_has_provide`.
211
- - **Local DB fallback**: `alpm_find_dbs_satisfier` searches the local database
212
- (via `alpm_find_satisfier`) after sync DBs, matching both package names and
213
- provides — yay can find `gnutls` via `libgnutls30t64`'s mapped provides.
214
- - **find_in_idx provides scan**: After binary search by package name fails,
215
- scans the `provides` column of `packages.idx` so sync DB provides are matched
216
- (e.g. `libz.so` → `zlib` in Arch repos).
217
- - **dpkg -S fallback**: For `lib*.so` SONAMEs not found anywhere, forks `dpkg -S`
218
- to locate the owning Debian package at runtime.
219
- - **Debian alternatives**: at local DB load time, checks `/etc/alternatives/` for
220
- `sh`, `awk`, `vi`, `editor` etc. and adds virtual provides to the owning package.
221
-
222
- ## makepkg (`src/makepkg/`)
223
-
224
- A standalone `makepkg` implementation that builds Arch Linux packages from
225
- PKGBUILDs without requiring `base-devel` or any Arch tools.
50
+ After setup:
226
51
 
227
52
  ```bash
228
- # Build a package from a PKGBUILD
229
- cd /path/to/PKGBUILD/dir
230
- makepkg --syncdeps --install
53
+ sudo pacman -Sy
54
+ sudo pacman -S neofetch
231
55
  ```
232
56
 
233
- Features:
234
-
235
- - Parses PKGBUILD via bash sourcing (`source PKGBUILD`) — supports all
236
- standard variables (`pkgname`, `pkgver`, `source`, `depends`, `makedepps`,
237
- `sha256sums`, etc.)
238
- - Downloads and verifies source files (supports http/https URLs with checksum
239
- verification)
240
- - Extracts archives: `.tar.gz`, `.tar.xz`, `.tar.bz2`, `.tar.zst`, `.zip`
241
- - Runs `prepare()`, `build()`, `check()`, and `package()` functions in a clean
242
- environment
243
- - Creates `.pkg.tar.zst` archives with valid `.PKGINFO` metadata
244
- - Dependency resolution via `--syncdeps` — installs missing dependencies
245
- through pacman-debian's sync databases (Debian and Arch repos)
246
- - Supports `--install` (`-i`), `--clean` (`-c`), `--rmdeps`
247
-
248
- Flags:
249
-
250
- | Flag | Description |
251
- |------|-------------|
252
- | `-s, --syncdeps` | Install missing dependencies via pacman |
253
- | `-i, --install` | Install the built package |
254
- | `-c, --clean` | Clean up build files after packaging |
255
- | `-r, --rmdeps` | Remove installed dependencies after build |
256
- | `-f, --force` | Overwrite existing package file |
257
- | `-o, --nobuild` | Download and extract sources only (no build) |
258
- | `--nocolor` | Disable colored output |
259
- | `--printsrcinfo` | Print `.SRCINFO` and exit |
260
-
261
- ## Commands
262
-
263
- ### Sync (-S)
264
-
265
- | Command | Description |
266
- |---------|-------------|
267
- | `pacman -S <pkg>` | Install package(s) from repositories |
268
- | `pacman -Sy` | Refresh package databases (mtime check, 24h) |
269
- | `pacman -Syy` | Force refresh package databases |
270
- | `pacman -Su` | Upgrade all installed packages |
271
- | `pacman -Syu` | Refresh databases and upgrade |
272
- | `pacman -Ss <keyword>` | Search repositories |
273
- | `pacman -Si <pkg>` | Show remote package information |
274
- | `pacman -Sl` | List all packages in repositories |
275
- | `pacman -Sw <pkg>` | Download packages without installing |
276
- | `pacman -Sc` | Remove unused cached packages |
277
- | `pacman -Scc` | Remove all cached packages (including repos) |
278
- | `pacman -Sp <pkg>` | Print what would be installed (dry-run) |
279
-
280
- ### Remove (-R)
281
-
282
- | Command | Description |
283
- |---------|-------------|
284
- | `pacman -R <pkg>` | Remove a package |
285
- | `pacman -Rs <pkg>` | Remove package and unused dependencies |
286
- | `pacman -Rn <pkg>` | Remove package and its config files (nosave) |
287
- | `pacman -Rns <pkg>` | Remove package, dependencies, config files |
288
- | `pacman -Rc <pkg>` | Cascade: remove packages that depend on the target |
289
- | `pacman -Rdd <pkg>` | Skip dependency checks during removal |
290
- | `pacman -Rp <pkg>` | Print what would be removed (dry-run) |
291
-
292
- Multiple targets (`pacman -R a b`): all targets are merged and displayed
293
- together, with a single confirmation prompt.
294
-
295
- ### Query (-Q)
296
-
297
- | Command | Description |
298
- |---------|-------------|
299
- | `pacman -Q` | List all installed packages |
300
- | `pacman -Qe` | List explicitly installed packages |
301
- | `pacman -Qd` | List packages installed as dependencies |
302
- | `pacman -Qdt` | List orphan packages (unused dependencies) |
303
- | `pacman -Qi <pkg>` | Show detailed package information |
304
- | `pacman -Ql <pkg>` | List files owned by a package |
305
- | `pacman -Qo <file>` | Query which package owns a file |
306
- | `pacman -Qs <keyword>` | Search installed packages |
307
- | `pacman -Qk [pkg]` | Verify installed package file integrity |
308
-
309
- ### Other
310
-
311
- | Command | Description |
312
- |---------|-------------|
313
- | `pacman -U <file>` | Install a local package file (.deb/.pkg.tar.zst) |
314
- | `pacman -D --asdeps <pkg>` | Mark package as dependency |
315
- | `pacman -D --asexplicit <pkg>` | Mark package as explicitly installed |
316
- | `pacman -T <pkg>` | Check if dependencies are satisfied |
317
- | `pacman -F <file>` | Search which package provides a file |
318
- | `pacman -V` | Show version |
319
-
320
- ### Bundled Tools
321
-
322
- | Command | Description |
323
- |---------|-------------|
324
- | `pacman-conf` | Print parsed configuration (like Arch's `pacman-conf`). View resolved Server URLs, Type, Dist, Components for each repo. |
325
- | `makepkg` | Build Arch Linux packages from PKGBUILD files. Supports `--syncdeps`, `--install`, `--clean`, source download, and `.pkg.tar.zst` creation. |
326
- | `pacman-debian-setup` | Interactive setup: creates config, Include files, symlinks (`/etc/pacman.conf`, `/usr/local/bin/pacman`), and virtual `pacman` dpkg entry. |
327
- | `paclink` | Create/manage persistent Debian→Arch virtual package name mappings. Links are stored in the local DB and visible only to pacman/libalpm tools, not dpkg. |
328
-
329
- ### paclink (Link Management)
330
-
331
- | Command | Description |
332
- |---------|-------------|
333
- | `paclink -Ln <deb> <virt>` | Create a link: Debian package `<deb>` provides Arch virtual name `<virt>` |
334
- | `paclink -L` | List all links |
335
- | `paclink -Ls <keyword>` | Search links by name or target |
336
- | `paclink -Li <virt>` | Show link details |
337
- | `paclink -R <virt>` | Remove a link (Debian package unaffected) |
338
-
339
- Examples:
57
+ ### Development Install
340
58
 
341
59
  ```bash
342
- # Map dash to provide sh
343
- sudo paclink -Ln dash sh
344
-
345
- # Map python3 to provide python
346
- sudo paclink -Ln python3 python
347
-
348
- # List all mappings
349
- paclink -L
350
-
351
- # Search for links matching 'python'
352
- paclink -Ls python
353
- ```
354
-
355
- Links are created as local DB entries with `repoType: link`. When a real
356
- package from any repo shares the same name as a link, the real package takes
357
- precedence and the link is automatically removed during installation.
358
-
359
- ### Global Flags
360
-
361
- | Flag | Description |
362
- |------|-------------|
363
- | `--noconfirm` | Skip confirmation prompts |
364
- | `--confirm` | Always ask for confirmation (default) |
365
- | `--needed` | Do not reinstall packages that are already up-to-date |
366
- | `--noscriptlet` | Do not execute install scripts |
367
- | `--print` | Dry-run: show what would be done without executing |
368
-
369
- ### Config Options
370
-
371
- | Option | Description |
372
- |--------|-------------|
373
- | `Color` | Enable colored output (in `[options]` section) |
374
- | `Architecture` | Set target architecture (default: `auto`) |
375
- | `IgnorePkg` | Skip upgrade for specified packages |
376
-
377
- ## Dependency Engine
378
-
379
- The dependency resolver (`src/core/deps.ts`) handles:
380
-
381
- - Package name parsing with version constraints (`>=`, `<=`, `=`)
382
- - OR dependencies (`|`)
383
- - Architecture qualifiers (e.g. `:arm64`, `:amd64`)
384
- - Both Debian (comma-separated) and Arch (space-separated) formats
385
- - BFS resolution with pre-loaded DB state
386
- - Conflict detection across installed and to-be-installed packages
387
- - System package protection (glibc, libc6, etc.)
388
-
389
- - File validation: installed packages with no real files on disk (empty
390
- directories only) are considered NOT installed, forcing re-download.
391
- - Explicit targets always have their dependencies processed even if the
392
- target itself is already installed.
393
- - Queue uses `shift()` to pop processed items, preventing memory accumulation.
394
-
395
- ## Architecture
396
-
397
- ```
398
- src/
399
- ├── cli/
400
- │ ├── pacman.ts # CLI argument parsing and dispatch
401
- │ └── paclink.ts # Virtual package link management
402
- ├── core/ # Package format parsers, dependency engine
403
- │ ├── ar.ts # ar archive parser
404
- │ ├── tar.ts # tar extractor
405
- │ ├── deb.ts # .deb package parser
406
- │ ├── pkgfile.ts # .pkg.tar.zst parser
407
- │ ├── compress.ts # gz/xz decompression
408
- │ ├── control.ts # debian control file parser
409
- │ └── deps.ts # Dependency resolution engine
410
- ├── db/
411
- │ ├── localdb.ts # Directory-based local package DB
412
- │ ├── database.ts # DB wrapper with transactions
413
- │ └── dpkg-compat.ts # dpkg status file read/write
414
- ├── ops/
415
- │ ├── install.ts # Package installation
416
- │ ├── remove.ts # Package removal
417
- │ ├── query.ts # All -Q queries
418
- │ └── upgrade.ts # Sync + upgrade flow
419
- ├── repo/
420
- │ ├── repository.ts # Repo sync, download, JSONL cache
421
- │ └── config.ts # pacman.conf parser with Include support
422
- ├── scripts/
423
- │ └── setup.ts # Interactive setup script
424
- ├── makepkg/
425
- │ ├── index.ts # Main makepkg entry
426
- │ ├── pkgbuild.ts # PKGBUILD parser
427
- │ ├── source.ts # Source download/extraction
428
- │ ├── build.ts # build()/package() execution
429
- │ └── printsrcinfo.ts # .SRCINFO generation
430
- ├── ui/ # User interface (prompt, formatting)
431
- └── index.ts # Entry point
432
- ```
433
-
434
- ## libalpm C Library
435
-
436
- ```
437
- lib/pac4deb/
438
- ├── Makefile # Build with gcc, target libalpm.so
439
- ├── include/
440
- │ ├── alpm.h # Public libalpm API header
441
- │ └── alpm_list.h # Linked list header
442
- └── src/
443
- ├── libalpm.c # Core implementation (handle, db, pkg, JSON parser)
444
- ├── stubs_manual.c # ~200 stubs for rarely-used libalpm functions
445
- └── alpm_list.c # Linked list implementation
60
+ git clone https://github.com/xbodwf/pacman-debian.git
61
+ cd pacman-debian
62
+ pnpm install && pnpm build
63
+ sudo node dist/scripts/setup.js
446
64
  ```
447
65
 
448
- Build with: `make -C lib/pac4deb`
449
- Install with: `sudo make -C lib/pac4deb install`
66
+ See [Installation](docs/en/installation.md) for details.
450
67
 
451
- ## yay / AUR Support
452
-
453
- `yay` works with `pacman-debian` through the bundled libalpm:
68
+ ## Quick Start
454
69
 
455
70
  ```bash
456
- # Install yay (Go required)
457
- sudo apt install golang-go
458
- git clone https://aur.archlinux.org/yay.git /tmp/yay
459
- cd /tmp/yay && go build -o /usr/local/bin/yay
71
+ # Search
72
+ pacman -Ss neofetch
460
73
 
461
- # Use with pacman-debian
462
- PACMAN=/usr/local/bin/pacman yay -Ss ponysay
463
- PACMAN=/usr/local/bin/pacman sudo -E yay -S ponysay
464
- ```
74
+ # Install
75
+ sudo pacman -S neofetch
465
76
 
466
- Note: AUR packages that depend on `python` (not `python3`) are unresolvable
467
- on Debian since the package is named `python3`. Install `python-is-python3`
468
- or create a symlink to work around this.
77
+ # Remove
78
+ sudo pacman -R neofetch
469
79
 
470
- ## Build
80
+ # Upgrade all
81
+ sudo pacman -Syu
471
82
 
472
- ```bash
473
- pnpm install
474
- pnpm build # tsc + C library
475
- # Or step by step:
476
- pnpm exec tsc
477
- make -C lib/pac4deb # Build libalpm.so
83
+ # Query installed
84
+ pacman -Q
478
85
  ```
479
86
 
480
- ## Project Status
481
-
482
- This project was renamed to `pacman-debian` at v7.1.0. It is functional for
483
- day-to-day package management on Debian-based distributions. Key features:
484
-
485
- - **Performance**: `packages.idx` index enables sub-second single-package
486
- lookup. `-Ss` scans index only (no JSON parsing). Full `-Sl` uses index
487
- seek. ~64k packages across all repos, cached.
488
- - **Parallel sync**: Repos sync concurrently with per-repo progress display.
489
- HTTP conditional requests (304) skip unchanged repos.
490
- - **i18n**: Full Chinese and English localization via `$LANG` detection.
491
- Controlled by JSON message catalogs at `src/i18n/`.
492
- - **Color**: Respects `Color` option in `pacman.conf [options]`. Matching
493
- official pacman color scheme (magenta=repo, green=pkg, red=error).
494
- - **Root check**: Moved into CLI code — query commands (`-Q`, `-Ss`, `-Si`,
495
- `-Sp`, `-Rp`) work without root. Write operations require `sudo`.
496
- - **Link system** (`paclink`): Debian→Arch virtual package name mappings stored
497
- as local DB entries (`repoType: link`). Real repo packages automatically
498
- take precedence over links during install. Links are only visible to
499
- pacman/libalpm, not dpkg.
500
- - **Scoped i18n**: Each tool (pacman, paclink, setup) loads its own translation
501
- file at first use, reducing cold-start overhead. Languages: en, zh-CN.
87
+ See [Usage](docs/en/usage.md) for complete command reference.
502
88
 
503
- Key limitations:
89
+ ## Documentation
504
90
 
505
- - **Arch ARM binary repos require glibc 2.38+** — Debian 12 ships 2.36.
506
- Local `makepkg` builds work fine.
507
- - **yay/AUR**: libalpm stub library enables package search and dependency
508
- resolution, but complex AUR dependency chains may fail due to Debian/Arch
509
- package naming differences.
510
- - **No AUR helper integration** beyond yay (paru, pamac, etc. untested).
91
+ | Topic | English | 中文 |
92
+ |-------|---------|------|
93
+ | Usage (full command reference) | [docs/en/usage.md](docs/en/usage.md) | [docs/zh-CN/usage.md](docs/zh-CN/usage.md) |
94
+ | Configuration | [docs/en/configuration.md](docs/en/configuration.md) | [docs/zh-CN/configuration.md](docs/zh-CN/configuration.md) |
95
+ | Architecture & Database | [docs/en/architecture.md](docs/en/architecture.md) | [docs/zh-CN/architecture.md](docs/zh-CN/architecture.md) |
96
+ | makepkg | [docs/en/makepkg.md](docs/en/makepkg.md) | [docs/zh-CN/makepkg.md](docs/zh-CN/makepkg.md) |
97
+ | libalpm & yay/AUR | [docs/en/yay-aur.md](docs/en/yay-aur.md) | [docs/zh-CN/yay-aur.md](docs/zh-CN/yay-aur.md) |
98
+ | paclink (package links) | [docs/en/paclink.md](docs/en/paclink.md) | [docs/zh-CN/paclink.md](docs/zh-CN/paclink.md) |
99
+ | Installation (detailed) | [docs/en/installation.md](docs/en/installation.md) | [docs/zh-CN/installation.md](docs/zh-CN/installation.md) |
511
100
 
512
101
  ## License
513
102