pacman-debian 7.2.0
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/LICENSE +674 -0
- package/README.md +440 -0
- package/README.zh.md +388 -0
- package/README_zh-CN.md +421 -0
- package/dist/ar.d.ts +8 -0
- package/dist/ar.d.ts.map +1 -0
- package/dist/ar.js +88 -0
- package/dist/ar.js.map +1 -0
- package/dist/cli/pacman.d.ts +2 -0
- package/dist/cli/pacman.d.ts.map +1 -0
- package/dist/cli/pacman.js +512 -0
- package/dist/cli/pacman.js.map +1 -0
- package/dist/compress.d.ts +2 -0
- package/dist/compress.d.ts.map +1 -0
- package/dist/compress.js +78 -0
- package/dist/compress.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +90 -0
- package/dist/config.js.map +1 -0
- package/dist/control.d.ts +2 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +31 -0
- package/dist/control.js.map +1 -0
- package/dist/core/ar.d.ts +7 -0
- package/dist/core/ar.d.ts.map +1 -0
- package/dist/core/ar.js +45 -0
- package/dist/core/ar.js.map +1 -0
- package/dist/core/compress.d.ts +2 -0
- package/dist/core/compress.d.ts.map +1 -0
- package/dist/core/compress.js +75 -0
- package/dist/core/compress.js.map +1 -0
- package/dist/core/control.d.ts +2 -0
- package/dist/core/control.d.ts.map +1 -0
- package/dist/core/control.js +29 -0
- package/dist/core/control.js.map +1 -0
- package/dist/core/deb.d.ts +4 -0
- package/dist/core/deb.d.ts.map +1 -0
- package/dist/core/deb.js +89 -0
- package/dist/core/deb.js.map +1 -0
- package/dist/core/deps.d.ts +25 -0
- package/dist/core/deps.d.ts.map +1 -0
- package/dist/core/deps.js +230 -0
- package/dist/core/deps.js.map +1 -0
- package/dist/core/options.d.ts +19 -0
- package/dist/core/options.d.ts.map +1 -0
- package/dist/core/options.js +3 -0
- package/dist/core/options.js.map +1 -0
- package/dist/core/pkgfile.d.ts +35 -0
- package/dist/core/pkgfile.d.ts.map +1 -0
- package/dist/core/pkgfile.js +162 -0
- package/dist/core/pkgfile.js.map +1 -0
- package/dist/core/tar.d.ts +13 -0
- package/dist/core/tar.d.ts.map +1 -0
- package/dist/core/tar.js +132 -0
- package/dist/core/tar.js.map +1 -0
- package/dist/core/types.d.ts +83 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +3 -0
- package/dist/core/types.js.map +1 -0
- package/dist/database.d.ts +20 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +181 -0
- package/dist/database.js.map +1 -0
- package/dist/db/database.d.ts +17 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/database.js +145 -0
- package/dist/db/database.js.map +1 -0
- package/dist/db/dpkg-compat.d.ts +19 -0
- package/dist/db/dpkg-compat.d.ts.map +1 -0
- package/dist/db/dpkg-compat.js +150 -0
- package/dist/db/dpkg-compat.js.map +1 -0
- package/dist/db/localdb.d.ts +9 -0
- package/dist/db/localdb.d.ts.map +1 -0
- package/dist/db/localdb.js +246 -0
- package/dist/db/localdb.js.map +1 -0
- package/dist/db/sqlite.d.ts +20 -0
- package/dist/db/sqlite.d.ts.map +1 -0
- package/dist/db/sqlite.js +309 -0
- package/dist/db/sqlite.js.map +1 -0
- package/dist/deb.d.ts +5 -0
- package/dist/deb.d.ts.map +1 -0
- package/dist/deb.js +105 -0
- package/dist/deb.js.map +1 -0
- package/dist/dpkg-compat.d.ts +18 -0
- package/dist/dpkg-compat.d.ts.map +1 -0
- package/dist/dpkg-compat.js +137 -0
- package/dist/dpkg-compat.js.map +1 -0
- package/dist/i18n/en.json +109 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +36 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/zh-CN.json +109 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +2 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +126 -0
- package/dist/install.js.map +1 -0
- package/dist/makepkg/build.d.ts +19 -0
- package/dist/makepkg/build.d.ts.map +1 -0
- package/dist/makepkg/build.js +370 -0
- package/dist/makepkg/build.js.map +1 -0
- package/dist/makepkg/index.d.ts +3 -0
- package/dist/makepkg/index.d.ts.map +1 -0
- package/dist/makepkg/index.js +84 -0
- package/dist/makepkg/index.js.map +1 -0
- package/dist/makepkg/pkgbuild.d.ts +36 -0
- package/dist/makepkg/pkgbuild.d.ts.map +1 -0
- package/dist/makepkg/pkgbuild.js +165 -0
- package/dist/makepkg/pkgbuild.js.map +1 -0
- package/dist/ops/install.d.ts +5 -0
- package/dist/ops/install.d.ts.map +1 -0
- package/dist/ops/install.js +299 -0
- package/dist/ops/install.js.map +1 -0
- package/dist/ops/query.d.ts +9 -0
- package/dist/ops/query.d.ts.map +1 -0
- package/dist/ops/query.js +189 -0
- package/dist/ops/query.js.map +1 -0
- package/dist/ops/remove.d.ts +3 -0
- package/dist/ops/remove.d.ts.map +1 -0
- package/dist/ops/remove.js +121 -0
- package/dist/ops/remove.js.map +1 -0
- package/dist/ops/upgrade.d.ts +4 -0
- package/dist/ops/upgrade.d.ts.map +1 -0
- package/dist/ops/upgrade.js +122 -0
- package/dist/ops/upgrade.js.map +1 -0
- package/dist/pacman.d.ts +2 -0
- package/dist/pacman.d.ts.map +1 -0
- package/dist/pacman.js +165 -0
- package/dist/pacman.js.map +1 -0
- package/dist/query.d.ts +5 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +143 -0
- package/dist/query.js.map +1 -0
- package/dist/remove.d.ts +2 -0
- package/dist/remove.d.ts.map +1 -0
- package/dist/remove.js +82 -0
- package/dist/remove.js.map +1 -0
- package/dist/repo/config.d.ts +3 -0
- package/dist/repo/config.d.ts.map +1 -0
- package/dist/repo/config.js +146 -0
- package/dist/repo/config.js.map +1 -0
- package/dist/repo/repository.d.ts +10 -0
- package/dist/repo/repository.d.ts.map +1 -0
- package/dist/repo/repository.js +596 -0
- package/dist/repo/repository.js.map +1 -0
- package/dist/repository.d.ts +10 -0
- package/dist/repository.d.ts.map +1 -0
- package/dist/repository.js +175 -0
- package/dist/repository.js.map +1 -0
- package/dist/scripts/pacman-conf.d.ts +3 -0
- package/dist/scripts/pacman-conf.d.ts.map +1 -0
- package/dist/scripts/pacman-conf.js +74 -0
- package/dist/scripts/pacman-conf.js.map +1 -0
- package/dist/scripts/setup.d.ts +3 -0
- package/dist/scripts/setup.d.ts.map +1 -0
- package/dist/scripts/setup.js +289 -0
- package/dist/scripts/setup.js.map +1 -0
- package/dist/tar.d.ts +17 -0
- package/dist/tar.d.ts.map +1 -0
- package/dist/tar.js +148 -0
- package/dist/tar.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/colors.d.ts +13 -0
- package/dist/ui/colors.d.ts.map +1 -0
- package/dist/ui/colors.js +38 -0
- package/dist/ui/colors.js.map +1 -0
- package/dist/ui/format.d.ts +3 -0
- package/dist/ui/format.d.ts.map +1 -0
- package/dist/ui/format.js +15 -0
- package/dist/ui/format.js.map +1 -0
- package/dist/ui/progress.d.ts +8 -0
- package/dist/ui/progress.d.ts.map +1 -0
- package/dist/ui/progress.js +50 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/prompt.d.ts +4 -0
- package/dist/ui/prompt.d.ts.map +1 -0
- package/dist/ui/prompt.js +60 -0
- package/dist/ui/prompt.js.map +1 -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 +42 -0
- package/lib/pac4deb/libalpm.so +0 -0
- package/lib/pac4deb/src/alpm_list.c +102 -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 +537 -0
- package/lib/pac4deb/src/stubs_manual.c +198 -0
- package/lib/pac4deb/stubs.c +6 -0
- package/lib/pac4deb/update_header.sh +15 -0
- package/package.json +41 -0
- package/src/cli/pacman.ts +308 -0
- package/src/core/ar.ts +54 -0
- package/src/core/compress.ts +27 -0
- package/src/core/control.ts +22 -0
- package/src/core/deb.ts +47 -0
- package/src/core/deps.ts +260 -0
- package/src/core/options.ts +20 -0
- package/src/core/pkgfile.ts +146 -0
- package/src/core/tar.ts +101 -0
- package/src/core/types.ts +89 -0
- package/src/db/database.ts +102 -0
- package/src/db/dpkg-compat.ts +129 -0
- package/src/db/localdb.ts +181 -0
- package/src/i18n/en.json +114 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/zh-CN.json +114 -0
- package/src/index.ts +7 -0
- package/src/makepkg/build.ts +351 -0
- package/src/makepkg/index.ts +87 -0
- package/src/makepkg/pkgbuild.ts +146 -0
- package/src/ops/install.ts +260 -0
- package/src/ops/query.ts +117 -0
- package/src/ops/remove.ts +77 -0
- package/src/ops/upgrade.ts +87 -0
- package/src/repo/config.ts +96 -0
- package/src/repo/repository.ts +520 -0
- package/src/scripts/pacman-conf.ts +68 -0
- package/src/scripts/setup.ts +261 -0
- package/src/ui/colors.ts +40 -0
- package/src/ui/format.ts +9 -0
- package/src/ui/progress.ts +26 -0
- package/src/ui/prompt.ts +21 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#ifndef ALPM_H
|
|
2
|
+
#define ALPM_H
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
#include <stdbool.h>
|
|
7
|
+
#include <stdarg.h>
|
|
8
|
+
#include <sys/types.h>
|
|
9
|
+
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
extern "C" {
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
/* Opaque types */
|
|
15
|
+
typedef struct __alpm_handle_t alpm_handle_t;
|
|
16
|
+
typedef struct __alpm_db_t alpm_db_t;
|
|
17
|
+
typedef struct __alpm_pkg_t alpm_pkg_t;
|
|
18
|
+
typedef struct __alpm_list_t alpm_list_t;
|
|
19
|
+
|
|
20
|
+
/* Time type */
|
|
21
|
+
typedef int64_t alpm_time_t;
|
|
22
|
+
|
|
23
|
+
/* Package reason */
|
|
24
|
+
typedef enum _alpm_pkgreason_t {
|
|
25
|
+
ALPM_PKG_REASON_EXPLICIT = 0,
|
|
26
|
+
ALPM_PKG_REASON_DEPEND = 1,
|
|
27
|
+
} alpm_pkgreason_t;
|
|
28
|
+
|
|
29
|
+
/* Package origin */
|
|
30
|
+
typedef enum _alpm_pkgfrom_t {
|
|
31
|
+
ALPM_PKG_FROM_FILE = 1,
|
|
32
|
+
ALPM_PKG_FROM_LOCALDB,
|
|
33
|
+
ALPM_PKG_FROM_SYNCDB,
|
|
34
|
+
} alpm_pkgfrom_t;
|
|
35
|
+
|
|
36
|
+
/* Package validation */
|
|
37
|
+
typedef enum _alpm_pkgvalidation_t {
|
|
38
|
+
ALPM_PKG_VALIDATION_UNKNOWN = 0,
|
|
39
|
+
ALPM_PKG_VALIDATION_NONE,
|
|
40
|
+
ALPM_PKG_VALIDATION_SIGNATURE,
|
|
41
|
+
ALPM_PKG_VALIDATION_CHECKSUM,
|
|
42
|
+
} alpm_pkgvalidation_t;
|
|
43
|
+
|
|
44
|
+
/* Error codes */
|
|
45
|
+
typedef enum _alpm_errno_t {
|
|
46
|
+
ALPM_ERR_OK = 0,
|
|
47
|
+
ALPM_ERR_MEMORY = 1,
|
|
48
|
+
ALPM_ERR_SYSTEM = 2,
|
|
49
|
+
ALPM_ERR_BADPERMS = 3,
|
|
50
|
+
ALPM_ERR_NOT_A_FILE = 4,
|
|
51
|
+
ALPM_ERR_NOT_A_DIR = 5,
|
|
52
|
+
ALPM_ERR_WRONG_ARGS = 6,
|
|
53
|
+
ALPM_ERR_DB_NOT_NULL = 7,
|
|
54
|
+
ALPM_ERR_DB_NOT_FOUND = 8,
|
|
55
|
+
ALPM_ERR_PKG_NOT_FOUND = 9,
|
|
56
|
+
ALPM_ERR_LIBARCHIVE = 10,
|
|
57
|
+
ALPM_ERR_LIBCURL = 11,
|
|
58
|
+
ALPM_ERR_HANDLE_NULL = 12,
|
|
59
|
+
ALPM_ERR_HANDLE_NOT_NULL = 13,
|
|
60
|
+
ALPM_ERR_DB_VERSION = 14,
|
|
61
|
+
ALPM_ERR_DB_WRITE = 15,
|
|
62
|
+
ALPM_ERR_DB_REMOVE = 16,
|
|
63
|
+
ALPM_ERR_SERVER_BAD_URL = 17,
|
|
64
|
+
ALPM_ERR_TRANS_NOT_NULL = 18,
|
|
65
|
+
ALPM_ERR_TRANS_NULL = 19,
|
|
66
|
+
ALPM_ERR_PKG_INVALID = 20,
|
|
67
|
+
} alpm_errno_t;
|
|
68
|
+
|
|
69
|
+
/* Capabilities */
|
|
70
|
+
typedef enum _alpm_caps_t {
|
|
71
|
+
ALPM_CAPABILITY_NLS = 1,
|
|
72
|
+
} alpm_caps_t;
|
|
73
|
+
|
|
74
|
+
/* Log levels */
|
|
75
|
+
typedef enum _alpm_loglevel_t {
|
|
76
|
+
ALPM_LOG_DEBUG = 1,
|
|
77
|
+
ALPM_LOG_ERROR = 2,
|
|
78
|
+
ALPM_LOG_WARNING = 4,
|
|
79
|
+
ALPM_LOG_FUNCTION = 8,
|
|
80
|
+
} alpm_loglevel_t;
|
|
81
|
+
|
|
82
|
+
typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);
|
|
83
|
+
|
|
84
|
+
/* ---- Handle ---- */
|
|
85
|
+
alpm_handle_t *alpm_initialize(const char *root, const char *dbpath, alpm_errno_t *err);
|
|
86
|
+
int alpm_release(alpm_handle_t *handle);
|
|
87
|
+
|
|
88
|
+
/* ---- Errors ---- */
|
|
89
|
+
alpm_errno_t alpm_errno(alpm_handle_t *handle);
|
|
90
|
+
const char *alpm_strerror(alpm_errno_t err);
|
|
91
|
+
|
|
92
|
+
/* ---- Databases ---- */
|
|
93
|
+
alpm_db_t *alpm_db_register_local(alpm_handle_t *handle);
|
|
94
|
+
alpm_db_t *alpm_db_register_sync(alpm_handle_t *handle, const char *treename);
|
|
95
|
+
int alpm_db_unregister_all(alpm_handle_t *handle);
|
|
96
|
+
alpm_pkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name);
|
|
97
|
+
alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db);
|
|
98
|
+
int alpm_db_set_pkgreason(alpm_handle_t *handle, const char *name, alpm_pkgreason_t reason);
|
|
99
|
+
|
|
100
|
+
/* ---- Packages ---- */
|
|
101
|
+
const char *alpm_pkg_get_name(alpm_pkg_t *pkg);
|
|
102
|
+
const char *alpm_pkg_get_version(alpm_pkg_t *pkg);
|
|
103
|
+
const char *alpm_pkg_get_desc(alpm_pkg_t *pkg);
|
|
104
|
+
const char *alpm_pkg_get_url(alpm_pkg_t *pkg);
|
|
105
|
+
const char *alpm_pkg_get_arch(alpm_pkg_t *pkg);
|
|
106
|
+
const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg);
|
|
107
|
+
alpm_pkgreason_t alpm_pkg_get_reason(alpm_pkg_t *pkg);
|
|
108
|
+
alpm_pkgfrom_t alpm_pkg_get_origin(alpm_pkg_t *pkg);
|
|
109
|
+
alpm_time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg);
|
|
110
|
+
alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
|
|
111
|
+
off_t alpm_pkg_get_size(alpm_pkg_t *pkg);
|
|
112
|
+
off_t alpm_pkg_get_isize(alpm_pkg_t *pkg);
|
|
113
|
+
alpm_pkgvalidation_t alpm_pkg_get_validation(alpm_pkg_t *pkg);
|
|
114
|
+
int alpm_pkg_has_scriptlet(alpm_pkg_t *pkg);
|
|
115
|
+
void alpm_pkg_free(alpm_pkg_t *pkg);
|
|
116
|
+
|
|
117
|
+
/* ---- Options ---- */
|
|
118
|
+
int alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir);
|
|
119
|
+
int alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs);
|
|
120
|
+
int alpm_option_set_usesyslog(alpm_handle_t *handle, int use);
|
|
121
|
+
int alpm_option_set_dbpath(alpm_handle_t *handle, const char *dbpath);
|
|
122
|
+
int alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile);
|
|
123
|
+
const char *alpm_option_get_dbpath(alpm_handle_t *handle);
|
|
124
|
+
alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle);
|
|
125
|
+
alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
|
|
126
|
+
|
|
127
|
+
/* ---- Logging ---- */
|
|
128
|
+
int alpm_logaction(alpm_handle_t *handle, const char *fmt, ...);
|
|
129
|
+
|
|
130
|
+
/* ---- Version comparison ---- */
|
|
131
|
+
int alpm_pkg_vercmp(const char *a, const char *b);
|
|
132
|
+
|
|
133
|
+
/* ---- Misc ---- */
|
|
134
|
+
const char *alpm_version(void);
|
|
135
|
+
int alpm_capabilities(void);
|
|
136
|
+
|
|
137
|
+
/* Go/CGO binding aliases used by AUR helpers */
|
|
138
|
+
alpm_db_t *alpm_get_localdb(alpm_handle_t *handle);
|
|
139
|
+
alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle);
|
|
140
|
+
int alpm_db_unregister(alpm_db_t *db);
|
|
141
|
+
int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir);
|
|
142
|
+
const char *alpm_option_get_gpgdir(alpm_handle_t *handle);
|
|
143
|
+
const char *alpm_option_get_logfile(alpm_handle_t *handle);
|
|
144
|
+
int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level);
|
|
145
|
+
int alpm_option_get_local_file_siglevel(alpm_handle_t *handle);
|
|
146
|
+
int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level);
|
|
147
|
+
int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle);
|
|
148
|
+
int alpm_option_set_dbext(alpm_handle_t *handle, const char *ext);
|
|
149
|
+
const char *alpm_option_get_dbext(alpm_handle_t *handle);
|
|
150
|
+
int alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, int disable);
|
|
151
|
+
int alpm_option_get_disable_dl_timeout(alpm_handle_t *handle);
|
|
152
|
+
int alpm_option_set_disable_sandbox(alpm_handle_t *handle, int disable);
|
|
153
|
+
int alpm_option_get_disable_sandbox(alpm_handle_t *handle);
|
|
154
|
+
int alpm_trans_init(alpm_handle_t *handle, int flags);
|
|
155
|
+
int alpm_trans_prepare(alpm_handle_t *handle);
|
|
156
|
+
int alpm_trans_commit(alpm_handle_t *handle);
|
|
157
|
+
int alpm_trans_release(alpm_handle_t *handle);
|
|
158
|
+
int alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg);
|
|
159
|
+
int alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg);
|
|
160
|
+
int alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade);
|
|
161
|
+
|
|
162
|
+
#ifdef __cplusplus
|
|
163
|
+
}
|
|
164
|
+
#endif
|
|
165
|
+
|
|
166
|
+
#endif /* ALPM_H */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#ifndef ALPM_LIST_H
|
|
2
|
+
#define ALPM_LIST_H
|
|
3
|
+
|
|
4
|
+
#include <stdlib.h>
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
typedef struct __alpm_list_t {
|
|
11
|
+
void *data;
|
|
12
|
+
struct __alpm_list_t *prev;
|
|
13
|
+
struct __alpm_list_t *next;
|
|
14
|
+
} alpm_list_t;
|
|
15
|
+
|
|
16
|
+
typedef int (*alpm_list_fn_cmp)(const void *, const void *);
|
|
17
|
+
typedef void (*alpm_list_fn_free)(void *);
|
|
18
|
+
|
|
19
|
+
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
|
|
20
|
+
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
|
|
21
|
+
void alpm_list_free(alpm_list_t *list);
|
|
22
|
+
void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
|
|
23
|
+
alpm_list_t *alpm_list_remove(alpm_list_t *list, const void *needle, alpm_list_fn_cmp fn, void **data);
|
|
24
|
+
alpm_list_t *alpm_list_remove_str(alpm_list_t *list, const char *needle, char **data);
|
|
25
|
+
alpm_list_t *alpm_list_strdup(alpm_list_t *list);
|
|
26
|
+
int alpm_list_count(const alpm_list_t *list);
|
|
27
|
+
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n);
|
|
28
|
+
alpm_list_t *alpm_list_next(const alpm_list_t *list);
|
|
29
|
+
alpm_list_t *alpm_list_previous(const alpm_list_t *list);
|
|
30
|
+
alpm_list_t *alpm_list_last(const alpm_list_t *list);
|
|
31
|
+
alpm_list_t *alpm_list_reverse(alpm_list_t *list);
|
|
32
|
+
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
|
|
33
|
+
alpm_list_t *alpm_list_copy(const alpm_list_t *list);
|
|
34
|
+
alpm_list_t *alpm_list_copy_data(const alpm_list_t *list, size_t size);
|
|
35
|
+
void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
|
|
36
|
+
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
|
|
37
|
+
|
|
38
|
+
#ifdef __cplusplus
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#endif
|
|
Binary file
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* alpm_list.c - simplified from pacman source (GPL-2.0-or-later)
|
|
3
|
+
* Copyright (C) 2006-2025 Pacman Development Team
|
|
4
|
+
*/
|
|
5
|
+
#include <stdlib.h>
|
|
6
|
+
#include <string.h>
|
|
7
|
+
#include "alpm_list.h"
|
|
8
|
+
|
|
9
|
+
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data) {
|
|
10
|
+
alpm_list_t *ptr, *lp = malloc(sizeof(alpm_list_t));
|
|
11
|
+
if (!lp) return list;
|
|
12
|
+
lp->data = data;
|
|
13
|
+
lp->prev = NULL;
|
|
14
|
+
lp->next = NULL;
|
|
15
|
+
if (!list) return lp;
|
|
16
|
+
ptr = list;
|
|
17
|
+
while (ptr->next) ptr = ptr->next;
|
|
18
|
+
ptr->next = lp;
|
|
19
|
+
lp->prev = ptr;
|
|
20
|
+
return list;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void alpm_list_free(alpm_list_t *list) {
|
|
24
|
+
alpm_list_t *it = list;
|
|
25
|
+
while (it) { alpm_list_t *next = it->next; free(it); it = next; }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void alpm_list_free_inner(alpm_list_t *list, void (*fn)(void*)) {
|
|
29
|
+
alpm_list_t *it = list;
|
|
30
|
+
while (it) { if (fn && it->data) fn(it->data); it = it->next; }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
int alpm_list_count(const alpm_list_t *list) {
|
|
34
|
+
int i = 0;
|
|
35
|
+
while (list) { i++; list = list->next; }
|
|
36
|
+
return i;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n) {
|
|
40
|
+
while (list && n--) list = list->next;
|
|
41
|
+
return (alpm_list_t *)list;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
alpm_list_t *alpm_list_next(const alpm_list_t *list) {
|
|
45
|
+
return list ? list->next : NULL;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
alpm_list_t *alpm_list_previous(const alpm_list_t *list) {
|
|
49
|
+
return list ? list->prev : NULL;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
alpm_list_t *alpm_list_last(const alpm_list_t *list) {
|
|
53
|
+
if (!list) return NULL;
|
|
54
|
+
while (list->next) list = list->next;
|
|
55
|
+
return (alpm_list_t *)list;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
alpm_list_t *alpm_list_reverse(alpm_list_t *list) {
|
|
59
|
+
alpm_list_t *new = NULL, *it = list;
|
|
60
|
+
while (it) { alpm_list_t *next = it->next; it->next = new; it->prev = next; new = it; it = next; }
|
|
61
|
+
return new;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second) {
|
|
65
|
+
if (!first) return second;
|
|
66
|
+
alpm_list_t *last = alpm_list_last(first);
|
|
67
|
+
last->next = second;
|
|
68
|
+
if (second) second->prev = last;
|
|
69
|
+
return first;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
alpm_list_t *alpm_list_copy(const alpm_list_t *list) {
|
|
73
|
+
alpm_list_t *new = NULL;
|
|
74
|
+
while (list) { new = alpm_list_add(new, list->data); list = list->next; }
|
|
75
|
+
return new;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void *alpm_list_find(const alpm_list_t *haystack, const void *needle,
|
|
79
|
+
int (*fn)(const void *, const void *)) {
|
|
80
|
+
while (haystack) {
|
|
81
|
+
if (fn(needle, haystack->data) == 0) return haystack->data;
|
|
82
|
+
haystack = haystack->next;
|
|
83
|
+
}
|
|
84
|
+
return NULL;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
alpm_list_t *alpm_list_remove(alpm_list_t *list, const void *needle,
|
|
88
|
+
int (*fn)(const void *, const void *), void **data) {
|
|
89
|
+
alpm_list_t *it = list;
|
|
90
|
+
while (it) {
|
|
91
|
+
if (fn(needle, it->data) == 0) {
|
|
92
|
+
if (data) *data = it->data;
|
|
93
|
+
if (it->prev) it->prev->next = it->next;
|
|
94
|
+
if (it->next) it->next->prev = it->prev;
|
|
95
|
+
if (it == list) list = it->next;
|
|
96
|
+
free(it);
|
|
97
|
+
return list;
|
|
98
|
+
}
|
|
99
|
+
it = it->next;
|
|
100
|
+
}
|
|
101
|
+
return list;
|
|
102
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
HEADER="../include/alpm.h"
|
|
3
|
+
REAL="libalpm.c"
|
|
4
|
+
OUT="stubs.c"
|
|
5
|
+
|
|
6
|
+
# Get all function names already defined in the real implementation
|
|
7
|
+
declare -A defined
|
|
8
|
+
while IFS= read -r line; do
|
|
9
|
+
name=$(echo "$line" | grep -oP '\b(alpm_\w+)\b' | tail -1)
|
|
10
|
+
[ -n "$name" ] && defined["$name"]=1
|
|
11
|
+
done < <(grep -oP '^(static )?\w[\w\s\*]+\balpm_\w+\s*\(' "$REAL")
|
|
12
|
+
|
|
13
|
+
echo '/* Auto-generated stubs for functions not in libalpm.c */' > "$OUT"
|
|
14
|
+
echo '#include "../include/alpm.h"' >> "$OUT"
|
|
15
|
+
echo '#include "../include/alpm_list.h"' >> "$OUT"
|
|
16
|
+
echo '#include <stdlib.h>' >> "$OUT"
|
|
17
|
+
echo '#include <string.h>' >> "$OUT"
|
|
18
|
+
echo '' >> "$OUT"
|
|
19
|
+
|
|
20
|
+
grep -oP '^\s*\w[\w\s\*]+\([^)]*\)\s*;' "$HEADER" | while read -r line; do
|
|
21
|
+
func_name=$(echo "$line" | grep -oP '\b(alpm_\w+)\b' | tail -1)
|
|
22
|
+
[ -z "$func_name" ] && continue
|
|
23
|
+
[ -n "${defined[$func_name]}" ] && continue
|
|
24
|
+
|
|
25
|
+
params=$(echo "$line" | sed 's/.*(\(.*\));/\1/')
|
|
26
|
+
ret_type=$(echo "$line" | sed 's/\(.*\) \([a-zA-Z_][a-zA-Z_0-9]*\)(.*/\1/' | xargs)
|
|
27
|
+
|
|
28
|
+
if [[ "$ret_type" == "void" ]]; then
|
|
29
|
+
body="{ }"
|
|
30
|
+
elif [[ "$ret_type" == *"*" ]]; then
|
|
31
|
+
body="{ return NULL; }"
|
|
32
|
+
elif [[ "$ret_type" == "int" ]]; then
|
|
33
|
+
body="{ return 0; }"
|
|
34
|
+
elif [[ "$ret_type" == "alpm_errno_t" ]]; then
|
|
35
|
+
body="{ return ALPM_ERR_OK; }"
|
|
36
|
+
elif [[ "$ret_type" == "off_t" ]] || [[ "$ret_type" == "alpm_time_t" ]] || [[ "$ret_type" == "size_t" ]]; then
|
|
37
|
+
body="{ return 0; }"
|
|
38
|
+
elif [[ "$ret_type" == "alpm_pkgreason_t" ]]; then
|
|
39
|
+
body="{ return ALPM_PKG_REASON_EXPLICIT; }"
|
|
40
|
+
elif [[ "$ret_type" == "alpm_pkgfrom_t" ]]; then
|
|
41
|
+
body="{ return ALPM_PKG_FROM_LOCALDB; }"
|
|
42
|
+
elif [[ "$ret_type" == "alpm_pkgvalidation_t" ]]; then
|
|
43
|
+
body="{ return ALPM_PKG_VALIDATION_NONE; }"
|
|
44
|
+
else
|
|
45
|
+
body="{ return 0; }"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
printf "%s %s(%s) %s\n" "$ret_type" "$func_name" "$params" "$body" >> "$OUT"
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
echo "Generated $OUT with $(grep -c '^{' "$OUT") stubs"
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
HEADER="../include/alpm.h"
|
|
3
|
+
REAL="libalpm.c"
|
|
4
|
+
OUT="stubs.c"
|
|
5
|
+
|
|
6
|
+
grep -oP '^(static )?\w[\w\s\*]+\balpm_\w+\s*\(' "$REAL" | sed 's/.*\balpm_/alpm_/' | sed 's/(//' | sort > /tmp/defined_funcs.txt
|
|
7
|
+
|
|
8
|
+
echo '/* Auto-generated stubs */' > "$OUT"
|
|
9
|
+
echo '#include "../include/alpm.h"' >> "$OUT"
|
|
10
|
+
echo '#include "../include/alpm_list.h"' >> "$OUT"
|
|
11
|
+
echo '#include <stdlib.h>' >> "$OUT"
|
|
12
|
+
echo '#include <string.h>' >> "$OUT"
|
|
13
|
+
echo '' >> "$OUT"
|
|
14
|
+
|
|
15
|
+
count=0; skip=0
|
|
16
|
+
while IFS= read -r line; do
|
|
17
|
+
decl="${line%%(*}"
|
|
18
|
+
name_with_star="${decl##* }"
|
|
19
|
+
func_name="${name_with_star#\*}"
|
|
20
|
+
raw_ret="${decl% $name_with_star}"
|
|
21
|
+
ret_type="${raw_ret%"${raw_ret##*[! ]}"}"
|
|
22
|
+
params="${line#*(}"; params="${params%);}"
|
|
23
|
+
|
|
24
|
+
grep -qx "$func_name" /tmp/defined_funcs.txt 2>/dev/null && { ((skip++)); continue; }
|
|
25
|
+
|
|
26
|
+
[[ "$ret_type" == "void" ]] && { body="{ }"; echo_ok; continue; }
|
|
27
|
+
[[ "$ret_type" == "int" ]] && { body="{ return 0; }"; echo_ok; continue; }
|
|
28
|
+
[[ "$ret_type" == "alpm_errno_t" ]] && { body="{ return ALPM_ERR_OK; }"; echo_ok; continue; }
|
|
29
|
+
[[ "$ret_type" == "off_t" || "$ret_type" == "alpm_time_t" || "$ret_type" == "size_t" ]] && { body="{ return 0; }"; echo_ok; continue; }
|
|
30
|
+
[[ "$ret_type" == "const char *" ]] && { body="{ return NULL; }"; echo_ok; continue; }
|
|
31
|
+
[[ "$ret_type" == *"*"* || "$name_with_star" == \** ]] && { body="{ return NULL; }"; echo_ok; continue; }
|
|
32
|
+
|
|
33
|
+
# Unknown return type - use return 0
|
|
34
|
+
body="{ return 0; }"
|
|
35
|
+
echo_ok
|
|
36
|
+
|
|
37
|
+
done < <(grep -oP '^\s*\w[\w\s\*]+\b(alpm_\w+)\s*\([^)]*\)\s*;' "../include/alpm.h")
|
|
38
|
+
|
|
39
|
+
# Use a function to write to OUT
|
|
40
|
+
{
|
|
41
|
+
echo '/* Auto-generated stubs */'
|
|
42
|
+
echo '#include "../include/alpm.h"'
|
|
43
|
+
echo '#include "../include/alpm_list.h"'
|
|
44
|
+
echo '#include <stdlib.h>'
|
|
45
|
+
echo '#include <string.h>'
|
|
46
|
+
echo ''
|
|
47
|
+
} > "$OUT"
|
|
48
|
+
|
|
49
|
+
while IFS= read -r line; do
|
|
50
|
+
decl="${line%%(*}"
|
|
51
|
+
name_with_star="${decl##* }"
|
|
52
|
+
func_name="${name_with_star#\*}"
|
|
53
|
+
raw_ret="${decl% $name_with_star}"
|
|
54
|
+
ret_type="${raw_ret%"${raw_ret##*[! ]}"}"
|
|
55
|
+
params="${line#*(}"; params="${params%);}"
|
|
56
|
+
|
|
57
|
+
grep -qx "$func_name" /tmp/defined_funcs.txt 2>/dev/null && continue
|
|
58
|
+
|
|
59
|
+
if [[ "$ret_type" == "void" ]]; then body="{ }"
|
|
60
|
+
elif [[ "$ret_type" == "int" ]]; then body="{ return 0; }"
|
|
61
|
+
elif [[ "$ret_type" == "alpm_errno_t" ]]; then body="{ return ALPM_ERR_OK; }"
|
|
62
|
+
elif [[ "$ret_type" == "off_t" || "$ret_type" == "alpm_time_t" || "$ret_type" == "size_t" ]]; then body="{ return 0; }"
|
|
63
|
+
elif [[ "$ret_type" == "const char *" ]] then body="{ return NULL; }"
|
|
64
|
+
elif [[ "$ret_type" == *"*"* || "$name_with_star" == \** ]]; then body="{ return NULL; }"
|
|
65
|
+
else body="{ return 0; }"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
echo "$ret_type $func_name($params) $body" >> "$OUT"
|
|
69
|
+
((count++))
|
|
70
|
+
done < <(grep -oP '^\s*\w[\w\s\*]+\b(alpm_\w+)\s*\([^)]*\)\s*;' "../include/alpm.h")
|
|
71
|
+
|
|
72
|
+
echo "Generated $count stubs (skipped $skip)" >&2
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Generate stubs for functions declared in header but not implemented in libalpm.c
|
|
3
|
+
HEADER="../include/alpm.h"
|
|
4
|
+
REAL="libalpm.c"
|
|
5
|
+
OUT="stubs.c"
|
|
6
|
+
|
|
7
|
+
grep -oP '^(static )?\w[\w\s\*]+\balpm_\w+\s*\(' "$REAL" | sed 's/.*\balpm_/alpm_/' | sed 's/(//' | sort > /tmp/defined.txt
|
|
8
|
+
|
|
9
|
+
count=0
|
|
10
|
+
while IFS= read -r line; do
|
|
11
|
+
decl="${line%%(*}"
|
|
12
|
+
name_with_star="${decl##* }"
|
|
13
|
+
func_name="${name_with_star#\*}"
|
|
14
|
+
raw_ret="${decl% $name_with_star}"
|
|
15
|
+
ret_type="${raw_ret%"${raw_ret##*[! ]}"}"
|
|
16
|
+
params="${line#*(}"; params="${params%);}"
|
|
17
|
+
|
|
18
|
+
grep -qx "$func_name" /tmp/defined.txt 2>/dev/null && continue
|
|
19
|
+
|
|
20
|
+
if [[ "$ret_type" == "void" ]]; then body="{ }"
|
|
21
|
+
elif [[ "$ret_type" == "int" ]]; then body="{ return 0; }"
|
|
22
|
+
elif [[ "$ret_type" == "alpm_errno_t" ]]; then body="{ return ALPM_ERR_OK; }"
|
|
23
|
+
elif [[ "$ret_type" == "off_t" || "$ret_type" == "alpm_time_t" || "$ret_type" == "size_t" ]]; then body="{ return 0; }"
|
|
24
|
+
elif [[ "$ret_type" == "const char *" ]] then body="{ return NULL; }"
|
|
25
|
+
elif [[ "$ret_type" == *"*"* || "$name_with_star" == \** ]]; then body="{ return NULL; }"
|
|
26
|
+
else body="{ return 0; }"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
lines+=("$ret_type $func_name($params) $body")
|
|
30
|
+
((count++))
|
|
31
|
+
done < <(grep -oP '^\s*\w[\w\s\*]+\b(alpm_\w+)\s*\([^)]*\)\s*;' "$HEADER")
|
|
32
|
+
|
|
33
|
+
cat > "$OUT" << EOF
|
|
34
|
+
/* Auto-generated stubs for functions not in libalpm.c */
|
|
35
|
+
#include "../include/alpm.h"
|
|
36
|
+
#include "../include/alpm_list.h"
|
|
37
|
+
#include <stdlib.h>
|
|
38
|
+
#include <string.h>
|
|
39
|
+
|
|
40
|
+
EOF
|
|
41
|
+
|
|
42
|
+
for l in "${lines[@]}"; do echo "$l" >> "$OUT"; done
|
|
43
|
+
echo "Generated $count stubs" >&2
|