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.
- package/README.md +36 -504
- package/README_zh-CN.md +35 -489
- package/dist/ar.d.ts +8 -0
- package/dist/cli/archlinux-java.d.ts +3 -0
- package/dist/cli/fix_default.d.ts +3 -0
- package/dist/cli/paclink.d.ts +3 -0
- package/dist/cli/pacman.d.ts +2 -0
- package/dist/cli/pacman.d.ts.map +1 -1
- package/dist/cli/pacman.js +4 -1
- package/dist/cli/pacman.js.map +1 -1
- package/dist/cli/update-ca-trust.d.ts +3 -0
- package/dist/compress.d.ts +2 -0
- package/dist/config.d.ts +3 -0
- package/dist/control.d.ts +2 -0
- package/dist/core/ar.d.ts +7 -0
- package/dist/core/compress.d.ts +4 -0
- package/dist/core/control.d.ts +2 -0
- package/dist/core/deb.d.ts +4 -0
- package/dist/core/deps.d.ts +28 -0
- package/dist/core/options.d.ts +19 -0
- package/dist/core/pkgfile.d.ts +35 -0
- package/dist/core/tar.d.ts +13 -0
- package/dist/core/types.d.ts +83 -0
- package/dist/database.d.ts +20 -0
- package/dist/db/database.d.ts +17 -0
- package/dist/db/dpkg-compat.d.ts +19 -0
- package/dist/db/localdb.d.ts +9 -0
- package/dist/db/sqlite.d.ts +20 -0
- package/dist/deb.d.ts +5 -0
- package/dist/dpkg-compat.d.ts +18 -0
- package/dist/i18n/en.json +2 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/paclink/en.d.ts +3 -0
- package/dist/i18n/paclink/zh-CN.d.ts +3 -0
- package/dist/i18n/setup/en.d.ts +3 -0
- package/dist/i18n/setup/zh-CN.d.ts +3 -0
- package/dist/i18n/zh-CN.json +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/install.d.ts +2 -0
- package/dist/makepkg/build.d.ts +19 -0
- package/dist/makepkg/index.d.ts +3 -0
- package/dist/makepkg/pkgbuild.d.ts +36 -0
- package/dist/ops/install.d.ts +5 -0
- package/dist/ops/query.d.ts +9 -0
- package/dist/ops/remove.d.ts +4 -0
- package/dist/ops/upgrade.d.ts +4 -0
- package/dist/pacman.d.ts +2 -0
- package/dist/query.d.ts +5 -0
- package/dist/remove.d.ts +2 -0
- package/dist/repo/config.d.ts +3 -0
- package/dist/repo/repository.d.ts +20 -0
- package/dist/repository.d.ts +10 -0
- package/dist/scripts/pacman-conf.d.ts +3 -0
- package/dist/scripts/setup.d.ts +3 -0
- package/dist/tar.d.ts +17 -0
- package/dist/types.d.ts +80 -0
- package/dist/ui/colors.d.ts +13 -0
- package/dist/ui/format.d.ts +3 -0
- package/dist/ui/progress.d.ts +8 -0
- package/dist/ui/prompt.d.ts +4 -0
- package/docs/en/architecture.md +188 -0
- package/docs/en/configuration.md +84 -0
- package/docs/en/installation.md +67 -0
- package/docs/en/makepkg.md +38 -0
- package/docs/en/paclink.md +73 -0
- package/docs/en/usage.md +91 -0
- package/docs/en/yay-aur.md +65 -0
- package/docs/zh-CN/architecture.md +171 -0
- package/docs/zh-CN/configuration.md +80 -0
- package/docs/zh-CN/installation.md +65 -0
- package/docs/zh-CN/makepkg.md +32 -0
- package/docs/zh-CN/paclink.md +70 -0
- package/docs/zh-CN/usage.md +90 -0
- package/docs/zh-CN/yay-aur.md +44 -0
- package/lib/pac4deb/Makefile +26 -0
- package/lib/pac4deb/README.md +47 -0
- package/lib/pac4deb/include/alpm.h +166 -0
- package/lib/pac4deb/include/alpm_list.h +43 -0
- package/lib/pac4deb/src/alpm_list.c +120 -0
- package/lib/pac4deb/src/genstubs.sh +51 -0
- package/lib/pac4deb/src/genstubs2.sh +72 -0
- package/lib/pac4deb/src/genstubs3.sh +43 -0
- package/lib/pac4deb/src/libalpm.c +964 -0
- package/lib/pac4deb/src/stubs_manual.c +452 -0
- package/package.json +19 -1
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/* Hand-written stubs for libalpm functions not in libalpm.c */
|
|
2
|
+
#include "../include/alpm.h"
|
|
3
|
+
#include "../include/alpm_list.h"
|
|
4
|
+
#include <stdio.h>
|
|
5
|
+
#include <stdlib.h>
|
|
6
|
+
#include <string.h>
|
|
7
|
+
#include <dirent.h>
|
|
8
|
+
#include <sys/stat.h>
|
|
9
|
+
#include <fcntl.h>
|
|
10
|
+
#include <unistd.h>
|
|
11
|
+
|
|
12
|
+
/* Option setters/getters not implemented */
|
|
13
|
+
int alpm_option_set_usesyslog(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
14
|
+
int alpm_option_set_checkspace(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
15
|
+
int alpm_option_set_default_siglevel(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
16
|
+
int alpm_option_set_parallel_downloads(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
17
|
+
int alpm_option_set_hookdirs(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
18
|
+
int alpm_option_set_noupgrades(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
19
|
+
int alpm_option_set_noextracts(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
20
|
+
int alpm_option_set_ignorepkgs(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
21
|
+
int alpm_option_set_ignoregroups(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
22
|
+
int alpm_option_set_overwrite_files(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
23
|
+
int alpm_option_set_sandboxuser(alpm_handle_t *h, const char *v) { (void)h; (void)v; return 0; }
|
|
24
|
+
int alpm_option_set_architectures(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
25
|
+
int alpm_option_set_assumeinstalled(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
26
|
+
int alpm_option_set_dlopen(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
27
|
+
int alpm_option_set_lockfile(alpm_handle_t *h, const char *v) { (void)h; (void)v; return 0; }
|
|
28
|
+
int alpm_option_set_disable_sandbox_filesystem(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
29
|
+
int alpm_option_set_disable_sandbox_syscalls(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
30
|
+
int alpm_option_set_dlcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
31
|
+
int alpm_option_set_eventcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
32
|
+
int alpm_option_set_fetchcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
33
|
+
int alpm_option_set_logcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
34
|
+
int alpm_option_set_questioncb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
35
|
+
int alpm_option_set_progresscb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
36
|
+
|
|
37
|
+
/* Option getters */
|
|
38
|
+
int alpm_option_get_usesyslog(alpm_handle_t *h) { (void)h; return 0; }
|
|
39
|
+
int alpm_option_get_checkspace(alpm_handle_t *h) { (void)h; return 0; }
|
|
40
|
+
int alpm_option_get_default_siglevel(alpm_handle_t *h) { (void)h; return 0; }
|
|
41
|
+
int alpm_option_get_parallel_downloads(alpm_handle_t *h) { (void)h; return 0; }
|
|
42
|
+
int alpm_option_get_dlopen(alpm_handle_t *h) { (void)h; return 0; }
|
|
43
|
+
int alpm_option_get_dlopen_ctx(alpm_handle_t *h) { (void)h; return 0; }
|
|
44
|
+
int alpm_option_get_disable_sandbox_filesystem(alpm_handle_t *h) { (void)h; return 0; }
|
|
45
|
+
int alpm_option_get_disable_sandbox_syscalls(alpm_handle_t *h) { (void)h; return 0; }
|
|
46
|
+
void *alpm_option_get_dlcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
47
|
+
void *alpm_option_get_eventcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
48
|
+
void *alpm_option_get_fetchcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
49
|
+
void *alpm_option_get_logcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
50
|
+
void *alpm_option_get_questioncb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
51
|
+
void *alpm_option_get_progresscb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
52
|
+
void *alpm_option_get_dlcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
53
|
+
void *alpm_option_get_eventcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
54
|
+
void *alpm_option_get_fetchcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
55
|
+
void *alpm_option_get_logcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
56
|
+
void *alpm_option_get_questioncb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
57
|
+
void *alpm_option_get_progresscb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
58
|
+
const char *alpm_option_get_root(alpm_handle_t *h) { (void)h; return NULL; }
|
|
59
|
+
void *alpm_option_get_cachedirs(alpm_handle_t *h) { (void)h; return NULL; }
|
|
60
|
+
void *alpm_option_get_hookdirs(alpm_handle_t *h) { (void)h; return NULL; }
|
|
61
|
+
void *alpm_option_get_noupgrades(alpm_handle_t *h) { (void)h; return NULL; }
|
|
62
|
+
void *alpm_option_get_noextracts(alpm_handle_t *h) { (void)h; return NULL; }
|
|
63
|
+
void *alpm_option_get_ignorepkgs(alpm_handle_t *h) { (void)h; return NULL; }
|
|
64
|
+
void *alpm_option_get_ignoregroups(alpm_handle_t *h) { (void)h; return NULL; }
|
|
65
|
+
void *alpm_option_get_overwrite_files(alpm_handle_t *h) { (void)h; return NULL; }
|
|
66
|
+
void *alpm_option_get_sandboxuser(alpm_handle_t *h) { (void)h; return NULL; }
|
|
67
|
+
void *alpm_option_get_architectures(alpm_handle_t *h) { (void)h; return NULL; }
|
|
68
|
+
void *alpm_option_get_assumeinstalled(alpm_handle_t *h) { (void)h; return NULL; }
|
|
69
|
+
|
|
70
|
+
/* Option add/remove helpers */
|
|
71
|
+
int alpm_option_add_hookdir(alpm_handle_t *h, const char *d) { (void)h; (void)d; return 0; }
|
|
72
|
+
int alpm_option_add_architecture(alpm_handle_t *h, const char *a) { (void)h; (void)a; return 0; }
|
|
73
|
+
int alpm_option_add_assumeinstalled(alpm_handle_t *h, void *d) { (void)h; (void)d; return 0; }
|
|
74
|
+
int alpm_option_add_ignorepkg(alpm_handle_t *h, const char *p) { (void)h; (void)p; return 0; }
|
|
75
|
+
int alpm_option_add_ignoregroup(alpm_handle_t *h, const char *g) { (void)h; (void)g; return 0; }
|
|
76
|
+
int alpm_option_add_noupgrade(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
77
|
+
int alpm_option_add_noextract(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
78
|
+
int alpm_option_add_overwrite_file(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
79
|
+
int alpm_option_remove_cachedir(alpm_handle_t *h, const char *d) { (void)h; (void)d; return 0; }
|
|
80
|
+
int alpm_option_remove_hookdir(alpm_handle_t *h, const char *d) { (void)h; (void)d; return 0; }
|
|
81
|
+
int alpm_option_remove_architecture(alpm_handle_t *h, const char *a) { (void)h; (void)a; return 0; }
|
|
82
|
+
int alpm_option_remove_assumeinstalled(alpm_handle_t *h, void *d) { (void)h; (void)d; return 0; }
|
|
83
|
+
int alpm_option_remove_ignorepkg(alpm_handle_t *h, const char *p) { (void)h; (void)p; return 0; }
|
|
84
|
+
int alpm_option_remove_ignoregroup(alpm_handle_t *h, const char *g) { (void)h; (void)g; return 0; }
|
|
85
|
+
int alpm_option_remove_noupgrade(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
86
|
+
int alpm_option_remove_noextract(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
87
|
+
int alpm_option_remove_overwrite_file(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
88
|
+
|
|
89
|
+
/* Match helpers */
|
|
90
|
+
int alpm_option_match_noupgrade(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
91
|
+
int alpm_option_match_noextract(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
92
|
+
|
|
93
|
+
/* Database operations */
|
|
94
|
+
int alpm_db_update(alpm_handle_t *h, void *dbs, int force) { (void)h; (void)dbs; (void)force; return 0; }
|
|
95
|
+
int alpm_db_get_valid(alpm_db_t *db) { (void)db; return 1; }
|
|
96
|
+
const char *alpm_db_get_name(alpm_db_t *db) {
|
|
97
|
+
// treename is the first field of the internal struct
|
|
98
|
+
if (!db) return NULL;
|
|
99
|
+
struct __alpm_db_t { char *treename; void *pkgs; int is_local; };
|
|
100
|
+
return ((struct __alpm_db_t *)db)->treename;
|
|
101
|
+
}
|
|
102
|
+
void *alpm_db_get_groupcache(alpm_db_t *db) { (void)db; return NULL; }
|
|
103
|
+
void *alpm_db_get_group(alpm_db_t *db, const char *n) { (void)db; (void)n; return NULL; }
|
|
104
|
+
void *alpm_db_get_servers(alpm_db_t *db) { (void)db; return NULL; }
|
|
105
|
+
void *alpm_db_get_cache_servers(alpm_db_t *db) { (void)db; return NULL; }
|
|
106
|
+
int alpm_db_set_servers(alpm_db_t *db, void *s) { (void)db; (void)s; return 0; }
|
|
107
|
+
int alpm_db_set_cache_servers(alpm_db_t *db, void *s) { (void)db; (void)s; return 0; }
|
|
108
|
+
int alpm_db_set_usage(alpm_db_t *db, int u) { (void)db; (void)u; return 0; }
|
|
109
|
+
int alpm_db_get_usage(alpm_db_t *db) { (void)db; return 0; }
|
|
110
|
+
int alpm_db_get_siglevel(alpm_db_t *db) { (void)db; return 0; }
|
|
111
|
+
int alpm_db_check_pgp_signature(alpm_db_t *db) { (void)db; return 0; }
|
|
112
|
+
void *alpm_db_get_handle(alpm_db_t *db) { (void)db; return NULL; }
|
|
113
|
+
void *alpm_db_add_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
114
|
+
void *alpm_db_add_cache_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
115
|
+
void *alpm_db_remove_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
116
|
+
void *alpm_db_remove_cache_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
117
|
+
|
|
118
|
+
/* Package operations */
|
|
119
|
+
int alpm_pkg_load(alpm_handle_t *h, const char *fn, int f, int l, void **p) { (void)h; (void)fn; (void)f; (void)l; (void)p; return -1; }
|
|
120
|
+
int alpm_pkg_checkmd5sum(alpm_pkg_t *p) { (void)p; return 0; }
|
|
121
|
+
int alpm_fetch_pkgurl(alpm_handle_t *h, void *urls) { (void)h; (void)urls; return -1; }
|
|
122
|
+
void *alpm_find_group_pkgs(void *dbs, const char *n) { (void)dbs; (void)n; return NULL; }
|
|
123
|
+
void *alpm_checkdeps(alpm_handle_t *h, void *pkglist) { (void)h; (void)pkglist; return NULL; }
|
|
124
|
+
alpm_pkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *dep) {
|
|
125
|
+
if (!pkgs || !dep) return NULL;
|
|
126
|
+
char depname[256];
|
|
127
|
+
int i = 0;
|
|
128
|
+
while (dep[i] && dep[i] != '<' && dep[i] != '>' && dep[i] != '=' && i < 255) {
|
|
129
|
+
depname[i] = dep[i]; i++;
|
|
130
|
+
}
|
|
131
|
+
depname[i] = 0;
|
|
132
|
+
alpm_list_t *it;
|
|
133
|
+
for (it = pkgs; it; it = it->next) {
|
|
134
|
+
alpm_pkg_t *p = (alpm_pkg_t *)it->data;
|
|
135
|
+
if (!p) continue;
|
|
136
|
+
if (strcmp(alpm_pkg_get_name(p), depname) == 0) return p;
|
|
137
|
+
extern int alpm_pkg_has_provide(alpm_pkg_t*, const char*);
|
|
138
|
+
if (alpm_pkg_has_provide(p, depname)) return p;
|
|
139
|
+
}
|
|
140
|
+
return NULL;
|
|
141
|
+
}
|
|
142
|
+
#define PKG_CACHE "/var/cache/pacman-debian/packages"
|
|
143
|
+
|
|
144
|
+
/* Forward declarations from libalpm.c */
|
|
145
|
+
extern alpm_list_t *load_jsonl_mem(const char *json_str);
|
|
146
|
+
|
|
147
|
+
/* Read a single package from JSONL by file offset */
|
|
148
|
+
static alpm_pkg_t *read_pkg_at(const char *pkgdir, const char *chunkfile, int offset) {
|
|
149
|
+
char path[4096];
|
|
150
|
+
snprintf(path, sizeof(path), "%s/%s", pkgdir, chunkfile);
|
|
151
|
+
int fd = open(path, O_RDONLY);
|
|
152
|
+
if (fd < 0) return NULL;
|
|
153
|
+
/* Read up to 64KB from offset */
|
|
154
|
+
char buf[65536];
|
|
155
|
+
int n = pread(fd, buf, sizeof(buf) - 1, offset);
|
|
156
|
+
close(fd);
|
|
157
|
+
if (n <= 0) return NULL;
|
|
158
|
+
buf[n] = 0;
|
|
159
|
+
/* Find newline to get a complete JSON line */
|
|
160
|
+
char *nl = strchr(buf, '\n');
|
|
161
|
+
if (nl) *nl = 0;
|
|
162
|
+
if (buf[0] != '{') return NULL;
|
|
163
|
+
alpm_list_t *pkgs = load_jsonl_mem(buf);
|
|
164
|
+
if (!pkgs) return NULL;
|
|
165
|
+
alpm_pkg_t *result = (alpm_pkg_t *)pkgs->data;
|
|
166
|
+
free(pkgs);
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Find a package by exact name in a packages.idx file using binary search */
|
|
171
|
+
static alpm_pkg_t *find_in_idx(const char *idxpath, const char *pkgname) {
|
|
172
|
+
/* Read the idx file */
|
|
173
|
+
int fd = open(idxpath, O_RDONLY);
|
|
174
|
+
if (fd < 0) return NULL;
|
|
175
|
+
struct stat st;
|
|
176
|
+
if (fstat(fd, &st) < 0) { close(fd); return NULL; }
|
|
177
|
+
char *buf = malloc(st.st_size + 1);
|
|
178
|
+
if (!buf) { close(fd); return NULL; }
|
|
179
|
+
int n = read(fd, buf, st.st_size);
|
|
180
|
+
close(fd);
|
|
181
|
+
if (n <= 0) { free(buf); return NULL; }
|
|
182
|
+
buf[n] = 0;
|
|
183
|
+
|
|
184
|
+
/* Split into lines */
|
|
185
|
+
char **lines = NULL;
|
|
186
|
+
int nlines = 0;
|
|
187
|
+
char *line = buf;
|
|
188
|
+
while (line && *line) {
|
|
189
|
+
char *nl = strchr(line, '\n');
|
|
190
|
+
if (nl) *nl = 0;
|
|
191
|
+
if (*line) {
|
|
192
|
+
lines = realloc(lines, (nlines + 1) * sizeof(char*));
|
|
193
|
+
lines[nlines++] = line;
|
|
194
|
+
}
|
|
195
|
+
line = nl ? nl + 1 : NULL;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Binary search by name */
|
|
199
|
+
int lo = 0, hi = nlines - 1;
|
|
200
|
+
alpm_pkg_t *result = NULL;
|
|
201
|
+
while (lo <= hi) {
|
|
202
|
+
int mid = (lo + hi) / 2;
|
|
203
|
+
/* Get package name (first token before space) */
|
|
204
|
+
char *ln = lines[mid];
|
|
205
|
+
int name_len = 0;
|
|
206
|
+
while (ln[name_len] && ln[name_len] != ' ') name_len++;
|
|
207
|
+
int cmp = strncmp(pkgname, ln, name_len);
|
|
208
|
+
if (cmp == 0 && name_len == (int)strlen(pkgname)) {
|
|
209
|
+
/* Found! Parse idx line format: name desc\t[provides]\tchunkfile\toffset */
|
|
210
|
+
/* Find last two tabs to get chunkfile and offset */
|
|
211
|
+
char *last_tab = NULL, *second_last_tab = NULL;
|
|
212
|
+
int tab_count = 0;
|
|
213
|
+
for (char *q = ln; *q; q++) {
|
|
214
|
+
if (*q == '\t') {
|
|
215
|
+
second_last_tab = last_tab;
|
|
216
|
+
last_tab = q;
|
|
217
|
+
tab_count++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (tab_count >= 2 && last_tab && second_last_tab) {
|
|
221
|
+
int offset = atoi(last_tab + 1);
|
|
222
|
+
*last_tab = 0;
|
|
223
|
+
char *chunkfile = second_last_tab + 1;
|
|
224
|
+
/* Get pkgdir from idxpath: strip "/packages.idx" */
|
|
225
|
+
int plen = strlen(idxpath) - 12;
|
|
226
|
+
char pkgdir[4096];
|
|
227
|
+
strncpy(pkgdir, idxpath, plen);
|
|
228
|
+
pkgdir[plen] = 0;
|
|
229
|
+
result = read_pkg_at(pkgdir, chunkfile, offset);
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
} else if (cmp < 0 || (cmp == 0 && name_len < (int)strlen(pkgname))) {
|
|
233
|
+
hi = mid - 1;
|
|
234
|
+
} else {
|
|
235
|
+
lo = mid + 1;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Binary search by name failed - scan for provides match */
|
|
240
|
+
if (!result) {
|
|
241
|
+
for (int i = 0; i < nlines; i++) {
|
|
242
|
+
char *ln = lines[i];
|
|
243
|
+
/* Find provides field: between first and second tab */
|
|
244
|
+
char *tab1 = strchr(ln, '\t');
|
|
245
|
+
if (!tab1) continue;
|
|
246
|
+
char *tab2 = strchr(tab1 + 1, '\t');
|
|
247
|
+
if (!tab2) continue;
|
|
248
|
+
*tab2 = 0;
|
|
249
|
+
char *provides_str = tab1 + 1;
|
|
250
|
+
if (!*provides_str) { *tab2 = '\t'; continue; }
|
|
251
|
+
/* Tokenize by comma and check */
|
|
252
|
+
char copy[2048];
|
|
253
|
+
strncpy(copy, provides_str, sizeof(copy) - 1);
|
|
254
|
+
copy[sizeof(copy) - 1] = 0;
|
|
255
|
+
char *tok = strtok(copy, ",");
|
|
256
|
+
while (tok) {
|
|
257
|
+
while (*tok == ' ') tok++;
|
|
258
|
+
char *end = tok + strlen(tok) - 1;
|
|
259
|
+
while (end > tok && (*end == ' ')) end--;
|
|
260
|
+
end[1] = 0;
|
|
261
|
+
if (strcmp(tok, pkgname) == 0) {
|
|
262
|
+
*tab2 = '\t';
|
|
263
|
+
/* Found by provides - parse using same logic as above */
|
|
264
|
+
char *lt = NULL, *slt = NULL;
|
|
265
|
+
int tc = 0;
|
|
266
|
+
for (char *q = ln; *q; q++) {
|
|
267
|
+
if (*q == '\t') { slt = lt; lt = q; tc++; }
|
|
268
|
+
}
|
|
269
|
+
if (tc >= 2 && lt && slt) {
|
|
270
|
+
int off = atoi(lt + 1);
|
|
271
|
+
*lt = 0;
|
|
272
|
+
char *cf = slt + 1;
|
|
273
|
+
int pl = strlen(idxpath) - 12;
|
|
274
|
+
char pd[4096];
|
|
275
|
+
strncpy(pd, idxpath, pl);
|
|
276
|
+
pd[pl] = 0;
|
|
277
|
+
result = read_pkg_at(pd, cf, off);
|
|
278
|
+
}
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
tok = strtok(NULL, ",");
|
|
282
|
+
}
|
|
283
|
+
if (result) break;
|
|
284
|
+
*tab2 = '\t';
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
free(lines);
|
|
289
|
+
free(buf);
|
|
290
|
+
return result;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Dep name: strip version constraints */
|
|
294
|
+
static void dep_name(const char *dep, char *out, int outlen) {
|
|
295
|
+
int i = 0;
|
|
296
|
+
while (dep[i] && dep[i] != '<' && dep[i] != '>' && dep[i] != '=' && i < outlen - 1) {
|
|
297
|
+
out[i] = dep[i]; i++;
|
|
298
|
+
}
|
|
299
|
+
out[i] = 0;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
alpm_pkg_t *alpm_find_dbs_satisfier(alpm_handle_t *h, alpm_list_t *dbs, const char *dep) {
|
|
303
|
+
if (!dep) return NULL;
|
|
304
|
+
char depname[256];
|
|
305
|
+
dep_name(dep, depname, sizeof(depname));
|
|
306
|
+
|
|
307
|
+
/* Search registered databases using fast idx binary search */
|
|
308
|
+
if (dbs) {
|
|
309
|
+
alpm_list_t *it;
|
|
310
|
+
for (it = dbs; it; it = it->next) {
|
|
311
|
+
alpm_db_t *db = (alpm_db_t *)it->data;
|
|
312
|
+
if (!db) continue;
|
|
313
|
+
extern const char *alpm_db_get_name(alpm_db_t *db);
|
|
314
|
+
const char *name = alpm_db_get_name(db);
|
|
315
|
+
if (!name) continue;
|
|
316
|
+
char idxpath[4096];
|
|
317
|
+
snprintf(idxpath, sizeof(idxpath), "%s/%s/packages.idx", PKG_CACHE, name);
|
|
318
|
+
struct stat st;
|
|
319
|
+
if (stat(idxpath, &st) != 0) continue;
|
|
320
|
+
alpm_pkg_t *found = find_in_idx(idxpath, depname);
|
|
321
|
+
if (found) {
|
|
322
|
+
extern void alpm_pkg_set_db(alpm_pkg_t *, void *);
|
|
323
|
+
alpm_pkg_set_db(found, db);
|
|
324
|
+
return found;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
/* Fallback: search all packages.idx files directly */
|
|
329
|
+
DIR *dir = opendir(PKG_CACHE);
|
|
330
|
+
if (dir) {
|
|
331
|
+
struct dirent *e;
|
|
332
|
+
while ((e = readdir(dir)) != NULL) {
|
|
333
|
+
if (e->d_name[0] == '.') continue;
|
|
334
|
+
char idxpath[4096];
|
|
335
|
+
snprintf(idxpath, sizeof(idxpath), "%s/%s/packages.idx", PKG_CACHE, e->d_name);
|
|
336
|
+
struct stat st;
|
|
337
|
+
if (stat(idxpath, &st) != 0) continue;
|
|
338
|
+
alpm_pkg_t *found = find_in_idx(idxpath, depname);
|
|
339
|
+
if (found) {
|
|
340
|
+
closedir(dir);
|
|
341
|
+
return found;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
closedir(dir);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* Finally, search local database (installed dpkg/pacman-debian packages) */
|
|
349
|
+
if (h) {
|
|
350
|
+
alpm_db_t *localdb = alpm_option_get_localdb(h);
|
|
351
|
+
if (localdb) {
|
|
352
|
+
alpm_list_t *pkgs = alpm_db_get_pkgcache(localdb);
|
|
353
|
+
alpm_pkg_t *found = alpm_find_satisfier(pkgs, depname);
|
|
354
|
+
if (found) {
|
|
355
|
+
extern void alpm_pkg_set_db(alpm_pkg_t *, void *);
|
|
356
|
+
alpm_pkg_set_db(found, localdb);
|
|
357
|
+
return found;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/* Last resort: for lib*.so SONAMEs, query dpkg directly */
|
|
363
|
+
if (strncmp(depname, "lib", 3) == 0 && strstr(depname, ".so")) {
|
|
364
|
+
char cmd[512];
|
|
365
|
+
snprintf(cmd, sizeof(cmd),
|
|
366
|
+
"dpkg -S '%s' 2>/dev/null | head -1 | cut -d: -f1",
|
|
367
|
+
depname);
|
|
368
|
+
FILE *fp = popen(cmd, "r");
|
|
369
|
+
if (fp) {
|
|
370
|
+
char pkgname[256] = {0};
|
|
371
|
+
if (fgets(pkgname, sizeof(pkgname), fp)) {
|
|
372
|
+
size_t pl = strlen(pkgname);
|
|
373
|
+
while (pl > 0 && (pkgname[pl-1] == '\n' || pkgname[pl-1] == ' ')) pkgname[--pl] = 0;
|
|
374
|
+
}
|
|
375
|
+
pclose(fp);
|
|
376
|
+
if (pkgname[0]) {
|
|
377
|
+
/* Strip :arch suffix (e.g. "libharfbuzz-dev:arm64" -> "libharfbuzz-dev") */
|
|
378
|
+
char *colon = strchr(pkgname, ':');
|
|
379
|
+
if (colon) *colon = 0;
|
|
380
|
+
alpm_db_t *localdb = alpm_option_get_localdb(h);
|
|
381
|
+
if (localdb) {
|
|
382
|
+
alpm_list_t *pkgs = alpm_db_get_pkgcache(localdb);
|
|
383
|
+
for (alpm_list_t *it = pkgs; it; it = it->next) {
|
|
384
|
+
alpm_pkg_t *p = it->data;
|
|
385
|
+
const char *n = alpm_pkg_get_name(p);
|
|
386
|
+
if (n && strcmp(n, pkgname) == 0) {
|
|
387
|
+
extern void alpm_pkg_set_db(alpm_pkg_t *, void *);
|
|
388
|
+
alpm_pkg_set_db(p, localdb);
|
|
389
|
+
return p;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return NULL;
|
|
397
|
+
}
|
|
398
|
+
int alpm_checkconflicts(alpm_handle_t *h, void *pkglist) { (void)h; (void)pkglist; return 0; }
|
|
399
|
+
void *alpm_dep_from_string(const char *s) { (void)s; return NULL; }
|
|
400
|
+
const char *alpm_dep_compute_string(void *d) { (void)d; return NULL; }
|
|
401
|
+
void alpm_dep_free(void *d) { (void)d; }
|
|
402
|
+
void alpm_conflict_free(void *c) { (void)c; }
|
|
403
|
+
void alpm_fileconflict_free(void *c) { (void)c; }
|
|
404
|
+
void alpm_depmissing_free(void *m) { (void)m; }
|
|
405
|
+
void alpm_siglist_cleanup(void *s) { (void)s; }
|
|
406
|
+
int alpm_decode_signature(const char *b, unsigned char **d, size_t *l) { (void)b; (void)d; (void)l; return -1; }
|
|
407
|
+
int alpm_extract_keyid(alpm_handle_t *h, const char *id, const unsigned char *sig, size_t len, void **keys) { (void)h; (void)id; (void)sig; (void)len; (void)keys; return -1; }
|
|
408
|
+
int alpm_unlock(alpm_handle_t *h) { (void)h; return 0; }
|
|
409
|
+
|
|
410
|
+
/* Package property getters (some are already in libalpm.c - these cover the rest) */
|
|
411
|
+
const char *alpm_pkg_get_filename(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
412
|
+
const char *alpm_pkg_get_md5sum(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
413
|
+
const char *alpm_pkg_get_base(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
414
|
+
const char *alpm_pkg_get_packager(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
415
|
+
const char *alpm_pkg_get_sha256sum(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
416
|
+
void *alpm_pkg_get_backup(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
417
|
+
void *alpm_pkg_get_files(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
418
|
+
void *alpm_pkg_get_groups(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
419
|
+
void *alpm_pkg_get_licenses(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
420
|
+
void *alpm_pkg_get_depends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
421
|
+
void *alpm_pkg_get_optdepends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
422
|
+
void *alpm_pkg_get_conflicts(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
423
|
+
void *alpm_pkg_get_replaces(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
424
|
+
void *alpm_pkg_get_checkdepends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
425
|
+
void *alpm_pkg_get_makedepends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
426
|
+
void *alpm_pkg_get_xdata(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
427
|
+
void *alpm_pkg_get_handle(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
428
|
+
alpm_pkg_t *alpm_pkg_find(void *list, const char *name) { (void)list; (void)name; return NULL; }
|
|
429
|
+
int alpm_pkg_should_ignore(alpm_handle_t *h, alpm_pkg_t *p) { (void)h; (void)p; return 0; }
|
|
430
|
+
int alpm_pkg_download_size(alpm_pkg_t *p) { (void)p; return 0; }
|
|
431
|
+
int alpm_filelist_contains(void *fl, const char *path) { (void)fl; (void)path; return 0; }
|
|
432
|
+
int alpm_pkg_changelog_open(alpm_pkg_t *p) { (void)p; return -1; }
|
|
433
|
+
int alpm_pkg_mtree_open(alpm_pkg_t *p) { (void)p; return -1; }
|
|
434
|
+
int alpm_pkg_mtree_next(alpm_pkg_t *p, void *entry) { (void)p; (void)entry; return 1; }
|
|
435
|
+
int alpm_pkg_mtree_close(alpm_pkg_t *p) { (void)p; return 0; }
|
|
436
|
+
int alpm_pkg_changelog_close(alpm_pkg_t *p) { (void)p; return 0; }
|
|
437
|
+
int alpm_pkg_changelog_read(void *ptr, size_t size, const alpm_pkg_t *p) { (void)ptr; (void)size; (void)p; return 0; }
|
|
438
|
+
int alpm_pkg_check_pgp_signature(alpm_pkg_t *p, void *sig) { (void)p; (void)sig; return -1; }
|
|
439
|
+
int alpm_pkg_compute_requiredby(alpm_pkg_t *p) { (void)p; return 0; }
|
|
440
|
+
int alpm_pkg_compute_optionalfor(alpm_pkg_t *p) { (void)p; return 0; }
|
|
441
|
+
int alpm_pkg_set_reason(alpm_handle_t *h, alpm_pkg_t *p, int r) { (void)h; (void)p; (void)r; return 0; }
|
|
442
|
+
void *alpm_sync_get_new_version(alpm_pkg_t *p, void *dbs) { (void)p; (void)dbs; return NULL; }
|
|
443
|
+
int alpm_compute_md5sum(const char *f, char **s) { (void)f; (void)s; return -1; }
|
|
444
|
+
int alpm_compute_sha256sum(const char *f, unsigned char **s) { (void)f; (void)s; return -1; }
|
|
445
|
+
|
|
446
|
+
/* Transaction operations */
|
|
447
|
+
int alpm_trans_interrupt(alpm_handle_t *h) { (void)h; return 0; }
|
|
448
|
+
int alpm_trans_get_flags(alpm_handle_t *h) { (void)h; return 0; }
|
|
449
|
+
void *alpm_trans_get_add(alpm_handle_t *h) { (void)h; return NULL; }
|
|
450
|
+
void *alpm_trans_get_remove(alpm_handle_t *h) { (void)h; return NULL; }
|
|
451
|
+
int alpm_unregister_all_syncdbs(alpm_handle_t *h) { (void)h; return 0; }
|
|
452
|
+
int alpm_sandbox_setup_child(alpm_handle_t *h, const char *u, const char *p, int r) { (void)h; (void)u; (void)p; (void)r; return 0; }
|
package/package.json
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacman-debian",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.14",
|
|
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",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/",
|
|
9
|
+
"lib/pac4deb/Makefile",
|
|
10
|
+
"lib/pac4deb/README.md",
|
|
11
|
+
"lib/pac4deb/include/alpm.h",
|
|
12
|
+
"lib/pac4deb/include/alpm_list.h",
|
|
13
|
+
"lib/pac4deb/src/alpm_list.c",
|
|
14
|
+
"lib/pac4deb/src/genstubs.sh",
|
|
15
|
+
"lib/pac4deb/src/genstubs2.sh",
|
|
16
|
+
"lib/pac4deb/src/genstubs3.sh",
|
|
17
|
+
"lib/pac4deb/src/libalpm.c",
|
|
18
|
+
"lib/pac4deb/src/stubs_manual.c",
|
|
19
|
+
"docs/",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.md",
|
|
22
|
+
"README_zh-CN.md",
|
|
23
|
+
"package.json"
|
|
24
|
+
],
|
|
7
25
|
"bin": {
|
|
8
26
|
"pacman": "dist/index.js",
|
|
9
27
|
"makepkg": "dist/makepkg/index.js",
|