X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm.h;h=adc69bba4376d03459d656ac70bf5a05d20e1c7e;hb=30aa9bfe1e9a0e682f7c942b8e68054551f14857;hp=64e5ac63ec9c49437cc2b4da2310111aa724d85c;hpb=62b81a9629f5a80a4cf9d8fae6f778e2b857c2a6;p=zpackage diff --git a/zpm.h b/zpm.h index 64e5ac6..adc69bb 100644 --- a/zpm.h +++ b/zpm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -75,7 +76,7 @@ struct zpm_package { }; int zpm_parse_package(char *pstr, char *name, char *ver, int *rel); -char *zpm_findpkg(struct zpm *zpm, char *pkgstr); +char *zpm_findpkg(struct zpm *zpm, char *pkgstr, char *where); int zpm_quote(char *value, char *dest, size_t n); struct zpm_file { @@ -114,7 +115,7 @@ int zpm_tag(struct zpm *zp, char *path, char *tags); int zpm_md(struct zpm *zp, char *path, int mode, char *owner, char *group, time_t mtime); /* export hash to dest */ -int zpm_extract(struct zpm *pkg, char *hash, char *path, int mode); +int zpm_extract(struct zpm *pkg, char *hash, char *path, mode_t mode); /* export path to dest */ int zpm_export(struct zpm *zp, char *path, uint32_t flags, char *dest); @@ -156,10 +157,8 @@ int zpm_checkinstall(struct zpm *local); int zpm_merge(struct zpm *z, struct zpm *src, uint32_t flags); -#if 1 -void uncompresslzma(void *buf, size_t bufsize, FILE *out); +ssize_t uncompresslzma(void *buf, size_t bufsize, int outfd); void *compresslzma(void *buf, size_t bufsize, size_t *len); -#endif #define SQLERROR(x) fprintf(stderr, "%s %d: %s\n", __func__, __LINE__, (x)) int zpm_hash(char *path, char *hash, uint32_t flags); @@ -175,15 +174,45 @@ int zpm_exec(struct zpm *z, const char *sql, int(*callback)(void *, int, char ** int zpm_foreach_path(struct zpm *zpm, char *pkgid, char *where, int (*callback)(void *f, int ncols, char **vals, char **cols), void *data, char **errmsg); +int zpm_foreach_package(struct zpm *zpm, char *where, +int (*callback)(void *cbdata, int ncols, char **vals, char **cols), +void *data, char **errmsg); int zpm_script_hash(struct zpm *zpm, char *pkgstr, char *phase, char *hash); +int zpm_script_set(struct zpm *zpm, char *pkgstr, char *phase, char *hash); + int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash); int zpm_package_sethash(struct zpm *zpm, char *pkgid, char *hash); sqlite3_stmt *zpm_dbqueryv(struct zpm *zpm, char *query, va_list args); sqlite3_stmt *zpm_dbquery(struct zpm *zpm, char *query, ...); char *zpm_db_string(struct zpm *zpm, char *query, ...); +int zpm_db_int(struct zpm *zpm, char *query, ...); +void zpm_db_run(struct zpm *zpm, char *query, ...); +void zpm_seterror(struct zpm *zpm, char *msgfmt, ...); struct zpm *zpm_clearmem(struct zpm *zpm); +struct zpm_note { + int64_t id; + time_t ts; /* or timespec */ + char *note; + char *pkgid; + char *path; + char *file; + char *hash; + int ack; +}; + +void zpm_note_ack(struct zpm *zpm, int64_t note); +void zpm_note_unack(struct zpm *zpm, int64_t note); +void zpm_note_del(struct zpm *zpm, int64_t note); +int64_t zpm_note(struct zpm *zpm, struct zpm_note *n, unsigned int flags); +void zpm_note_free(struct zpm_note *n); +int zpm_notes(struct zpm *zpm, int n, struct zpm_note *note); +int64_t zpm_note_next(struct zpm *zpm, struct zpm_note *n); +int64_t zpm_note_add(struct zpm *zpm, char *pkgid, char *path, char *filehash, + char *notefmt, ...); +int zpm_notes_available(struct zpm *zpm, int flags); + #endif