pacman-debian 7.2.0 → 7.3.1
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 +22 -2
- package/README_zh-CN.md +89 -19
- package/dist/cli/paclink.d.ts.map +1 -0
- package/dist/cli/paclink.js +261 -0
- package/dist/cli/paclink.js.map +1 -0
- package/dist/cli/pacman.d.ts.map +1 -1
- package/dist/cli/pacman.js +64 -38
- package/dist/cli/pacman.js.map +1 -1
- package/dist/core/compress.d.ts.map +1 -1
- package/dist/core/compress.js +29 -0
- package/dist/core/compress.js.map +1 -1
- package/dist/core/deps.d.ts.map +1 -1
- package/dist/core/deps.js +133 -68
- package/dist/core/deps.js.map +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/database.js +3 -1
- package/dist/db/database.js.map +1 -1
- package/dist/db/localdb.d.ts.map +1 -1
- package/dist/db/localdb.js +73 -4
- package/dist/db/localdb.js.map +1 -1
- package/dist/i18n/en.json +6 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +52 -6
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/paclink/en.d.ts.map +1 -0
- package/dist/i18n/paclink/en.js +62 -0
- package/dist/i18n/paclink/en.js.map +1 -0
- package/dist/i18n/paclink/zh-CN.d.ts.map +1 -0
- package/dist/i18n/paclink/zh-CN.js +62 -0
- package/dist/i18n/paclink/zh-CN.js.map +1 -0
- package/dist/i18n/setup/en.d.ts.map +1 -0
- package/dist/i18n/setup/en.js +49 -0
- package/dist/i18n/setup/en.js.map +1 -0
- package/dist/i18n/setup/zh-CN.d.ts.map +1 -0
- package/dist/i18n/setup/zh-CN.js +49 -0
- package/dist/i18n/setup/zh-CN.js.map +1 -0
- package/dist/i18n/zh-CN.json +6 -0
- package/dist/ops/install.d.ts.map +1 -1
- package/dist/ops/install.js +238 -45
- package/dist/ops/install.js.map +1 -1
- package/dist/ops/query.d.ts.map +1 -1
- package/dist/ops/query.js +25 -9
- package/dist/ops/query.js.map +1 -1
- package/dist/ops/remove.d.ts.map +1 -1
- package/dist/ops/remove.js +213 -42
- package/dist/ops/remove.js.map +1 -1
- package/dist/ops/upgrade.d.ts.map +1 -1
- package/dist/ops/upgrade.js +13 -15
- package/dist/ops/upgrade.js.map +1 -1
- package/dist/repo/repository.d.ts.map +1 -1
- package/dist/repo/repository.js +246 -90
- package/dist/repo/repository.js.map +1 -1
- package/dist/scripts/setup.js +119 -116
- package/dist/scripts/setup.js.map +1 -1
- package/package.json +18 -7
- package/README.zh.md +0 -388
- package/dist/ar.d.ts +0 -8
- package/dist/cli/pacman.d.ts +0 -2
- package/dist/compress.d.ts +0 -2
- package/dist/config.d.ts +0 -3
- package/dist/control.d.ts +0 -2
- package/dist/core/ar.d.ts +0 -7
- package/dist/core/compress.d.ts +0 -2
- package/dist/core/control.d.ts +0 -2
- package/dist/core/deb.d.ts +0 -4
- package/dist/core/deps.d.ts +0 -25
- package/dist/core/options.d.ts +0 -19
- package/dist/core/pkgfile.d.ts +0 -35
- package/dist/core/tar.d.ts +0 -13
- package/dist/core/types.d.ts +0 -83
- package/dist/database.d.ts +0 -20
- package/dist/db/database.d.ts +0 -17
- package/dist/db/dpkg-compat.d.ts +0 -19
- package/dist/db/localdb.d.ts +0 -9
- package/dist/db/sqlite.d.ts +0 -20
- package/dist/deb.d.ts +0 -5
- package/dist/dpkg-compat.d.ts +0 -18
- package/dist/i18n/index.d.ts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/install.d.ts +0 -2
- package/dist/makepkg/build.d.ts +0 -19
- package/dist/makepkg/index.d.ts +0 -3
- package/dist/makepkg/pkgbuild.d.ts +0 -36
- package/dist/ops/install.d.ts +0 -5
- package/dist/ops/query.d.ts +0 -9
- package/dist/ops/remove.d.ts +0 -3
- package/dist/ops/upgrade.d.ts +0 -4
- package/dist/pacman.d.ts +0 -2
- package/dist/query.d.ts +0 -5
- package/dist/remove.d.ts +0 -2
- package/dist/repo/config.d.ts +0 -3
- package/dist/repo/repository.d.ts +0 -10
- package/dist/repository.d.ts +0 -10
- package/dist/scripts/pacman-conf.d.ts +0 -3
- package/dist/scripts/setup.d.ts +0 -3
- package/dist/tar.d.ts +0 -17
- package/dist/types.d.ts +0 -80
- package/dist/ui/colors.d.ts +0 -13
- package/dist/ui/format.d.ts +0 -3
- package/dist/ui/progress.d.ts +0 -8
- package/dist/ui/prompt.d.ts +0 -4
- package/lib/pac4deb/Makefile +0 -26
- package/lib/pac4deb/README.md +0 -47
- package/lib/pac4deb/include/alpm.h +0 -166
- package/lib/pac4deb/include/alpm_list.h +0 -42
- package/lib/pac4deb/libalpm.so +0 -0
- package/lib/pac4deb/src/alpm_list.c +0 -102
- package/lib/pac4deb/src/genstubs.sh +0 -51
- package/lib/pac4deb/src/genstubs2.sh +0 -72
- package/lib/pac4deb/src/genstubs3.sh +0 -43
- package/lib/pac4deb/src/libalpm.c +0 -537
- package/lib/pac4deb/src/stubs_manual.c +0 -198
- package/lib/pac4deb/stubs.c +0 -6
- package/lib/pac4deb/update_header.sh +0 -15
- package/src/cli/pacman.ts +0 -308
- package/src/core/ar.ts +0 -54
- package/src/core/compress.ts +0 -27
- package/src/core/control.ts +0 -22
- package/src/core/deb.ts +0 -47
- package/src/core/deps.ts +0 -260
- package/src/core/options.ts +0 -20
- package/src/core/pkgfile.ts +0 -146
- package/src/core/tar.ts +0 -101
- package/src/core/types.ts +0 -89
- package/src/db/database.ts +0 -102
- package/src/db/dpkg-compat.ts +0 -129
- package/src/db/localdb.ts +0 -181
- package/src/i18n/en.json +0 -114
- package/src/i18n/index.ts +0 -32
- package/src/i18n/zh-CN.json +0 -114
- package/src/index.ts +0 -7
- package/src/makepkg/build.ts +0 -351
- package/src/makepkg/index.ts +0 -87
- package/src/makepkg/pkgbuild.ts +0 -146
- package/src/ops/install.ts +0 -260
- package/src/ops/query.ts +0 -117
- package/src/ops/remove.ts +0 -77
- package/src/ops/upgrade.ts +0 -87
- package/src/repo/config.ts +0 -96
- package/src/repo/repository.ts +0 -520
- package/src/scripts/pacman-conf.ts +0 -68
- package/src/scripts/setup.ts +0 -261
- package/src/ui/colors.ts +0 -40
- package/src/ui/format.ts +0 -9
- package/src/ui/progress.ts +0 -26
- package/src/ui/prompt.ts +0 -21
- package/tsconfig.json +0 -19
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
/* Hand-written stubs for libalpm functions not in libalpm.c */
|
|
2
|
-
#include "../include/alpm.h"
|
|
3
|
-
#include "../include/alpm_list.h"
|
|
4
|
-
#include <stdlib.h>
|
|
5
|
-
#include <string.h>
|
|
6
|
-
|
|
7
|
-
/* Option setters/getters not implemented */
|
|
8
|
-
int alpm_option_set_usesyslog(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
9
|
-
int alpm_option_set_checkspace(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
10
|
-
int alpm_option_set_default_siglevel(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
11
|
-
int alpm_option_set_parallel_downloads(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
12
|
-
int alpm_option_set_hookdirs(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
13
|
-
int alpm_option_set_noupgrades(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
14
|
-
int alpm_option_set_noextracts(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
15
|
-
int alpm_option_set_ignorepkgs(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
16
|
-
int alpm_option_set_ignoregroups(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
17
|
-
int alpm_option_set_overwrite_files(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
18
|
-
int alpm_option_set_sandboxuser(alpm_handle_t *h, const char *v) { (void)h; (void)v; return 0; }
|
|
19
|
-
int alpm_option_set_architectures(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
20
|
-
int alpm_option_set_assumeinstalled(alpm_handle_t *h, void *v) { (void)h; (void)v; return 0; }
|
|
21
|
-
int alpm_option_set_dlopen(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
22
|
-
int alpm_option_set_lockfile(alpm_handle_t *h, const char *v) { (void)h; (void)v; return 0; }
|
|
23
|
-
int alpm_option_set_disable_sandbox_filesystem(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
24
|
-
int alpm_option_set_disable_sandbox_syscalls(alpm_handle_t *h, int v) { (void)h; (void)v; return 0; }
|
|
25
|
-
int alpm_option_set_dlcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
26
|
-
int alpm_option_set_eventcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
27
|
-
int alpm_option_set_fetchcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
28
|
-
int alpm_option_set_logcb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
29
|
-
int alpm_option_set_questioncb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
30
|
-
int alpm_option_set_progresscb(alpm_handle_t *h, void *cb) { (void)h; (void)cb; }
|
|
31
|
-
|
|
32
|
-
/* Option getters */
|
|
33
|
-
int alpm_option_get_usesyslog(alpm_handle_t *h) { (void)h; return 0; }
|
|
34
|
-
int alpm_option_get_checkspace(alpm_handle_t *h) { (void)h; return 0; }
|
|
35
|
-
int alpm_option_get_default_siglevel(alpm_handle_t *h) { (void)h; return 0; }
|
|
36
|
-
int alpm_option_get_parallel_downloads(alpm_handle_t *h) { (void)h; return 0; }
|
|
37
|
-
int alpm_option_get_dlopen(alpm_handle_t *h) { (void)h; return 0; }
|
|
38
|
-
int alpm_option_get_dlopen_ctx(alpm_handle_t *h) { (void)h; return 0; }
|
|
39
|
-
int alpm_option_get_disable_sandbox_filesystem(alpm_handle_t *h) { (void)h; return 0; }
|
|
40
|
-
int alpm_option_get_disable_sandbox_syscalls(alpm_handle_t *h) { (void)h; return 0; }
|
|
41
|
-
void *alpm_option_get_dlcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
42
|
-
void *alpm_option_get_eventcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
43
|
-
void *alpm_option_get_fetchcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
44
|
-
void *alpm_option_get_logcb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
45
|
-
void *alpm_option_get_questioncb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
46
|
-
void *alpm_option_get_progresscb(alpm_handle_t *h) { (void)h; return NULL; }
|
|
47
|
-
void *alpm_option_get_dlcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
48
|
-
void *alpm_option_get_eventcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
49
|
-
void *alpm_option_get_fetchcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
50
|
-
void *alpm_option_get_logcb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
51
|
-
void *alpm_option_get_questioncb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
52
|
-
void *alpm_option_get_progresscb_ctx(alpm_handle_t *h) { (void)h; return NULL; }
|
|
53
|
-
const char *alpm_option_get_root(alpm_handle_t *h) { (void)h; return NULL; }
|
|
54
|
-
void *alpm_option_get_cachedirs(alpm_handle_t *h) { (void)h; return NULL; }
|
|
55
|
-
void *alpm_option_get_hookdirs(alpm_handle_t *h) { (void)h; return NULL; }
|
|
56
|
-
void *alpm_option_get_noupgrades(alpm_handle_t *h) { (void)h; return NULL; }
|
|
57
|
-
void *alpm_option_get_noextracts(alpm_handle_t *h) { (void)h; return NULL; }
|
|
58
|
-
void *alpm_option_get_ignorepkgs(alpm_handle_t *h) { (void)h; return NULL; }
|
|
59
|
-
void *alpm_option_get_ignoregroups(alpm_handle_t *h) { (void)h; return NULL; }
|
|
60
|
-
void *alpm_option_get_overwrite_files(alpm_handle_t *h) { (void)h; return NULL; }
|
|
61
|
-
void *alpm_option_get_sandboxuser(alpm_handle_t *h) { (void)h; return NULL; }
|
|
62
|
-
void *alpm_option_get_architectures(alpm_handle_t *h) { (void)h; return NULL; }
|
|
63
|
-
void *alpm_option_get_assumeinstalled(alpm_handle_t *h) { (void)h; return NULL; }
|
|
64
|
-
|
|
65
|
-
/* Option add/remove helpers */
|
|
66
|
-
int alpm_option_add_hookdir(alpm_handle_t *h, const char *d) { (void)h; (void)d; return 0; }
|
|
67
|
-
int alpm_option_add_architecture(alpm_handle_t *h, const char *a) { (void)h; (void)a; return 0; }
|
|
68
|
-
int alpm_option_add_assumeinstalled(alpm_handle_t *h, void *d) { (void)h; (void)d; return 0; }
|
|
69
|
-
int alpm_option_add_ignorepkg(alpm_handle_t *h, const char *p) { (void)h; (void)p; return 0; }
|
|
70
|
-
int alpm_option_add_ignoregroup(alpm_handle_t *h, const char *g) { (void)h; (void)g; return 0; }
|
|
71
|
-
int alpm_option_add_noupgrade(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
72
|
-
int alpm_option_add_noextract(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
73
|
-
int alpm_option_add_overwrite_file(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
74
|
-
int alpm_option_remove_cachedir(alpm_handle_t *h, const char *d) { (void)h; (void)d; return 0; }
|
|
75
|
-
int alpm_option_remove_hookdir(alpm_handle_t *h, const char *d) { (void)h; (void)d; return 0; }
|
|
76
|
-
int alpm_option_remove_architecture(alpm_handle_t *h, const char *a) { (void)h; (void)a; return 0; }
|
|
77
|
-
int alpm_option_remove_assumeinstalled(alpm_handle_t *h, void *d) { (void)h; (void)d; return 0; }
|
|
78
|
-
int alpm_option_remove_ignorepkg(alpm_handle_t *h, const char *p) { (void)h; (void)p; return 0; }
|
|
79
|
-
int alpm_option_remove_ignoregroup(alpm_handle_t *h, const char *g) { (void)h; (void)g; return 0; }
|
|
80
|
-
int alpm_option_remove_noupgrade(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
81
|
-
int alpm_option_remove_noextract(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
82
|
-
int alpm_option_remove_overwrite_file(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
83
|
-
|
|
84
|
-
/* Match helpers */
|
|
85
|
-
int alpm_option_match_noupgrade(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
86
|
-
int alpm_option_match_noextract(alpm_handle_t *h, const char *f) { (void)h; (void)f; return 0; }
|
|
87
|
-
|
|
88
|
-
/* Database operations */
|
|
89
|
-
int alpm_db_update(alpm_handle_t *h, void *dbs, int force) { (void)h; (void)dbs; (void)force; return 0; }
|
|
90
|
-
void *alpm_db_search(alpm_db_t *db, void *needles) { (void)db; (void)needles; return NULL; }
|
|
91
|
-
int alpm_db_get_valid(alpm_db_t *db) { (void)db; return 1; }
|
|
92
|
-
const char *alpm_db_get_name(alpm_db_t *db) { (void)db; return "local"; }
|
|
93
|
-
void *alpm_db_get_groupcache(alpm_db_t *db) { (void)db; return NULL; }
|
|
94
|
-
void *alpm_db_get_group(alpm_db_t *db, const char *n) { (void)db; (void)n; return NULL; }
|
|
95
|
-
void *alpm_db_get_servers(alpm_db_t *db) { (void)db; return NULL; }
|
|
96
|
-
void *alpm_db_get_cache_servers(alpm_db_t *db) { (void)db; return NULL; }
|
|
97
|
-
int alpm_db_set_servers(alpm_db_t *db, void *s) { (void)db; (void)s; return 0; }
|
|
98
|
-
int alpm_db_set_cache_servers(alpm_db_t *db, void *s) { (void)db; (void)s; return 0; }
|
|
99
|
-
int alpm_db_set_usage(alpm_db_t *db, int u) { (void)db; (void)u; return 0; }
|
|
100
|
-
int alpm_db_get_usage(alpm_db_t *db) { (void)db; return 0; }
|
|
101
|
-
int alpm_db_get_siglevel(alpm_db_t *db) { (void)db; return 0; }
|
|
102
|
-
int alpm_db_check_pgp_signature(alpm_db_t *db) { (void)db; return 0; }
|
|
103
|
-
void *alpm_db_get_handle(alpm_db_t *db) { (void)db; return NULL; }
|
|
104
|
-
void *alpm_db_add_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
105
|
-
void *alpm_db_add_cache_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
106
|
-
void *alpm_db_remove_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
107
|
-
void *alpm_db_remove_cache_server(alpm_db_t *db, const char *s) { (void)db; (void)s; return NULL; }
|
|
108
|
-
|
|
109
|
-
/* Package operations */
|
|
110
|
-
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; }
|
|
111
|
-
int alpm_pkg_checkmd5sum(alpm_pkg_t *p) { (void)p; return 0; }
|
|
112
|
-
int alpm_fetch_pkgurl(alpm_handle_t *h, void *urls) { (void)h; (void)urls; return -1; }
|
|
113
|
-
void *alpm_find_group_pkgs(void *dbs, const char *n) { (void)dbs; (void)n; return NULL; }
|
|
114
|
-
void *alpm_checkdeps(alpm_handle_t *h, void *pkglist) { (void)h; (void)pkglist; return NULL; }
|
|
115
|
-
alpm_pkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *dep) {
|
|
116
|
-
if (!pkgs || !dep) return NULL;
|
|
117
|
-
char depname[256];
|
|
118
|
-
int i = 0;
|
|
119
|
-
while (dep[i] && dep[i] != '<' && dep[i] != '>' && dep[i] != '=' && i < 255) {
|
|
120
|
-
depname[i] = dep[i]; i++;
|
|
121
|
-
}
|
|
122
|
-
depname[i] = 0;
|
|
123
|
-
alpm_list_t *it;
|
|
124
|
-
for (it = pkgs; it; it = it->next) {
|
|
125
|
-
alpm_pkg_t *p = (alpm_pkg_t *)it->data;
|
|
126
|
-
if (p && strcmp(alpm_pkg_get_name(p), depname) == 0) return p;
|
|
127
|
-
}
|
|
128
|
-
return NULL;
|
|
129
|
-
}
|
|
130
|
-
alpm_pkg_t *alpm_find_dbs_satisfier(alpm_handle_t *h, alpm_list_t *dbs, const char *dep) {
|
|
131
|
-
(void)h;
|
|
132
|
-
if (!dbs || !dep) return NULL;
|
|
133
|
-
alpm_list_t *it;
|
|
134
|
-
for (it = dbs; it; it = it->next) {
|
|
135
|
-
alpm_db_t *db = (alpm_db_t *)it->data;
|
|
136
|
-
if (!db) continue;
|
|
137
|
-
alpm_list_t *pkgs = alpm_db_get_pkgcache(db);
|
|
138
|
-
alpm_pkg_t *found = alpm_find_satisfier(pkgs, dep);
|
|
139
|
-
if (found) return found;
|
|
140
|
-
}
|
|
141
|
-
return NULL;
|
|
142
|
-
}
|
|
143
|
-
int alpm_checkconflicts(alpm_handle_t *h, void *pkglist) { (void)h; (void)pkglist; return 0; }
|
|
144
|
-
void *alpm_dep_from_string(const char *s) { (void)s; return NULL; }
|
|
145
|
-
const char *alpm_dep_compute_string(void *d) { (void)d; return NULL; }
|
|
146
|
-
void alpm_dep_free(void *d) { (void)d; }
|
|
147
|
-
void alpm_conflict_free(void *c) { (void)c; }
|
|
148
|
-
void alpm_fileconflict_free(void *c) { (void)c; }
|
|
149
|
-
void alpm_depmissing_free(void *m) { (void)m; }
|
|
150
|
-
void alpm_siglist_cleanup(void *s) { (void)s; }
|
|
151
|
-
int alpm_decode_signature(const char *b, unsigned char **d, size_t *l) { (void)b; (void)d; (void)l; return -1; }
|
|
152
|
-
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; }
|
|
153
|
-
int alpm_unlock(alpm_handle_t *h) { (void)h; return 0; }
|
|
154
|
-
|
|
155
|
-
/* Package property getters (some are already in libalpm.c - these cover the rest) */
|
|
156
|
-
const char *alpm_pkg_get_filename(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
157
|
-
const char *alpm_pkg_get_base(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
158
|
-
const char *alpm_pkg_get_packager(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
159
|
-
const char *alpm_pkg_get_sha256sum(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
160
|
-
void *alpm_pkg_get_backup(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
161
|
-
void *alpm_pkg_get_files(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
162
|
-
void *alpm_pkg_get_groups(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
163
|
-
void *alpm_pkg_get_licenses(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
164
|
-
void *alpm_pkg_get_depends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
165
|
-
void *alpm_pkg_get_optdepends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
166
|
-
void *alpm_pkg_get_conflicts(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
167
|
-
void *alpm_pkg_get_provides(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
168
|
-
void *alpm_pkg_get_replaces(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
169
|
-
void *alpm_pkg_get_checkdepends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
170
|
-
void *alpm_pkg_get_makedepends(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
171
|
-
void *alpm_pkg_get_xdata(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
172
|
-
void *alpm_pkg_get_db(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
173
|
-
void *alpm_pkg_get_handle(alpm_pkg_t *p) { (void)p; return NULL; }
|
|
174
|
-
alpm_pkg_t *alpm_pkg_find(void *list, const char *name) { (void)list; (void)name; return NULL; }
|
|
175
|
-
int alpm_pkg_should_ignore(alpm_handle_t *h, alpm_pkg_t *p) { (void)h; (void)p; return 0; }
|
|
176
|
-
int alpm_pkg_download_size(alpm_pkg_t *p) { (void)p; return 0; }
|
|
177
|
-
int alpm_filelist_contains(void *fl, const char *path) { (void)fl; (void)path; return 0; }
|
|
178
|
-
int alpm_pkg_changelog_open(alpm_pkg_t *p) { (void)p; return -1; }
|
|
179
|
-
int alpm_pkg_mtree_open(alpm_pkg_t *p) { (void)p; return -1; }
|
|
180
|
-
int alpm_pkg_mtree_next(alpm_pkg_t *p, void *entry) { (void)p; (void)entry; return 1; }
|
|
181
|
-
int alpm_pkg_mtree_close(alpm_pkg_t *p) { (void)p; return 0; }
|
|
182
|
-
int alpm_pkg_changelog_close(alpm_pkg_t *p) { (void)p; return 0; }
|
|
183
|
-
int alpm_pkg_changelog_read(void *ptr, size_t size, const alpm_pkg_t *p) { (void)ptr; (void)size; (void)p; return 0; }
|
|
184
|
-
int alpm_pkg_check_pgp_signature(alpm_pkg_t *p, void *sig) { (void)p; (void)sig; return -1; }
|
|
185
|
-
int alpm_pkg_compute_requiredby(alpm_pkg_t *p) { (void)p; return 0; }
|
|
186
|
-
int alpm_pkg_compute_optionalfor(alpm_pkg_t *p) { (void)p; return 0; }
|
|
187
|
-
int alpm_pkg_set_reason(alpm_handle_t *h, alpm_pkg_t *p, int r) { (void)h; (void)p; (void)r; return 0; }
|
|
188
|
-
void *alpm_sync_get_new_version(alpm_pkg_t *p, void *dbs) { (void)p; (void)dbs; return NULL; }
|
|
189
|
-
int alpm_compute_md5sum(const char *f, char **s) { (void)f; (void)s; return -1; }
|
|
190
|
-
int alpm_compute_sha256sum(const char *f, unsigned char **s) { (void)f; (void)s; return -1; }
|
|
191
|
-
|
|
192
|
-
/* Transaction operations */
|
|
193
|
-
int alpm_trans_interrupt(alpm_handle_t *h) { (void)h; return 0; }
|
|
194
|
-
int alpm_trans_get_flags(alpm_handle_t *h) { (void)h; return 0; }
|
|
195
|
-
void *alpm_trans_get_add(alpm_handle_t *h) { (void)h; return NULL; }
|
|
196
|
-
void *alpm_trans_get_remove(alpm_handle_t *h) { (void)h; return NULL; }
|
|
197
|
-
int alpm_unregister_all_syncdbs(alpm_handle_t *h) { (void)h; return 0; }
|
|
198
|
-
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/lib/pac4deb/stubs.c
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Extract all function declarations from real alpm.h and add to our header
|
|
3
|
-
|
|
4
|
-
REAL_HEADER="/home/orangepi/.local/share/opencode/tool-output/tool_ed86eb19c001Tbc6B4KaUd0olf"
|
|
5
|
-
OUR_HEADER="include/alpm.h"
|
|
6
|
-
|
|
7
|
-
echo "Extracting function declarations from real alpm.h..."
|
|
8
|
-
grep -oP '^\s*\w[\w\s\*]+\b(alpm_\w+)\s*\([^)]*\)\s*;' "$REAL_HEADER" > /tmp/full_funcs.txt
|
|
9
|
-
echo "Found $(wc -l < /tmp/full_funcs.txt) functions"
|
|
10
|
-
|
|
11
|
-
# Add the missing functions to our header (before the #endif)
|
|
12
|
-
echo "" >> "$OUR_HEADER"
|
|
13
|
-
echo "/* Extended function declarations from real libalpm */" >> "$OUR_HEADER"
|
|
14
|
-
cat /tmp/full_funcs.txt >> "$OUR_HEADER"
|
|
15
|
-
echo "Updated $OUR_HEADER"
|
package/src/cli/pacman.ts
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { installPkg, installPackages } from '../ops/install';
|
|
2
|
-
import { removeByName } from '../ops/remove';
|
|
3
|
-
import { listInstalled, showInfo, queryFile, listFiles, listExplicit, listDeps, listOrphans, checkIntegrity } from '../ops/query';
|
|
4
|
-
import { syncAndUpgrade, upgradeOnly } from '../ops/upgrade';
|
|
5
|
-
import { syncRepos, searchRepo, findInRepo, downloadPkg, getRepoCache } from '../repo/repository';
|
|
6
|
-
import { initDb, loadDatabase, saveDatabase, getPackage } from '../db/database';
|
|
7
|
-
import { readDpkgStatus } from '../db/dpkg-compat';
|
|
8
|
-
import { setNoConfirm } from '../ui/prompt';
|
|
9
|
-
import { t as t_ } from '../i18n';
|
|
10
|
-
import * as fs from 'node:fs';
|
|
11
|
-
import pkg from '../../package.json';
|
|
12
|
-
|
|
13
|
-
function needRoot() {
|
|
14
|
-
if (!process.getuid || process.getuid() === 0) return;
|
|
15
|
-
console.error(t_('error_need_root'));
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
import type { InstallOptions } from '../core/options';
|
|
19
|
-
|
|
20
|
-
const CACHE = '/var/cache/pacman-debian/pkg';
|
|
21
|
-
const PCACHE = '/var/cache/pacman-debian/packages';
|
|
22
|
-
const VERSION = pkg.version;
|
|
23
|
-
|
|
24
|
-
function help(): void {
|
|
25
|
-
console.log(t_('help_text'));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function cleanCache(all: boolean): void {
|
|
29
|
-
if (fs.existsSync(CACHE)) { fs.rmSync(CACHE, { recursive: true }); fs.mkdirSync(CACHE, { recursive: true }); }
|
|
30
|
-
if (all && fs.existsSync(PCACHE)) { fs.rmSync(PCACHE, { recursive: true }); }
|
|
31
|
-
console.log(all ? t_('cache_cleaned_all') : t_('cache_cleaned_pkg'));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function listRepoContents(repoName?: string): void {
|
|
35
|
-
const all = getRepoCache();
|
|
36
|
-
for (const p of all) {
|
|
37
|
-
if (!repoName || p.repo === repoName) console.log(`${p.repo}/${p.package} ${p.version}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function checkDeps(packages: string[]): void {
|
|
42
|
-
const dpkg = readDpkgStatus();
|
|
43
|
-
for (const name of packages) {
|
|
44
|
-
const rp = findInRepo(name);
|
|
45
|
-
if (!rp) { console.log(`${name} not found`); continue; }
|
|
46
|
-
console.log(`${name} ${dpkg.has(name) ? 'installed' : 'missing'}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function markAsDep(packages: string[]): void {
|
|
51
|
-
initDb();
|
|
52
|
-
const db = loadDatabase();
|
|
53
|
-
for (const name of packages) {
|
|
54
|
-
const p = getPackage(db, name);
|
|
55
|
-
if (!p) { console.error(`error: '${name}' is not installed`); continue; }
|
|
56
|
-
p.reason = 'dependency';
|
|
57
|
-
saveDatabase(db);
|
|
58
|
-
console.log(` ${name} marked as dependency`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function markAsExplicit(packages: string[]): void {
|
|
63
|
-
initDb();
|
|
64
|
-
const db = loadDatabase();
|
|
65
|
-
for (const name of packages) {
|
|
66
|
-
const p = getPackage(db, name);
|
|
67
|
-
if (!p) { console.error(`error: '${name}' is not installed`); continue; }
|
|
68
|
-
p.reason = 'explicit';
|
|
69
|
-
saveDatabase(db);
|
|
70
|
-
console.log(` ${name} marked as explicitly installed`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function extractGlobalFlags(args: string[]): { operands: string[]; noconfirm: boolean; needed: boolean; noscriptlet: boolean; print: boolean } {
|
|
75
|
-
let noconfirm = false, needed = false, noscriptlet = false, print = false;
|
|
76
|
-
const operands: string[] = [];
|
|
77
|
-
for (const a of args) {
|
|
78
|
-
switch (a) {
|
|
79
|
-
case '--noconfirm': noconfirm = true; break;
|
|
80
|
-
case '--confirm': noconfirm = false; break;
|
|
81
|
-
case '--needed': needed = true; break;
|
|
82
|
-
case '--noscriptlet': noscriptlet = true; break;
|
|
83
|
-
case '--print': print = true; break;
|
|
84
|
-
case '--noprogressbar': break;
|
|
85
|
-
default: operands.push(a);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return { operands, noconfirm, needed, noscriptlet, print };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export async function parseArgs(args: string[]): Promise<void> {
|
|
92
|
-
if (args.length === 0) { console.error(t_('error_no_operation')); help(); return; }
|
|
93
|
-
|
|
94
|
-
const { operands, noconfirm, needed, noscriptlet, print } = extractGlobalFlags(args);
|
|
95
|
-
setNoConfirm(noconfirm);
|
|
96
|
-
|
|
97
|
-
if (operands.length === 0) { console.error(t_('error_no_operation')); help(); return; }
|
|
98
|
-
|
|
99
|
-
const raw = operands[0];
|
|
100
|
-
const rest = operands.slice(1);
|
|
101
|
-
const opts: InstallOptions = { needed, noscriptlet, print };
|
|
102
|
-
|
|
103
|
-
// Long-form operations
|
|
104
|
-
if (raw === '--help' || raw === '-h') { help(); return; }
|
|
105
|
-
if (raw === '--version' || raw === '-V') { console.log(t_('version_string', VERSION)); return; }
|
|
106
|
-
if (raw === '--sync') { needRoot();
|
|
107
|
-
const asdeps = rest.includes('--asdeps');
|
|
108
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
109
|
-
if (targets.length === 0) { console.error(t_('error_no_targets')); return; }
|
|
110
|
-
await installPackages(targets, { ...opts, asdeps });
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (raw === '--upgrade') { needRoot();
|
|
114
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
115
|
-
if (targets.length === 0) { console.error(t_('error_no_targets')); return; }
|
|
116
|
-
for (const t of targets) await installPkg(t, opts);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (raw === '--remove') { needRoot();
|
|
120
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
121
|
-
if (targets.length === 0) { console.error(t_('error_no_targets')); return; }
|
|
122
|
-
for (const n of targets) await removeByName(n, { recursive: false });
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (raw === '--query') {
|
|
126
|
-
if (rest.length === 0) listInstalled();
|
|
127
|
-
else showInfo(rest[0], false);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (raw === '--database') { needRoot();
|
|
131
|
-
const asdeps = rest.includes('--asdeps');
|
|
132
|
-
const asexplicit = rest.includes('--asexplicit');
|
|
133
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
134
|
-
if (asdeps) markAsDep(targets);
|
|
135
|
-
if (asexplicit) markAsExplicit(targets);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (raw === '--files') {
|
|
139
|
-
if (rest[0] === '-y' || rest[0] === 'y') { console.log(t_('file_db_not_maintained')); return; }
|
|
140
|
-
if (rest.length > 0) queryFile(rest[0]);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (raw === '--deptest') {
|
|
144
|
-
checkDeps(rest);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Short-form
|
|
149
|
-
if (!raw.startsWith('-')) { console.error(t_('error_unknown_operation', raw)); process.exit(1); }
|
|
150
|
-
const op = raw[1];
|
|
151
|
-
const flags = raw.slice(2);
|
|
152
|
-
|
|
153
|
-
if (op === 'h') { help(); return; }
|
|
154
|
-
if (op === 'V') { console.log(t_('version_string', VERSION)); return; }
|
|
155
|
-
|
|
156
|
-
if (op === 'S' || op === 'U') {
|
|
157
|
-
const doRefresh = flags.includes('y');
|
|
158
|
-
const forceRefresh = flags.includes('yy');
|
|
159
|
-
const doUpgrade = flags.includes('u');
|
|
160
|
-
const doSearch = flags.includes('s');
|
|
161
|
-
const doInfo = flags.includes('i');
|
|
162
|
-
const doClean = flags.split('').filter(c => c === 'c').length === 2;
|
|
163
|
-
const doSingleClean = flags.includes('c') && !doClean;
|
|
164
|
-
const doDownload = flags.includes('w');
|
|
165
|
-
const doPrint = flags.includes('p');
|
|
166
|
-
const doList = flags.includes('l');
|
|
167
|
-
|
|
168
|
-
if (doSearch) {
|
|
169
|
-
if (rest.length === 0) { console.error(t_('error_no_search_term')); return; }
|
|
170
|
-
const results = searchRepo(rest[0]);
|
|
171
|
-
if (results.length === 0) { console.log(t_('no_pkg_found_matching', rest[0])); return; }
|
|
172
|
-
for (let i = 0; i < Math.min(results.length, 50); i++) {
|
|
173
|
-
const p = results[i];
|
|
174
|
-
console.log(t_('search_result_line', p.repo, p.package, p.version));
|
|
175
|
-
if (p.description) console.log(t_('search_result_desc', p.description));
|
|
176
|
-
}
|
|
177
|
-
if (results.length > 50) console.log(t_('search_more_results', String(results.length - 50)));
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (doInfo) {
|
|
181
|
-
if (rest.length === 0) { console.error(t_('error_no_pkg_name')); return; }
|
|
182
|
-
showInfo(rest[0], true);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (doList) { listRepoContents(rest[0]); return; }
|
|
186
|
-
if (doSingleClean) { needRoot(); cleanCache(false); return; }
|
|
187
|
-
if (doClean) { needRoot(); cleanCache(true); return; }
|
|
188
|
-
if (doDownload) {
|
|
189
|
-
for (const t of rest) {
|
|
190
|
-
const p = findInRepo(t);
|
|
191
|
-
if (p) console.log(t_('pkg_downloaded', t));
|
|
192
|
-
else console.log(t_('error_not_found', t));
|
|
193
|
-
}
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (doPrint) {
|
|
197
|
-
for (const t of rest) console.log(t_('would_install', t));
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
needRoot();
|
|
201
|
-
if (doRefresh && doUpgrade) { await syncAndUpgrade(opts); return; }
|
|
202
|
-
if (doRefresh) {
|
|
203
|
-
process.stdout.write(t_('syncing_databases') + '\n');
|
|
204
|
-
await syncRepos(forceRefresh);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
if (doUpgrade) { await upgradeOnly(opts); return; }
|
|
208
|
-
|
|
209
|
-
// -U: install local file
|
|
210
|
-
if (op === 'U') {
|
|
211
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
212
|
-
if (targets.length === 0) { console.error(t_('error_no_targets')); return; }
|
|
213
|
-
for (const t of targets) await installPkg(t, opts);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// -S: install from repos
|
|
218
|
-
const asdeps = rest.includes('--asdeps');
|
|
219
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
220
|
-
if (targets.length === 0) { console.error(t_('error_no_targets')); return; }
|
|
221
|
-
await installPackages(targets, { ...opts, asdeps });
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (op === 'R') {
|
|
226
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
227
|
-
if (targets.length === 0) { console.error(t_('error_no_targets')); return; }
|
|
228
|
-
const flags = raw.slice(2);
|
|
229
|
-
const recursive = flags.includes('s');
|
|
230
|
-
const cascade = flags.includes('c');
|
|
231
|
-
const nodeps = flags.includes('d');
|
|
232
|
-
const nosave = flags.includes('n');
|
|
233
|
-
const doPrint = flags.includes('p');
|
|
234
|
-
if (!doPrint) needRoot();
|
|
235
|
-
for (const n of targets) await removeByName(n, { recursive, cascade, nodeps, nosave, print: doPrint });
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (op === 'Q') {
|
|
240
|
-
if (rest.length === 0) { listInstalled(); return; }
|
|
241
|
-
const qflags = flags || rest[0];
|
|
242
|
-
if (qflags.startsWith('-')) {
|
|
243
|
-
const q = qflags.slice(1);
|
|
244
|
-
if (q === 'i') { showInfo(rest[1], false); return; }
|
|
245
|
-
if (q === 'o') { if (rest[1]) queryFile(rest[1]); else console.error(t_('error_no_file')); return; }
|
|
246
|
-
if (q === 'l') { if (rest[1]) listFiles(rest[1]); else console.error(t_('error_no_pkg_name')); return; }
|
|
247
|
-
if (q === 's') { if (rest[1]) { listInstalled(rest[1]); return; } listInstalled(); return; }
|
|
248
|
-
if (q === 'e') { listExplicit(); return; }
|
|
249
|
-
if (q === 'd') { listDeps(); return; }
|
|
250
|
-
if (q === 'dt') { listOrphans(); return; }
|
|
251
|
-
if (q === 'k') { checkIntegrity(); return; }
|
|
252
|
-
if (q === 'q') { listInstalled(); return; }
|
|
253
|
-
if (q.length > 1 && q[0] === 'k') { checkIntegrity(q.slice(1)); return; }
|
|
254
|
-
console.error(t_('error_unknown_option', q));
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
showInfo(rest[0], false);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (op === 'Q') {
|
|
262
|
-
if (flags === '') { listInstalled(); return; }
|
|
263
|
-
if (flags.includes('i')) {
|
|
264
|
-
if (rest.length === 0) { console.error(t_('error_no_pkg_name')); return; }
|
|
265
|
-
showInfo(rest[0], false);
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
if (flags.includes('o')) {
|
|
269
|
-
if (rest.length === 0) { console.error(t_('error_no_file')); return; }
|
|
270
|
-
queryFile(rest[0]);
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (flags.includes('l')) {
|
|
274
|
-
if (rest.length === 0) { console.error(t_('error_no_pkg_name')); return; }
|
|
275
|
-
listFiles(rest[0]);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (flags.includes('s')) { listInstalled(rest[0]); return; }
|
|
279
|
-
|
|
280
|
-
if ((flags.includes('d') && flags.includes('t')) || flags.includes('td') || flags.includes('dt')) { listOrphans(); return; }
|
|
281
|
-
if (flags.includes('e') && !flags.includes('d') && !flags.includes('t')) { listExplicit(); return; }
|
|
282
|
-
if (flags.includes('d') && !flags.includes('e') && !flags.includes('t')) { listDeps(); return; }
|
|
283
|
-
if (flags.includes('k')) { checkIntegrity(rest[0]); return; }
|
|
284
|
-
|
|
285
|
-
console.error(`error: unknown option '-Q${flags}'`);
|
|
286
|
-
process.exit(1);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (op === 'D') {
|
|
290
|
-
const asdeps = rest.includes('--asdeps');
|
|
291
|
-
const asexplicit = rest.includes('--asexplicit');
|
|
292
|
-
const targets = rest.filter(a => !a.startsWith('-'));
|
|
293
|
-
if (asdeps) markAsDep(targets);
|
|
294
|
-
if (asexplicit) markAsExplicit(targets);
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (op === 'T') { checkDeps(rest); return; }
|
|
299
|
-
|
|
300
|
-
if (op === 'F') {
|
|
301
|
-
if (flags.includes('y')) { console.log(t_('file_db_not_maintained')); return; }
|
|
302
|
-
if (rest.length > 0) queryFile(rest[0]);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
console.error(t_('error_unknown_operation_short', op));
|
|
307
|
-
process.exit(1);
|
|
308
|
-
}
|
package/src/core/ar.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
|
|
3
|
-
export interface ArMember {
|
|
4
|
-
name: string;
|
|
5
|
-
size: number;
|
|
6
|
-
data: Buffer;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function parseAr(data: Buffer): ArMember[] {
|
|
10
|
-
const members: ArMember[] = [];
|
|
11
|
-
let offset = 0;
|
|
12
|
-
|
|
13
|
-
const magic = data.subarray(0, 8).toString('ascii');
|
|
14
|
-
if (magic !== '!<arch>\n') {
|
|
15
|
-
throw new Error(`Not a valid ar archive: bad magic "${magic}"`);
|
|
16
|
-
}
|
|
17
|
-
offset = 8;
|
|
18
|
-
|
|
19
|
-
let strTable: string[] | null = null;
|
|
20
|
-
|
|
21
|
-
while (offset < data.length) {
|
|
22
|
-
if (offset + 60 > data.length) break;
|
|
23
|
-
|
|
24
|
-
const nameRaw = data.subarray(offset, offset + 16).toString('ascii');
|
|
25
|
-
const sizeStr = data.subarray(offset + 48, offset + 58).toString('ascii').trim();
|
|
26
|
-
const headerMagic = data.subarray(offset + 58, offset + 60).toString('ascii');
|
|
27
|
-
|
|
28
|
-
if (headerMagic !== '`\n') break;
|
|
29
|
-
|
|
30
|
-
const size = parseInt(sizeStr, 10);
|
|
31
|
-
if (isNaN(size)) break;
|
|
32
|
-
|
|
33
|
-
offset += 60;
|
|
34
|
-
const content = data.subarray(offset, offset + size);
|
|
35
|
-
const rawName = nameRaw.replace(/\//g, '').trim();
|
|
36
|
-
|
|
37
|
-
if (rawName === '//' && strTable === null) {
|
|
38
|
-
strTable = content.toString('ascii').split('\n')
|
|
39
|
-
.map(s => s.replace(/\0/g, '').trim()).filter(Boolean);
|
|
40
|
-
} else {
|
|
41
|
-
let name: string;
|
|
42
|
-
if (rawName.startsWith('/') && strTable) {
|
|
43
|
-
name = strTable[parseInt(rawName.slice(1), 10)] || rawName;
|
|
44
|
-
} else {
|
|
45
|
-
name = rawName.replace(/\/$/, '');
|
|
46
|
-
}
|
|
47
|
-
members.push({ name, size, data: content });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
offset += Math.ceil(size / 2) * 2;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return members;
|
|
54
|
-
}
|
package/src/core/compress.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as zlib from 'node:zlib';
|
|
2
|
-
import { execSync } from 'node:child_process';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
|
-
import * as path from 'node:path';
|
|
5
|
-
import * as os from 'node:os';
|
|
6
|
-
|
|
7
|
-
export function decompress(data: Buffer, filename: string): Buffer {
|
|
8
|
-
if (filename.endsWith('.gz')) return zlib.gunzipSync(data);
|
|
9
|
-
if (filename.endsWith('.xz')) return decompressWith(data, 'xz');
|
|
10
|
-
if (filename.endsWith('.zst')) return decompressWith(data, 'zstd');
|
|
11
|
-
return data;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function decompressWith(data: Buffer, tool: string): Buffer {
|
|
15
|
-
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'pmdeb-'));
|
|
16
|
-
const inFile = path.join(tmp, `input.${tool === 'xz' ? 'xz' : 'zst'}`);
|
|
17
|
-
const outFile = path.join(tmp, 'output');
|
|
18
|
-
try {
|
|
19
|
-
fs.writeFileSync(inFile, data);
|
|
20
|
-
execSync(`${tool} -d -f "${inFile}" --stdout > "${outFile}"`, { stdio: 'pipe' });
|
|
21
|
-
return fs.readFileSync(outFile);
|
|
22
|
-
} finally {
|
|
23
|
-
try { fs.unlinkSync(inFile); } catch {}
|
|
24
|
-
try { fs.unlinkSync(outFile); } catch {}
|
|
25
|
-
try { fs.rmdirSync(tmp); } catch {}
|
|
26
|
-
}
|
|
27
|
-
}
|
package/src/core/control.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function parseControlFile(content: string): Record<string, string> {
|
|
2
|
-
const fields: Record<string, string> = {};
|
|
3
|
-
let key = '';
|
|
4
|
-
let val = '';
|
|
5
|
-
|
|
6
|
-
for (const line of content.split('\n')) {
|
|
7
|
-
if (line.startsWith(' ') || line.startsWith('\t')) {
|
|
8
|
-
val += '\n' + line.trimEnd();
|
|
9
|
-
} else if (line.trim() === '') {
|
|
10
|
-
continue;
|
|
11
|
-
} else {
|
|
12
|
-
if (key) fields[key.toLowerCase()] = val.trimEnd();
|
|
13
|
-
const ci = line.indexOf(':');
|
|
14
|
-
if (ci === -1) continue;
|
|
15
|
-
key = line.slice(0, ci).trim();
|
|
16
|
-
val = line.slice(ci + 1).trim();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (key) fields[key.toLowerCase()] = val.trimEnd();
|
|
21
|
-
return fields;
|
|
22
|
-
}
|