pacman-debian 7.3.11 → 7.3.14

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