blob: 41cc3617363d8b243ad0f4793f9d5c6bc3f68d28 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/* apk_context.h - Alpine Package Keeper (APK)
*
* Copyright (C) 2020 Timo Teräs <timo.teras@iki.fi>
* All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-only
*/
#ifndef APK_CONTEXT_H
#define APK_CONTEXT_H
#include "apk_print.h"
#include "apk_io.h"
#include "adb.h"
#define APK_SIMULATE BIT(0)
#define APK_CLEAN_PROTECTED BIT(1)
#define APK_RECURSIVE BIT(2)
#define APK_ALLOW_UNTRUSTED BIT(3)
#define APK_PURGE BIT(4)
#define APK_INTERACTIVE BIT(5)
#define APK_NO_NETWORK BIT(6)
#define APK_OVERLAY_FROM_STDIN BIT(7)
#define APK_NO_SCRIPTS BIT(8)
#define APK_NO_CACHE BIT(9)
#define APK_NO_COMMIT_HOOKS BIT(10)
#define APK_FORCE_OVERWRITE BIT(0)
#define APK_FORCE_OLD_APK BIT(1)
#define APK_FORCE_BROKEN_WORLD BIT(2)
#define APK_FORCE_REFRESH BIT(3)
#define APK_FORCE_NON_REPOSITORY BIT(4)
#define APK_FORCE_BINARY_STDOUT BIT(5)
struct apk_database;
#define APK_OPENF_READ 0x0001
#define APK_OPENF_WRITE 0x0002
#define APK_OPENF_CREATE 0x0004
#define APK_OPENF_NO_INSTALLED 0x0010
#define APK_OPENF_NO_SCRIPTS 0x0020
#define APK_OPENF_NO_WORLD 0x0040
#define APK_OPENF_NO_SYS_REPOS 0x0100
#define APK_OPENF_NO_INSTALLED_REPO 0x0200
#define APK_OPENF_CACHE_WRITE 0x0400
#define APK_OPENF_NO_AUTOUPDATE 0x0800
#define APK_OPENF_NO_REPOS (APK_OPENF_NO_SYS_REPOS | \
APK_OPENF_NO_INSTALLED_REPO)
#define APK_OPENF_NO_STATE (APK_OPENF_NO_INSTALLED | \
APK_OPENF_NO_SCRIPTS | \
APK_OPENF_NO_WORLD)
struct apk_ctx {
unsigned int flags, force, lock_wait;
struct apk_out out;
struct apk_progress progress;
unsigned int cache_max_age;
unsigned long open_flags;
const char *root;
const char *arch;
const char *keys_dir;
const char *cache_dir;
const char *repositories_file;
struct apk_string_array *repository_list;
struct apk_string_array *private_keys;
struct adb_trust trust;
struct apk_id_cache id_cache;
struct apk_database *db;
int root_fd, keys_fd;
};
void apk_ctx_init(struct apk_ctx *ac);
void apk_ctx_free(struct apk_ctx *ac);
int apk_ctx_prepare(struct apk_ctx *ac);
int apk_ctx_fd_keys(struct apk_ctx *ac);
struct adb_trust *apk_ctx_get_trust(struct apk_ctx *ac);
struct apk_id_cache *apk_ctx_get_id_cache(struct apk_ctx *ac);
static inline int apk_ctx_fd_root(struct apk_ctx *ac) { return ac->root_fd; }
static inline time_t apk_ctx_since(struct apk_ctx *ac, time_t since) {
return (ac->force & APK_FORCE_REFRESH) ? APK_ISTREAM_FORCE_REFRESH : since;
}
#endif
|