11 #define ZPM_HASH_STRLEN 64
14 #define ZPM_PATH_MAX PATH_MAX
16 #define ZPM_PATH_MAX 256
19 #define ZPM_PACKAGE_NAME_MAX 191
20 #define ZPM_PACKAGE_VERSION_MAX 58
21 #define ZPM_PACKAGE_RELEASE_MAX 4
22 #define ZPM_PACKAGE_ID_MAX 255
24 #define ZPM_TAG_MAX 15
30 char *path; /* path to db file */
32 struct zpm_package *current_package;
35 struct zpm_dependency {
36 char minpkg[ZPM_PACKAGE_ID_MAX+1];
37 char maxpkg[ZPM_PACKAGE_ID_MAX+1];
38 struct zpm_dependency *next;
42 char tag[ZPM_TAG_MAX+1];
61 char checksum[ZPM_HASH_STRLEN+1];
65 char path[ZPM_PATH_MAX];
71 char hash[ZPM_HASH_STRLEN+1];
72 struct zpm_file *next; /* so you can make a linked list */
77 int zpm_open(struct zpm *pkg, char *path);
78 int zpm_pkgname(char *base, char *version, int release); /* construct a package file name */
80 /* flags for preserving mode, owner, etc */
81 /* puts hash of import in hash */
82 /* path can be a hash, with an "INTERNAL" flag, i.e. internally import */
86 #define ZPM_INTERNAL 0x8
87 #define ZPM_NOBLOB 0x10
88 /* don't run scripts on install */
89 #define ZPM_NOSCRIPTS 0x10
90 /* don't import file to a particular package */
91 #define ZPM_NOPACKAGE 0x20
93 int zpm_import(struct zpm *zp, char *path, uint32_t flags, char *hash);
95 /* tag a file. relative to "current package" */
96 int zpm_tag(struct zpm *zp, char *path, char *tags);
97 /* should this be broken up into separage functions ? */
98 int zpm_md(struct zpm *zp, char *path, int mode, char *owner, char *group, time_t mtime);
100 /* export hash to dest */
101 int zpm_extract(struct zpm *pkg, char *hash, char *path, int mode);
103 /* export path to dest */
104 int zpm_export(struct zpm *zp, char *path, uint32_t flags, char *dest);
106 int zpm_close(struct zpm *zp);
108 /* attach a signature to a package */
109 int zpm_sign(struct zpm *z, size_t s, void *signature);
111 /* set the package info to the nth package, -1 to return count? */
112 /* further import/exports and such will be relative to this package */
113 int zpm_package(struct zpm *zp, int n);
115 /* get file information */
116 int zpm_stat(struct zpm *z, struct zpm_file *f, int n);
118 /* will also set the package context to the new package */
119 int zpm_newpkg(struct zpm *z, char *base, char *version, int release);
122 int zpm_begin(struct zpm *z);
123 int zpm_commit(struct zpm *z);
124 int zpm_rollback(struct zpm *z);
126 /* higher level operations */
128 /* install or uninstall the package */
129 /* flag for keeping the blobs in local */
130 /* what about tag filtering */
131 int zpm_install(struct zpm *z, struct zpm *local, uint32_t flags);
132 int zpm_uninstall(struct zpm *local);
134 /* slurp up the actual blobs */
135 /* what about versioning them if they change */
136 int zpm_preserve(struct zpm *local);
138 /* check file integrity */
139 int zpm_checkinstall(struct zpm *local);
141 int zpm_merge(struct zpm *z, struct zpm *src, uint32_t flags);
144 void uncompresslzma(void *buf, size_t bufsize, FILE *out);
145 void *compresslzma(void *buf, size_t bufsize, size_t *len);
148 #define SQLERROR(x) fprintf(stderr, "%s %d: %s\n", __func__, __LINE__, (x))
149 int zpm_hash(char *path, char *hash, uint32_t flags);
150 int zpm_readopts(struct zpm *pkg, int ac, char **av);
152 int zpm_vercmp(const char *a, const char *b);
154 /* add vercmp collation to db */
155 int zpm_addvercmp(struct zpm *pkg);
157 int zpm_exec(struct zpm *z, const char *sql, int(*callback)(void *, int, char **, char**), void *arg, char **errmsg);
159 int zpm_foreach_path(struct zpm *zpm, char *pkgid,
160 int (*callback)(void *f, int ncols, char **vals, char **cols),
161 void *data, char **errmsg);