pacman-debian 7.3.10 → 7.3.11
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.
- package/README.md +225 -168
- package/README_zh-CN.md +214 -202
- package/dist/db/dpkg-compat.d.ts.map +1 -1
- package/dist/db/dpkg-compat.js +16 -1
- package/dist/db/dpkg-compat.js.map +1 -1
- package/package.json +1 -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
|
-
##
|
|
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,40 +19,95 @@ 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
|
-
|
|
22
|
+
### Project Status
|
|
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).
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Requirements
|
|
21
57
|
|
|
22
58
|
- Node.js 18+ (TypeScript, compiled with `tsc`)
|
|
23
|
-
- pnpm package manager
|
|
24
59
|
- Debian-based distribution (Debian, Ubuntu, Armbian, Linux Mint, etc.)
|
|
25
60
|
- Root privileges for install, remove, and upgrade operations
|
|
26
|
-
- Build essentials: `gcc`, `make`, `ldconfig`
|
|
61
|
+
- Build essentials: `gcc`, `make`, `ldconfig` (for libalpm C library)
|
|
27
62
|
|
|
28
|
-
|
|
63
|
+
### Quick Install (npm)
|
|
29
64
|
|
|
30
65
|
```bash
|
|
31
|
-
|
|
32
|
-
|
|
66
|
+
npm install -g pacman-debian@latest
|
|
67
|
+
sudo $(which pacman-debian-setup)
|
|
68
|
+
```
|
|
33
69
|
|
|
34
|
-
|
|
35
|
-
|
|
70
|
+
> [!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.
|
|
36
74
|
|
|
37
|
-
|
|
38
|
-
|
|
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.)
|
|
39
84
|
|
|
40
|
-
|
|
85
|
+
After setup, sync repositories and start using pacman:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
41
88
|
sudo pacman -Sy
|
|
89
|
+
sudo pacman -S neofetch
|
|
90
|
+
```
|
|
42
91
|
|
|
43
|
-
|
|
44
|
-
pacman -Ss neofetch
|
|
92
|
+
### Development Install
|
|
45
93
|
|
|
46
|
-
|
|
47
|
-
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/Xbodwf/pacman-debian.git
|
|
96
|
+
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
|
|
48
102
|
|
|
49
|
-
#
|
|
50
|
-
sudo
|
|
103
|
+
# Run setup
|
|
104
|
+
sudo node dist/scripts/setup.js
|
|
51
105
|
|
|
52
|
-
#
|
|
53
|
-
sudo
|
|
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
|
|
54
111
|
```
|
|
55
112
|
|
|
56
113
|
## Configuration
|
|
@@ -115,9 +172,73 @@ Type = arch
|
|
|
115
172
|
Architecture = auto
|
|
116
173
|
```
|
|
117
174
|
|
|
118
|
-
|
|
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
|
|
119
186
|
|
|
120
|
-
|
|
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/`
|
|
121
242
|
|
|
122
243
|
Uses a directory-per-package format matching Arch Linux's local DB:
|
|
123
244
|
|
|
@@ -137,14 +258,14 @@ A flat `index.json` file maps package names to their directories (one `name:base
|
|
|
137
258
|
per line). This is the primary lookup path for removals and queries, and is
|
|
138
259
|
automatically rebuilt from the filesystem if missing or corrupted.
|
|
139
260
|
|
|
140
|
-
|
|
261
|
+
#### dpkg compatibility
|
|
141
262
|
|
|
142
263
|
Packages installed via `dpkg` or `apt` are read directly from
|
|
143
264
|
`/var/lib/dpkg/status` at query time (mtime-cached). When `pacman-debian`
|
|
144
265
|
installs a package, it writes a dpkg-compatible entry ensuring `apt` and `dpkg`
|
|
145
266
|
still see the package.
|
|
146
267
|
|
|
147
|
-
|
|
268
|
+
#### Repository cache: `/var/cache/pacman-debian/packages/`
|
|
148
269
|
|
|
149
270
|
Each repository is cached in JSON Lines chunks (5000 packages per `.jsonl`
|
|
150
271
|
file). During sync, a `packages.idx` index is also built — one line per
|
|
@@ -159,6 +280,21 @@ package, sorted globally, with format `pkgname description\tprovides\tchunk\toff
|
|
|
159
280
|
└── ...
|
|
160
281
|
```
|
|
161
282
|
|
|
283
|
+
#### Memory Index Cache
|
|
284
|
+
|
|
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
|
+
|
|
162
298
|
**Lookup paths:**
|
|
163
299
|
|
|
164
300
|
| Operation | Method | Why |
|
|
@@ -169,7 +305,7 @@ package, sorted globally, with format `pkgname description\tprovides\tchunk\toff
|
|
|
169
305
|
| Dependency provides | Scan `packages.idx` provides field | Index-only, no JSON parse |
|
|
170
306
|
| `-Qi` / `-Ql` | dpkg status or localdb | No cache involved |
|
|
171
307
|
|
|
172
|
-
|
|
308
|
+
### Repository Support
|
|
173
309
|
|
|
174
310
|
- **Debian/Ubuntu**: Reads `Packages.gz` / `Packages.xz` from standard
|
|
175
311
|
repository indices. Supports `$repo`/`$arch` variable substitution in
|
|
@@ -181,7 +317,7 @@ package, sorted globally, with format `pkgname description\tprovides\tchunk\toff
|
|
|
181
317
|
**unusable** without a glibc upgrade (which will likely break the system).
|
|
182
318
|
Use `makepkg` for local builds instead.
|
|
183
319
|
|
|
184
|
-
|
|
320
|
+
### libalpm C Library (libpac4deb)
|
|
185
321
|
|
|
186
322
|
A C library at `lib/pac4deb/` that implements the libalpm ABI (`alpm.h`),
|
|
187
323
|
allowing Go-based AUR helpers like `yay` to work on Debian without
|
|
@@ -219,7 +355,52 @@ Key implementation details:
|
|
|
219
355
|
- **Debian alternatives**: at local DB load time, checks `/etc/alternatives/` for
|
|
220
356
|
`sh`, `awk`, `vi`, `editor` etc. and adds virtual provides to the owning package.
|
|
221
357
|
|
|
222
|
-
|
|
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/`)
|
|
223
404
|
|
|
224
405
|
A standalone `makepkg` implementation that builds Arch Linux packages from
|
|
225
406
|
PKGBUILDs without requiring `base-devel` or any Arch tools.
|
|
@@ -245,8 +426,6 @@ Features:
|
|
|
245
426
|
through pacman-debian's sync databases (Debian and Arch repos)
|
|
246
427
|
- Supports `--install` (`-i`), `--clean` (`-c`), `--rmdeps`
|
|
247
428
|
|
|
248
|
-
Flags:
|
|
249
|
-
|
|
250
429
|
| Flag | Description |
|
|
251
430
|
|------|-------------|
|
|
252
431
|
| `-s, --syncdeps` | Install missing dependencies via pacman |
|
|
@@ -258,9 +437,9 @@ Flags:
|
|
|
258
437
|
| `--nocolor` | Disable colored output |
|
|
259
438
|
| `--printsrcinfo` | Print `.SRCINFO` and exit |
|
|
260
439
|
|
|
261
|
-
|
|
440
|
+
### Commands
|
|
262
441
|
|
|
263
|
-
|
|
442
|
+
#### Sync (-S)
|
|
264
443
|
|
|
265
444
|
| Command | Description |
|
|
266
445
|
|---------|-------------|
|
|
@@ -277,7 +456,7 @@ Flags:
|
|
|
277
456
|
| `pacman -Scc` | Remove all cached packages (including repos) |
|
|
278
457
|
| `pacman -Sp <pkg>` | Print what would be installed (dry-run) |
|
|
279
458
|
|
|
280
|
-
|
|
459
|
+
#### Remove (-R)
|
|
281
460
|
|
|
282
461
|
| Command | Description |
|
|
283
462
|
|---------|-------------|
|
|
@@ -292,7 +471,7 @@ Flags:
|
|
|
292
471
|
Multiple targets (`pacman -R a b`): all targets are merged and displayed
|
|
293
472
|
together, with a single confirmation prompt.
|
|
294
473
|
|
|
295
|
-
|
|
474
|
+
#### Query (-Q)
|
|
296
475
|
|
|
297
476
|
| Command | Description |
|
|
298
477
|
|---------|-------------|
|
|
@@ -306,7 +485,7 @@ together, with a single confirmation prompt.
|
|
|
306
485
|
| `pacman -Qs <keyword>` | Search installed packages |
|
|
307
486
|
| `pacman -Qk [pkg]` | Verify installed package file integrity |
|
|
308
487
|
|
|
309
|
-
|
|
488
|
+
#### Other
|
|
310
489
|
|
|
311
490
|
| Command | Description |
|
|
312
491
|
|---------|-------------|
|
|
@@ -317,7 +496,7 @@ together, with a single confirmation prompt.
|
|
|
317
496
|
| `pacman -F <file>` | Search which package provides a file |
|
|
318
497
|
| `pacman -V` | Show version |
|
|
319
498
|
|
|
320
|
-
|
|
499
|
+
#### Bundled Tools
|
|
321
500
|
|
|
322
501
|
| Command | Description |
|
|
323
502
|
|---------|-------------|
|
|
@@ -325,8 +504,11 @@ together, with a single confirmation prompt.
|
|
|
325
504
|
| `makepkg` | Build Arch Linux packages from PKGBUILD files. Supports `--syncdeps`, `--install`, `--clean`, source download, and `.pkg.tar.zst` creation. |
|
|
326
505
|
| `pacman-debian-setup` | Interactive setup: creates config, Include files, symlinks (`/etc/pacman.conf`, `/usr/local/bin/pacman`), and virtual `pacman` dpkg entry. |
|
|
327
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) |
|
|
328
510
|
|
|
329
|
-
|
|
511
|
+
#### paclink (Link Management)
|
|
330
512
|
|
|
331
513
|
| Command | Description |
|
|
332
514
|
|---------|-------------|
|
|
@@ -356,7 +538,7 @@ Links are created as local DB entries with `repoType: link`. When a real
|
|
|
356
538
|
package from any repo shares the same name as a link, the real package takes
|
|
357
539
|
precedence and the link is automatically removed during installation.
|
|
358
540
|
|
|
359
|
-
|
|
541
|
+
#### Global Flags
|
|
360
542
|
|
|
361
543
|
| Flag | Description |
|
|
362
544
|
|------|-------------|
|
|
@@ -366,89 +548,7 @@ precedence and the link is automatically removed during installation.
|
|
|
366
548
|
| `--noscriptlet` | Do not execute install scripts |
|
|
367
549
|
| `--print` | Dry-run: show what would be done without executing |
|
|
368
550
|
|
|
369
|
-
###
|
|
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
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
Build with: `make -C lib/pac4deb`
|
|
449
|
-
Install with: `sudo make -C lib/pac4deb install`
|
|
450
|
-
|
|
451
|
-
## yay / AUR Support
|
|
551
|
+
### yay / AUR Support
|
|
452
552
|
|
|
453
553
|
`yay` works with `pacman-debian` through the bundled libalpm:
|
|
454
554
|
|
|
@@ -458,56 +558,13 @@ sudo apt install golang-go
|
|
|
458
558
|
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
|
459
559
|
cd /tmp/yay && go build -o /usr/local/bin/yay
|
|
460
560
|
|
|
461
|
-
# Use with pacman-debian
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
```
|
|
465
|
-
|
|
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.
|
|
469
|
-
|
|
470
|
-
## Build
|
|
471
|
-
|
|
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
|
|
561
|
+
# Use with pacman-debian (PACMAN env var detected automatically)
|
|
562
|
+
yay -Ss ponysay
|
|
563
|
+
sudo -E yay -S ponysay
|
|
478
564
|
```
|
|
479
565
|
|
|
480
|
-
|
|
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.
|
|
502
|
-
|
|
503
|
-
Key limitations:
|
|
504
|
-
|
|
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).
|
|
566
|
+
Note: AUR packages that depend on `python` (not `python3`) are resolved
|
|
567
|
+
automatically via paclink's `python → python3` mapping, created during setup.
|
|
511
568
|
|
|
512
569
|
## License
|
|
513
570
|
|
package/README_zh-CN.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
包。它在 dpkg 层面管理包(绕过 APT),同时也支持原生 Arch Linux `.pkg.tar.zst`
|
|
5
5
|
包(通过内置 libalpm 兼容 yay 实现 AUR 支持)。
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 简介
|
|
8
|
+
|
|
9
|
+
### 目标
|
|
8
10
|
|
|
9
11
|
- 在基于 Debian 的系统上提供一致的 pacman 风格 CLI,消除 `apt`、`dpkg` 及
|
|
10
12
|
各种前端之间的切换成本。
|
|
@@ -14,40 +16,94 @@
|
|
|
14
16
|
- 提供 libalpm ABI 兼容的共享库,使基于 Go 的 AUR 助手(yay)无需修改即可
|
|
15
17
|
在 Debian 上运行。
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
### 项目状态
|
|
20
|
+
|
|
21
|
+
该项目在 v7.1.0 时更名为 `pacman-debian`。目前在 Debian 12 上
|
|
22
|
+
可用于日常包管理。已有功能:
|
|
23
|
+
|
|
24
|
+
- **依赖解析**:顺序 BFS + idx 内存缓存 + provides 倒排索引,亚秒级
|
|
25
|
+
依赖查找。删除时正确处理孤儿级联和 conffile 备份。
|
|
26
|
+
- **性能优化**:`packages.idx` 索引实现亚秒级单包查找。`-Ss` 只扫索引
|
|
27
|
+
(不解析 JSON)。全量 `-Sl` 通过索引 seek。HTTP keep-alive agent
|
|
28
|
+
复用 TCP 连接,异步 zlib 解压不阻塞事件循环。
|
|
29
|
+
- **并行同步**:多仓库并发下载,每仓库独立进度行。HTTP 条件请求(304)
|
|
30
|
+
跳过未变更仓库。Debian 组件串行但多仓库并行。
|
|
31
|
+
- **多语言**:通过 `$LANG` 自动切换中英文。同步、安装、升级流程均已
|
|
32
|
+
本地化。消息目录在 `src/i18n/`。
|
|
33
|
+
- **颜色输出**:遵守 `pacman.conf` 的 `Color` 选项。颜色方案匹配官方
|
|
34
|
+
pacman(品红=仓库、绿=包名、红=错误)。
|
|
35
|
+
- **权限分离**:查询命令(`-Q`、`-Ss`、`-Si`、`-Sp`、`-Rp`)无需 root。
|
|
36
|
+
写操作需要 `sudo`。
|
|
37
|
+
- **链接系统**(`paclink`):Debian→Arch 虚拟包名映射以本地 DB 条目存储
|
|
38
|
+
(`repoType: link`)。仓库真包自动优先于链接,安装时覆盖。
|
|
39
|
+
链接仅对 pacman/libalpm 可见,dpkg 不可见。
|
|
40
|
+
- **作用域 i18n**:每个工具(pacman、paclink、setup)首次使用时才加载自己的
|
|
41
|
+
翻译文件,减少冷启动开销。语言:en、zh-CN。
|
|
42
|
+
|
|
43
|
+
主要限制:
|
|
44
|
+
|
|
45
|
+
- **Arch ARM 二进制仓库需要 glibc 2.38+** — Debian 12 自带 2.36。
|
|
46
|
+
本地 `makepkg` 构建可正常使用。
|
|
47
|
+
- **yay/AUR**:libalpm 桩库支持包搜索和依赖解析,但复杂 AUR 依赖链
|
|
48
|
+
可能因 Debian/Arch 包名差异而失败。
|
|
49
|
+
- **AUR 助手集成**仅测试了 yay(paru、pamac 等未测试)。
|
|
50
|
+
|
|
51
|
+
## 安装
|
|
52
|
+
|
|
53
|
+
### 环境要求
|
|
18
54
|
|
|
19
55
|
- Node.js 18+(TypeScript,通过 `tsc` 编译)
|
|
20
|
-
- pnpm 包管理器
|
|
21
56
|
- Debian 12 Bookworm(或兼容的 Debian 发行版)
|
|
22
57
|
- 安装、删除和升级操作需要 root 权限
|
|
23
58
|
- 编译工具:`gcc`、`make`、`ldconfig`
|
|
24
59
|
|
|
25
|
-
|
|
60
|
+
### 快速安装(npm)
|
|
26
61
|
|
|
27
62
|
```bash
|
|
28
|
-
|
|
29
|
-
|
|
63
|
+
npm install -g pacman-debian@latest
|
|
64
|
+
sudo $(which pacman-debian-setup)
|
|
65
|
+
```
|
|
30
66
|
|
|
31
|
-
|
|
32
|
-
sudo
|
|
67
|
+
> [!WARNING]
|
|
68
|
+
> 如果在非 sudo 模式或者非 su 帐号下使用 npm 安装 pacman,即代表您已做好
|
|
69
|
+
> pacman-debian 及相关脚本可能被恶意修改或破坏的准备。
|
|
33
70
|
|
|
34
|
-
|
|
35
|
-
|
|
71
|
+
安装脚本将:
|
|
72
|
+
1. 创建默认配置文件 `/etc/pacman-debian/pacman.conf`
|
|
73
|
+
2. 创建 `/etc/pacman.conf` → `/etc/pacman-debian/pacman.conf` 符号链接
|
|
74
|
+
3. 创建所有 CLI 符号链接(`/usr/local/bin/pacman` 等)
|
|
75
|
+
4. 创建 `/var/lib/pacman` → `/var/lib/pacman-debian` 符号链接(fastfetch 检测用)
|
|
76
|
+
5. 安装 Arch 兼容工具(`update-ca-trust`、`archlinux-java`、`fix_default`)
|
|
77
|
+
6. 安装 Arch 兼容 shell 函数(`/etc/profile.d/append_path.sh`)
|
|
78
|
+
7. 在 dpkg 状态中注册虚拟 `pacman` 包
|
|
79
|
+
8. 创建默认 paclink 映射(sh → bash、python → python3 等)
|
|
80
|
+
|
|
81
|
+
安装后同步仓库即可使用:
|
|
36
82
|
|
|
37
|
-
|
|
83
|
+
```bash
|
|
38
84
|
sudo pacman -Sy
|
|
85
|
+
sudo pacman -S neofetch
|
|
86
|
+
```
|
|
39
87
|
|
|
40
|
-
|
|
41
|
-
pacman -Ss neofetch
|
|
88
|
+
### 开发安装
|
|
42
89
|
|
|
43
|
-
|
|
44
|
-
|
|
90
|
+
```bash
|
|
91
|
+
git clone https://github.com/Xbodwf/pacman-debian.git
|
|
92
|
+
cd pacman-debian
|
|
93
|
+
pnpm install
|
|
94
|
+
pnpm build # tsc + C 库
|
|
95
|
+
# 或分步执行:
|
|
96
|
+
pnpm exec tsc
|
|
97
|
+
make -C lib/pac4deb # 构建 libalpm.so
|
|
45
98
|
|
|
46
|
-
#
|
|
47
|
-
sudo
|
|
99
|
+
# 运行安装脚本
|
|
100
|
+
sudo node dist/scripts/setup.js
|
|
48
101
|
|
|
49
|
-
#
|
|
50
|
-
sudo
|
|
102
|
+
# 或手动设置:
|
|
103
|
+
sudo ln -sf "$PWD/dist/cli/pacman.js" /usr/local/bin/pacman
|
|
104
|
+
sudo ln -sf "$PWD/dist/cli/paclink.js" /usr/local/bin/paclink
|
|
105
|
+
sudo ln -sf "$PWD/dist/scripts/pacman-conf.js" /usr/local/bin/pacman-conf
|
|
106
|
+
sudo ln -sf "$PWD/dist/makepkg/index.js" /usr/local/bin/makepkg
|
|
51
107
|
```
|
|
52
108
|
|
|
53
109
|
## 配置
|
|
@@ -111,9 +167,73 @@ Type = arch
|
|
|
111
167
|
Architecture = auto
|
|
112
168
|
```
|
|
113
169
|
|
|
114
|
-
|
|
170
|
+
### 配置选项
|
|
115
171
|
|
|
116
|
-
|
|
172
|
+
| 选项 | 说明 |
|
|
173
|
+
|------|------|
|
|
174
|
+
| `Color` | 启用彩色输出(放在 `[options]` 段) |
|
|
175
|
+
| `Architecture` | 设置目标架构(默认 `auto`) |
|
|
176
|
+
| `IgnorePkg` | 跳过指定包的升级 |
|
|
177
|
+
|
|
178
|
+
## 架构
|
|
179
|
+
|
|
180
|
+
### 源文件结构
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
src/
|
|
184
|
+
├── cli/
|
|
185
|
+
│ ├── pacman.ts # CLI 参数解析和分发
|
|
186
|
+
│ ├── paclink.ts # 虚拟包链接管理
|
|
187
|
+
│ ├── update-ca-trust.ts # Arch 兼容 CA 证书更新器
|
|
188
|
+
│ ├── archlinux-java.ts # Arch 兼容 Java 环境管理器
|
|
189
|
+
│ └── fix_default.ts # Arch 兼容默认 JDK 助手
|
|
190
|
+
├── core/ # 包格式解析器、依赖引擎
|
|
191
|
+
│ ├── ar.ts # ar 归档解析器
|
|
192
|
+
│ ├── tar.ts # tar 提取器
|
|
193
|
+
│ ├── deb.ts # .deb 包解析器
|
|
194
|
+
│ ├── pkgfile.ts # .pkg.tar.zst 解析器
|
|
195
|
+
│ ├── compress.ts # gz/xz 解压缩
|
|
196
|
+
│ ├── control.ts # Debian control 文件解析器
|
|
197
|
+
│ └── deps.ts # 依赖解析引擎
|
|
198
|
+
├── db/
|
|
199
|
+
│ ├── localdb.ts # 目录式本地包数据库
|
|
200
|
+
│ ├── database.ts # 带事务的 DB 封装
|
|
201
|
+
│ └── dpkg-compat.ts # dpkg 状态文件读写
|
|
202
|
+
├── ops/
|
|
203
|
+
│ ├── install.ts # 包安装
|
|
204
|
+
│ ├── remove.ts # 包删除
|
|
205
|
+
│ ├── query.ts # 所有 -Q 查询
|
|
206
|
+
│ └── upgrade.ts # 同步 + 升级流程
|
|
207
|
+
├── repo/
|
|
208
|
+
│ ├── repository.ts # 仓库同步、下载、JSONL 缓存
|
|
209
|
+
│ └── config.ts # pacman.conf 解析器(支持 Include)
|
|
210
|
+
├── scripts/
|
|
211
|
+
│ └── setup.ts # 交互式安装脚本
|
|
212
|
+
├── makepkg/
|
|
213
|
+
│ ├── index.ts # makepkg 主入口
|
|
214
|
+
│ ├── pkgbuild.ts # PKGBUILD 解析器
|
|
215
|
+
│ ├── source.ts # 源码下载/解压
|
|
216
|
+
│ ├── build.ts # build()/package() 执行
|
|
217
|
+
│ └── printsrcinfo.ts # .SRCINFO 生成
|
|
218
|
+
├── ui/ # 用户界面(提示、格式化)
|
|
219
|
+
└── index.ts # 入口
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
lib/pac4deb/ # libalpm C 库
|
|
224
|
+
├── Makefile # 用 gcc 构建,目标 libalpm.so
|
|
225
|
+
├── include/
|
|
226
|
+
│ ├── alpm.h # 公共 libalpm API 头文件
|
|
227
|
+
│ └── alpm_list.h # 链表头文件
|
|
228
|
+
└── src/
|
|
229
|
+
├── libalpm.c # 核心实现(handle、db、pkg、JSON 解析器)
|
|
230
|
+
├── stubs_manual.c # ~200 个不常用 libalpm 函数的桩实现
|
|
231
|
+
└── alpm_list.c # 链表实现
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 数据库
|
|
235
|
+
|
|
236
|
+
#### 本地数据库:`/var/lib/pacman-debian/local/`
|
|
117
237
|
|
|
118
238
|
采用与 Arch Linux 本地 DB 一致的目录-包格式:
|
|
119
239
|
|
|
@@ -132,13 +252,13 @@ Architecture = auto
|
|
|
132
252
|
`index.json` 以 `name:base64path` 格式逐行记录包名到目录的映射,是删除和查询
|
|
133
253
|
的首选查找路径。若文件缺失或损坏会自动从文件系统重建。
|
|
134
254
|
|
|
135
|
-
|
|
255
|
+
#### dpkg 兼容
|
|
136
256
|
|
|
137
257
|
通过 `dpkg` 或 `apt` 安装的包在查询时直接从 `/var/lib/dpkg/status` 读取
|
|
138
258
|
(按 mtime 缓存)。`pacman-debian` 安装包时会同时写入 dpkg 兼容的条目,
|
|
139
259
|
确保 `apt` 和 `dpkg` 仍能识别该包。
|
|
140
260
|
|
|
141
|
-
|
|
261
|
+
#### 仓库缓存:`/var/cache/pacman-debian/packages/`
|
|
142
262
|
|
|
143
263
|
每个仓库以 JSON Lines 块形式缓存(每个 `.jsonl` 文件 5000 个包)。
|
|
144
264
|
同步时还会生成全局排序的 `packages.idx` 索引,格式:
|
|
@@ -154,7 +274,7 @@ Architecture = auto
|
|
|
154
274
|
└── ...
|
|
155
275
|
```
|
|
156
276
|
|
|
157
|
-
|
|
277
|
+
##### 内存索引缓存
|
|
158
278
|
|
|
159
279
|
`packages.idx` 在首次读取后驻留内存,按仓库名 + mtime 缓存:
|
|
160
280
|
|
|
@@ -171,15 +291,15 @@ IdxEntry { lines: string[], mtime: number, providesIndex: Map<string, Array<{chu
|
|
|
171
291
|
|
|
172
292
|
#### 查找路径
|
|
173
293
|
|
|
174
|
-
| 操作 |
|
|
175
|
-
|
|
176
|
-
| `-S <pkg>` / `-Qo` | 二分搜索 `packages.idx` → seek JSONL |
|
|
177
|
-
| `-Ss` | 逐行扫 `packages.idx`(包名+描述)→ seek JSONL |
|
|
178
|
-
| `-Sl` | 扫 `packages.idx` → seek 每个包 |
|
|
179
|
-
| 依赖 provides | 扫 `packages.idx` provides 字段 |
|
|
294
|
+
| 操作 | 方法 | 说明 |
|
|
295
|
+
|------|------|------|
|
|
296
|
+
| `-S <pkg>` / `-Qo` | 二分搜索 `packages.idx` → seek JSONL | O(log N),单行读取 |
|
|
297
|
+
| `-Ss` | 逐行扫 `packages.idx`(包名+描述)→ seek JSONL | ~1.4MB 扫描,不解析 JSON |
|
|
298
|
+
| `-Sl` | 扫 `packages.idx` → seek 每个包 | 通过索引懒加载 |
|
|
299
|
+
| 依赖 provides | 扫 `packages.idx` provides 字段 | 仅索引,不解析 JSON |
|
|
180
300
|
| `-Qi` / `-Ql` | dpkg 状态或本地数据库 | 不涉及缓存 |
|
|
181
301
|
|
|
182
|
-
|
|
302
|
+
### 仓库支持
|
|
183
303
|
|
|
184
304
|
- **Debian/Ubuntu**:从标准仓库索引读取 `Packages.gz` / `Packages.xz`。
|
|
185
305
|
支持 `Server` URL 中的 `$repo`/`$arch` 变量替换。
|
|
@@ -189,7 +309,7 @@ IdxEntry { lines: string[], mtime: number, providesIndex: Map<string, Array<{chu
|
|
|
189
309
|
因此在 Bookworm 上 Arch ARM 二进制仓库**无法使用**(升级 glibc 会损坏系统)。
|
|
190
310
|
请改用 `makepkg` 进行本地编译。
|
|
191
311
|
|
|
192
|
-
|
|
312
|
+
### libalpm C 库(libpac4deb)
|
|
193
313
|
|
|
194
314
|
位于 `lib/pac4deb/` 的 C 库,实现了 libalpm ABI(`alpm.h`),使基于 Go 的
|
|
195
315
|
AUR 助手(如 yay)无需修改即可在 Debian 上运行。它读取:
|
|
@@ -221,7 +341,51 @@ AUR 助手(如 yay)无需修改即可在 Debian 上运行。它读取:
|
|
|
221
341
|
- **Debian alternatives**:加载本地 DB 时检测 `/etc/alternatives/` 中的
|
|
222
342
|
`sh`、`awk`、`vi`、`editor` 等,自动为归属包添加虚拟 provides。
|
|
223
343
|
|
|
224
|
-
|
|
344
|
+
### 依赖引擎
|
|
345
|
+
|
|
346
|
+
依赖解析器(`src/core/deps.ts`)支持:
|
|
347
|
+
|
|
348
|
+
- 带版本约束的包名解析(`>=`、`<=`、`=`)
|
|
349
|
+
- OR 依赖(`|`)
|
|
350
|
+
- 架构限定符(如 `:arm64`、`:amd64`)
|
|
351
|
+
- Debian(逗号分隔)和 Arch(空格分隔)两种格式
|
|
352
|
+
- BFS 解析,带预加载 DB 状态
|
|
353
|
+
- 已安装和待安装包之间的冲突检测
|
|
354
|
+
- 系统包保护(glibc、libc6 等)
|
|
355
|
+
- `upgradeMode`:升级时依赖基准为"已安装版本",而非"仓库最新版本"
|
|
356
|
+
|
|
357
|
+
- **文件验证**:已安装的包如果磁盘上没有真实文件(只剩空目录),视为未安装,
|
|
358
|
+
强制重新下载。
|
|
359
|
+
- **显式目标始终处理依赖**:即使目标已安装,也会遍历其依赖检查缺失项。
|
|
360
|
+
- **队列出队**:依赖队列用 `shift()` 弹出已处理项,防止内存堆积。
|
|
361
|
+
|
|
362
|
+
#### 性能优化
|
|
363
|
+
|
|
364
|
+
| 技术 | 说明 |
|
|
365
|
+
|------|------|
|
|
366
|
+
| **idx 内存缓存** | `findInRepo()` 二分搜索直接在 `_idxCache` 的 `lines[]` 上进行,无需读文件(`src/repo/repository.ts:58`) |
|
|
367
|
+
| **provides 倒排索引** | `providesIndex` 在 idx 加载时构建,`findProvider()` 直接 `Map.get()`,O(1) 定位(`src/repo/repository.ts:69`) |
|
|
368
|
+
| **顺序 BFS + 指针游标** | 依赖队列用索引指针替代 `shift()`,避免数组塌缩开销(`src/core/deps.ts:74`) |
|
|
369
|
+
| **已解析集合去重** | `resolved` 用 `Set<string>` 去重,避免重复解析相同依赖(`src/core/deps.ts:73`) |
|
|
370
|
+
| **批量头尾双扫** | `batchFindInRepo()` 利用排序 idx 从首尾同时二分查找,适合升级候选收集(`src/repo/repository.ts`) |
|
|
371
|
+
| **keep-alive HTTP** | 共享 `https.Agent({ keepAlive: true, maxSockets: 8 })`,复用 TCP/TLS 连接(`src/repo/repository.ts:22`) |
|
|
372
|
+
| **异步解压 .gz** | `decompressAsync()` 用 `zlib.gunzip()` 回调版,不阻塞事件循环(`src/core/compress.ts:9`) |
|
|
373
|
+
| **304 条件请求** | 同步时发 `If-Modified-Since`,服务端返回 304 直接跳过(`src/repo/repository.ts:96`) |
|
|
374
|
+
|
|
375
|
+
#### 删除时的依赖处理(`src/ops/remove.ts`)
|
|
376
|
+
|
|
377
|
+
| 操作 | 逻辑 |
|
|
378
|
+
|------|------|
|
|
379
|
+
| `-R` | 仅删除指定包,不处理依赖 |
|
|
380
|
+
| `-Rs` | 删除包 + 递归查找孤儿(不被其他包 RequiredBy 的包),按逆拓扑序删除 |
|
|
381
|
+
| `-Rc` | 级联:找出所有"需要"目标包的包,一并删除 |
|
|
382
|
+
| `-Rsc` | 递归 + 级联组合 |
|
|
383
|
+
| `-Rn` | 备份 `/var/lib/dpkg/info/<pkg>.conffiles` 中的配置文件为 `.dpkg-old`,再删除 |
|
|
384
|
+
|
|
385
|
+
删除时自动排序:被依赖者先删(叶子节点先于根节点),确保依赖检查不报错。
|
|
386
|
+
`isRequiredByOthers()` 遍历所有已安装包的 `Depends` 字段,判断目标包是否被需要。
|
|
387
|
+
|
|
388
|
+
### makepkg(`src/makepkg/`)
|
|
225
389
|
|
|
226
390
|
独立的 `makepkg` 实现,无需 `base-devel` 或任何 Arch 工具即可从 PKGBUILD
|
|
227
391
|
构建 Arch Linux 包。
|
|
@@ -256,9 +420,9 @@ makepkg --syncdeps --install
|
|
|
256
420
|
| `--nocolor` | 禁用彩色输出 |
|
|
257
421
|
| `--printsrcinfo` | 打印 `.SRCINFO` 并退出 |
|
|
258
422
|
|
|
259
|
-
|
|
423
|
+
### 命令
|
|
260
424
|
|
|
261
|
-
|
|
425
|
+
#### 同步(-S)
|
|
262
426
|
|
|
263
427
|
| 命令 | 说明 |
|
|
264
428
|
|------|------|
|
|
@@ -275,7 +439,7 @@ makepkg --syncdeps --install
|
|
|
275
439
|
| `pacman -Scc` | 清空整个缓存目录(含仓库 jsonl/idx,需重新 -Sy) |
|
|
276
440
|
| `pacman -Sp <pkg>` | 打印实际下载 URL(不会安装) |
|
|
277
441
|
|
|
278
|
-
|
|
442
|
+
#### 删除(-R)
|
|
279
443
|
|
|
280
444
|
| 命令 | 说明 |
|
|
281
445
|
|------|------|
|
|
@@ -289,7 +453,7 @@ makepkg --syncdeps --install
|
|
|
289
453
|
|
|
290
454
|
支持多目标(`pacman -R a b`):所有目标合并显示后统一确认。
|
|
291
455
|
|
|
292
|
-
|
|
456
|
+
#### 查询(-Q)
|
|
293
457
|
|
|
294
458
|
| 命令 | 说明 |
|
|
295
459
|
|------|------|
|
|
@@ -302,21 +466,19 @@ makepkg --syncdeps --install
|
|
|
302
466
|
| `pacman -Qo <file>` | 查询文件属于哪个包 |
|
|
303
467
|
| `pacman -Qs <keyword>` | 搜索已安装的包 |
|
|
304
468
|
| `pacman -Qk [pkg]` | 验证已安装包的文件完整性(检查文件是否存在且非空) |
|
|
305
|
-
| `pacman -Qq` | 静默模式:仅输出包名,不带版本号 |
|
|
306
469
|
|
|
307
|
-
|
|
470
|
+
#### 其他
|
|
308
471
|
|
|
309
472
|
| 命令 | 说明 |
|
|
310
473
|
|------|------|
|
|
311
474
|
| `pacman -U <file>` | 安装本地包文件(.deb/.pkg.tar.zst) |
|
|
312
|
-
| `pacman -U <url>` | 从 http/https/ftp URL 下载后安装,装完自动清理 |
|
|
313
475
|
| `pacman -D --asdeps <pkg>` | 将包标记为依赖 |
|
|
314
476
|
| `pacman -D --asexplicit <pkg>` | 将包标记为显式安装 |
|
|
315
477
|
| `pacman -T <pkg>` | 检查依赖是否满足 |
|
|
316
478
|
| `pacman -F <file>` | 搜索提供该文件的包 |
|
|
317
479
|
| `pacman -V` | 显示版本号 |
|
|
318
480
|
|
|
319
|
-
|
|
481
|
+
#### 内置工具
|
|
320
482
|
|
|
321
483
|
| 命令 | 说明 |
|
|
322
484
|
|------|------|
|
|
@@ -324,8 +486,11 @@ makepkg --syncdeps --install
|
|
|
324
486
|
| `makepkg` | 从 PKGBUILD 文件构建 Arch Linux 包。支持 `--syncdeps`、`--install`、`--clean`、源码下载和 `.pkg.tar.zst` 创建。 |
|
|
325
487
|
| `pacman-debian-setup` | 交互式安装:创建配置、Include 文件、符号链接(`/etc/pacman.conf`、`/usr/local/bin/pacman`)和虚拟 `pacman` dpkg 条目。 |
|
|
326
488
|
| `paclink` | 管理持久化的 Debian→Arch 虚拟包名映射。链接存储在本地数据库中,仅对 pacman/libalpm 可见,dpkg 不可见。 |
|
|
489
|
+
| `update-ca-trust` | Arch 兼容 CA 证书更新器(包装 Debian 的 `update-ca-certificates`) |
|
|
490
|
+
| `archlinux-java` | Java 环境管理器:`status`、`get`、`set`、`unset`、`fix`(包装 `update-alternatives`) |
|
|
491
|
+
| `fix_default` | 打印当前默认 JDK 短名(Arch Java 包安装脚本内部使用) |
|
|
327
492
|
|
|
328
|
-
|
|
493
|
+
#### paclink(链接管理)
|
|
329
494
|
|
|
330
495
|
| 命令 | 说明 |
|
|
331
496
|
|------|------|
|
|
@@ -354,7 +519,7 @@ paclink -Ls python
|
|
|
354
519
|
链接以 `repoType: link` 存储在本地 DB。当某仓库中存在与链接同名的真包时,
|
|
355
520
|
真包优先,安装时自动移除链接。
|
|
356
521
|
|
|
357
|
-
|
|
522
|
+
#### 全局参数
|
|
358
523
|
|
|
359
524
|
| 参数 | 说明 |
|
|
360
525
|
|------|------|
|
|
@@ -364,115 +529,7 @@ paclink -Ls python
|
|
|
364
529
|
| `--noscriptlet` | 不执行安装脚本 |
|
|
365
530
|
| `--print` | 干运行:显示将要执行的操作但不实际执行 |
|
|
366
531
|
|
|
367
|
-
###
|
|
368
|
-
|
|
369
|
-
| 选项 | 说明 |
|
|
370
|
-
|------|------|
|
|
371
|
-
| `Color` | 启用彩色输出(放在 `[options]` 段) |
|
|
372
|
-
| `Architecture` | 设置目标架构(默认 `auto`) |
|
|
373
|
-
| `IgnorePkg` | 跳过指定包的升级 |
|
|
374
|
-
|
|
375
|
-
## 依赖引擎
|
|
376
|
-
|
|
377
|
-
依赖解析器(`src/core/deps.ts`)支持:
|
|
378
|
-
|
|
379
|
-
- 带版本约束的包名解析(`>=`、`<=`、`=`)
|
|
380
|
-
- OR 依赖(`|`)
|
|
381
|
-
- 架构限定符(如 `:arm64`、`:amd64`)
|
|
382
|
-
- Debian(逗号分隔)和 Arch(空格分隔)两种格式
|
|
383
|
-
- BFS 解析,带预加载 DB 状态
|
|
384
|
-
- 已安装和待安装包之间的冲突检测
|
|
385
|
-
- 系统包保护(glibc、libc6 等)
|
|
386
|
-
- `upgradeMode`:升级时依赖基准为"已安装版本",而非"仓库最新版本"
|
|
387
|
-
|
|
388
|
-
- **文件验证**:已安装的包如果磁盘上没有真实文件(只剩空目录),视为未安装,
|
|
389
|
-
强制重新下载。
|
|
390
|
-
- **显式目标始终处理依赖**:即使目标已安装,也会遍历其依赖检查缺失项。
|
|
391
|
-
- **队列出队**:依赖队列用 `shift()` 弹出已处理项,防止内存堆积。
|
|
392
|
-
|
|
393
|
-
### 性能优化
|
|
394
|
-
|
|
395
|
-
| 技术 | 说明 |
|
|
396
|
-
|------|------|
|
|
397
|
-
| **idx 内存缓存** | `findInRepo()` 二分搜索直接在 `_idxCache` 的 `lines[]` 上进行,无需读文件(`src/repo/repository.ts:58`) |
|
|
398
|
-
| **provides 倒排索引** | `providesIndex` 在 idx 加载时构建,`findProvider()` 直接 `Map.get()`,O(1) 定位(`src/repo/repository.ts:69`) |
|
|
399
|
-
| **顺序 BFS + 指针游标** | 依赖队列用索引指针替代 `shift()`,避免数组塌缩开销(`src/core/deps.ts:74`) |
|
|
400
|
-
| **已解析集合去重** | `resolved` 用 `Set<string>` 去重,避免重复解析相同依赖(`src/core/deps.ts:73`) |
|
|
401
|
-
| **批量头尾双扫** | `batchFindInRepo()` 利用排序 idx 从首尾同时二分查找,适合升级候选收集(`src/repo/repository.ts`) |
|
|
402
|
-
| **keep-alive HTTP** | 共享 `https.Agent({ keepAlive: true, maxSockets: 8 })`,复用 TCP/TLS 连接(`src/repo/repository.ts:22`) |
|
|
403
|
-
| **异步解压 .gz** | `decompressAsync()` 用 `zlib.gunzip()` 回调版,不阻塞事件循环(`src/core/compress.ts:9`) |
|
|
404
|
-
| **304 条件请求** | 同步时发 `If-Modified-Since`,服务端返回 304 直接跳过(`src/repo/repository.ts:96`) |
|
|
405
|
-
|
|
406
|
-
### 删除时的依赖处理(`src/ops/remove.ts`)
|
|
407
|
-
|
|
408
|
-
| 操作 | 逻辑 |
|
|
409
|
-
|------|------|
|
|
410
|
-
| `-R` | 仅删除指定包,不处理依赖 |
|
|
411
|
-
| `-Rs` | 删除包 + 递归查找孤儿(不被其他包 RequiredBy 的包),按逆拓扑序删除 |
|
|
412
|
-
| `-Rc` | 级联:找出所有"需要"目标包的包,一并删除 |
|
|
413
|
-
| `-Rsc` | 递归 + 级联组合 |
|
|
414
|
-
| `-Rn` | 备份 `/var/lib/dpkg/info/<pkg>.conffiles` 中的配置文件为 `.dpkg-old`,再删除 |
|
|
415
|
-
|
|
416
|
-
删除时自动排序:被依赖者先删(叶子节点先于根节点),确保依赖检查不报错。
|
|
417
|
-
`isRequiredByOthers()` 遍历所有已安装包的 `Depends` 字段,判断目标包是否被需要。
|
|
418
|
-
|
|
419
|
-
## 架构
|
|
420
|
-
|
|
421
|
-
```
|
|
422
|
-
src/
|
|
423
|
-
├── cli/
|
|
424
|
-
│ ├── pacman.ts # CLI 参数解析和分发
|
|
425
|
-
│ └── paclink.ts # 虚拟包链接管理
|
|
426
|
-
├── core/ # 包格式解析器、依赖引擎
|
|
427
|
-
│ ├── ar.ts # ar 归档解析器
|
|
428
|
-
│ ├── tar.ts # tar 提取器
|
|
429
|
-
│ ├── deb.ts # .deb 包解析器
|
|
430
|
-
│ ├── pkgfile.ts # .pkg.tar.zst 解析器
|
|
431
|
-
│ ├── compress.ts # gz/xz 解压缩
|
|
432
|
-
│ ├── control.ts # Debian control 文件解析器
|
|
433
|
-
│ └── deps.ts # 依赖解析引擎
|
|
434
|
-
├── db/
|
|
435
|
-
│ ├── localdb.ts # 目录式本地包数据库
|
|
436
|
-
│ ├── database.ts # 带事务的 DB 封装
|
|
437
|
-
│ └── dpkg-compat.ts # dpkg 状态文件读写
|
|
438
|
-
├── ops/
|
|
439
|
-
│ ├── install.ts # 包安装
|
|
440
|
-
│ ├── remove.ts # 包删除
|
|
441
|
-
│ ├── query.ts # 所有 -Q 查询
|
|
442
|
-
│ └── upgrade.ts # 同步 + 升级流程
|
|
443
|
-
├── repo/
|
|
444
|
-
│ ├── repository.ts # 仓库同步、下载、JSONL 缓存
|
|
445
|
-
│ └── config.ts # pacman.conf 解析器(支持 Include)
|
|
446
|
-
├── scripts/
|
|
447
|
-
│ └── setup.ts # 交互式安装脚本
|
|
448
|
-
├── makepkg/
|
|
449
|
-
│ ├── index.ts # makepkg 主入口
|
|
450
|
-
│ ├── pkgbuild.ts # PKGBUILD 解析器
|
|
451
|
-
│ ├── source.ts # 源码下载/解压
|
|
452
|
-
│ ├── build.ts # build()/package() 执行
|
|
453
|
-
│ └── printsrcinfo.ts # .SRCINFO 生成
|
|
454
|
-
├── ui/ # 用户界面(提示、格式化)
|
|
455
|
-
└── index.ts # 入口
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
## libalpm C 库
|
|
459
|
-
|
|
460
|
-
```
|
|
461
|
-
lib/pac4deb/
|
|
462
|
-
├── Makefile # 用 gcc 构建,目标 libalpm.so
|
|
463
|
-
├── include/
|
|
464
|
-
│ ├── alpm.h # 公共 libalpm API 头文件
|
|
465
|
-
│ └── alpm_list.h # 链表头文件
|
|
466
|
-
└── src/
|
|
467
|
-
├── libalpm.c # 核心实现(handle、db、pkg、JSON 解析器)
|
|
468
|
-
├── stubs_manual.c # ~200 个不常用 libalpm 函数的桩实现
|
|
469
|
-
└── alpm_list.c # 链表实现
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
构建:`make -C lib/pac4deb`
|
|
473
|
-
安装:`sudo make -C lib/pac4deb install`
|
|
474
|
-
|
|
475
|
-
## yay / AUR 支持
|
|
532
|
+
### yay / AUR 支持
|
|
476
533
|
|
|
477
534
|
通过内置 libalpm,`yay` 可与 `pacman-debian` 配合使用:
|
|
478
535
|
|
|
@@ -482,58 +539,13 @@ sudo apt install golang-go
|
|
|
482
539
|
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
|
483
540
|
cd /tmp/yay && go build -o /usr/local/bin/yay
|
|
484
541
|
|
|
485
|
-
# 与 pacman-debian
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
注意:依赖 `python`(而非 `python3`)的 AUR 包在 Debian 12 上无法解析,
|
|
491
|
-
因为系统包名是 `python3`。安装 `python-is-python3` 或创建符号链接可解决。
|
|
492
|
-
|
|
493
|
-
## 构建
|
|
494
|
-
|
|
495
|
-
```bash
|
|
496
|
-
pnpm install
|
|
497
|
-
pnpm build # tsc + C 库
|
|
498
|
-
# 或分步执行:
|
|
499
|
-
pnpm exec tsc
|
|
500
|
-
make -C lib/pac4deb # 构建 libalpm.so
|
|
542
|
+
# 与 pacman-debian 配合使用(PACMAN 环境变量自动识别)
|
|
543
|
+
yay -Ss ponysay
|
|
544
|
+
sudo -E yay -S ponysay
|
|
501
545
|
```
|
|
502
546
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
该项目在 v7.1.0 时更名为 `pacman-debian`。目前在 Debian 12 上
|
|
506
|
-
可用于日常包管理。已有功能:
|
|
507
|
-
|
|
508
|
-
- **依赖解析**:顺序 BFS + idx 内存缓存 + provides 倒排索引,亚秒级
|
|
509
|
-
依赖查找。删除时正确处理孤儿级联和 conffile 备份。
|
|
510
|
-
- **性能优化**:`packages.idx` 索引实现亚秒级单包查找。`-Ss` 只扫索引
|
|
511
|
-
(不解析 JSON)。全量 `-Sl` 通过索引 seek。HTTP keep-alive agent
|
|
512
|
-
复用 TCP 连接,异步 zlib 解压不阻塞事件循环。
|
|
513
|
-
- **并行同步**:多仓库并发下载,每仓库独立进度行。HTTP 条件请求(304)
|
|
514
|
-
跳过未变更仓库。Debian 组件串行但多仓库并行。
|
|
515
|
-
- **真正的下载能力**:`-Sw` 已能实际下载包文件,`-Sp` 打印真实 URL,
|
|
516
|
-
`-U` 支持 http/https/ftp/file URL 自动下载后安装。
|
|
517
|
-
- **选择性缓存清理**:`-Sc` 只删包缓存保留元数据,`-Scc` 清空全部。
|
|
518
|
-
- **多语言**:通过 `$LANG` 自动切换中英文。同步、安装、升级流程均已
|
|
519
|
-
本地化。消息目录在 `src/i18n/`。
|
|
520
|
-
- **颜色输出**:遵守 `pacman.conf` 的 `Color` 选项。颜色方案匹配官方
|
|
521
|
-
pacman(品红=仓库、绿=包名、红=错误)。
|
|
522
|
-
- **权限分离**:查询命令(`-Q`、`-Ss`、`-Si`、`-Sp`、`-Rp`)无需 root。
|
|
523
|
-
写操作需要 `sudo`。
|
|
524
|
-
- **链接系统**(`paclink`):Debian→Arch 虚拟包名映射以本地 DB 条目存储
|
|
525
|
-
(`repoType: link`)。仓库真包自动优先于链接,安装时覆盖。
|
|
526
|
-
链接仅对 pacman/libalpm 可见,dpkg 不可见。
|
|
527
|
-
- **作用域 i18n**:每个工具(pacman、paclink、setup)首次使用时才加载自己的
|
|
528
|
-
翻译文件,减少冷启动开销。语言:en、zh-CN。
|
|
529
|
-
|
|
530
|
-
主要限制:
|
|
531
|
-
|
|
532
|
-
- **Arch ARM 二进制仓库需要 glibc 2.38+** — Debian 12 自带 2.36。
|
|
533
|
-
本地 `makepkg` 构建可正常使用。
|
|
534
|
-
- **yay/AUR**:libalpm 桩库支持包搜索和依赖解析,但复杂 AUR 依赖链
|
|
535
|
-
可能因 Debian/Arch 包名差异而失败。
|
|
536
|
-
- **AUR 助手集成**仅测试了 yay(paru、pamac 等未测试)。
|
|
547
|
+
注意:依赖 `python`(而非 `python3`)的 AUR 包可通过 setup 创建的 paclink
|
|
548
|
+
映射 `python → python3` 自动解析。
|
|
537
549
|
|
|
538
550
|
## 许可证
|
|
539
551
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dpkg-compat.d.ts","sourceRoot":"","sources":["../../src/db/dpkg-compat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKtD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,MA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AYD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAclD"}
|
package/dist/db/dpkg-compat.js
CHANGED
|
@@ -124,10 +124,25 @@ function writeDpkgEntry(pkg) {
|
|
|
124
124
|
_dpkgCache = null; // invalidate cache
|
|
125
125
|
if (fs.existsSync(DPKG_INFO)) {
|
|
126
126
|
const lp = `${DPKG_INFO}/${pkg.name}.list`;
|
|
127
|
+
const files = pkg.files.length > 0
|
|
128
|
+
? pkg.files
|
|
129
|
+
: (pkg.depends && /^[a-z]/.test(pkg.depends)
|
|
130
|
+
? loadFilesFromDpkg(pkg.depends.split(',')[0].trim().split(/\s/)[0])
|
|
131
|
+
: []);
|
|
127
132
|
const existing = fs.existsSync(lp)
|
|
128
133
|
? fs.readFileSync(lp, 'utf8').split('\n').filter(Boolean)
|
|
129
134
|
: [];
|
|
130
|
-
fs.writeFileSync(lp, [...new Set([...existing, ...
|
|
135
|
+
fs.writeFileSync(lp, [...new Set([...existing, ...files])].sort().join('\n') + '\n');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function loadFilesFromDpkg(name) {
|
|
139
|
+
try {
|
|
140
|
+
const { execSync } = require('node:child_process');
|
|
141
|
+
const out = execSync(`dpkg -L ${name} 2>/dev/null`, { encoding: 'utf8', timeout: 5000 });
|
|
142
|
+
return out.trim().split('\n').filter(Boolean);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return [];
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
148
|
function removeDpkgEntry(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dpkg-compat.js","sourceRoot":"","sources":["../../src/db/dpkg-compat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,wCA0BC;AAED,wCAEC;AAoBD,
|
|
1
|
+
{"version":3,"file":"dpkg-compat.js","sourceRoot":"","sources":["../../src/db/dpkg-compat.ts"],"names":[],"mappings":";;;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M,CAAC,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE;QACxC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACxD,UAAU,GAAG,IAAI,CAAC;IAElB,MAAM,EAAE,GAAG,GAAG,SAAS,IAAI,IAAI,OAAO,CAAC;IACvC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacman-debian",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.11",
|
|
4
4
|
"description": "A Debian/Ubuntu package manager using Arch Linux pacman syntax. Manages .deb packages at dpkg level, supports Arch .pkg.tar.zst, AUR helpers (yay), and makepkg. Configurable multi-repo setup.",
|
|
5
5
|
"pacmanVersion": "7.1.0",
|
|
6
6
|
"main": "dist/index.js",
|