X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=zpm.h;h=3d54308ebdfa576155d15a18aab393b17e84f1fa;hp=98971c126bb64adc45deb0cea274c2949addbb00;hb=HEAD;hpb=b0c5db32f5f53b5d43170756668e0c0387a88f13 diff --git a/zpm.h b/zpm.h index 98971c1..3d54308 100644 --- a/zpm.h +++ b/zpm.h @@ -192,10 +192,16 @@ int zpm_checkinstall(struct zpm *local); int zpm_merge(struct zpm *z, struct zpm *src, uint32_t flags); ssize_t uncompresslzma(void *buf, size_t bufsize, int outfd); +ssize_t zpm_uncompress_cb(void *buf, size_t bufsize, void *cbdata, + int (*cb)(void *ud, void *buf, size_t bufsize)); void *compresslzma(void *buf, size_t bufsize, size_t *len); #define SQLERROR(x) fprintf(stderr, "%s %d: %s\n", __func__, __LINE__, (x)) int zpm_hash(char *path, char *hash, uint32_t flags); + +/* hex encoded hash, not null terminated */ +int zpm_hash_mem(void *mem, size_t size, char *hash); + int zpm_readopts(struct zpm *pkg, int ac, char **av); struct zpm_version_info { @@ -212,6 +218,9 @@ int zpm_vercmp(const char *a, const char *b); /* add vercmp collation to db */ int zpm_addvercmp(struct zpm *pkg); +/* return 1 if database is readonly, 0 if readwrite, or not connected */ +int zpm_readonly(struct zpm *z); + int zpm_exec(struct zpm *z, const char *sql, int(*callback)(void *, int, char **, char**), void *arg, char **errmsg); int zpm_foreach_path(struct zpm *zpm, char *pkgid, char *where, @@ -232,12 +241,15 @@ int zpm_foreach_script(struct zpm *zpm, char *pkgstr, char *stage, void *cbd, int zpm_package_hash(struct zpm *zpm, char *pkgid, char *hash); int zpm_package_sethash(struct zpm *zpm, char *pkgid, char *hash); +int zpm_package_checkhash(struct zpm *zpm, char *pkgid, char *hash); +char *zpm_package_gethash(struct zpm *zpm, char *pkgid, char *hash); +int zpm_package_clearhash(struct zpm *zpm, char *pkgid); 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, ...); +int zpm_db_run(struct zpm *zpm, char *query, ...); void zpm_seterror(struct zpm *zpm, char *msgfmt, ...); struct zpm *zpm_clearmem(struct zpm *zpm);