X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm.h;h=1b619869255c351649f6571b577383e6ad64b569;hb=2ac486ab18adbbb84563eafc0d67fa8da6ca7822;hp=6cca0575c27c52d2a86e1df831806bfd326ad0f5;hpb=e0b66116ef0b1894e70312f98b2d835dec8c8c19;p=zpackage diff --git a/zpm.h b/zpm.h index 6cca057..1b61986 100644 --- a/zpm.h +++ b/zpm.h @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "sqlite3.h" #include "lib/jsw/jsw_atree.h" @@ -41,6 +43,14 @@ struct zpm { struct zpm_package *current_package; }; +struct zpm_stat { + struct stat st; + int configuration; + char hash[65]; /* length + room for a nul byte */ + char diskhash[65]; /* hash of actual file on disk */ + char *target; /* malloced link target */ +}; + struct zpm_dependency { char minpkg[ZPM_PACKAGE_ID_MAX+1]; char maxpkg[ZPM_PACKAGE_ID_MAX+1]; @@ -78,9 +88,11 @@ struct zpm_package { int zpm_parse_package(char *pstr, char *name, char *ver, int *rel); char *zpm_findpkg(struct zpm *zpm, char *pkgstr, char *where); +char *zpm_findpkg_range(struct zpm *zpm, char *minpkg, char *maxpkg, char *where, int wantleast); int zpm_findhash(struct zpm *zpm, char *find, char *dest); char *zpm_findlib(struct zpm *zpm, char *soname, char *where); int zpm_libraries_needed(struct zpm *zpm, char *pkgid, jsw_atree_t *list); +int zpm_packages_needed(struct zpm *zpm, char *pkgid, jsw_atree_t *list); int zpm_quote(char *value, char *dest, size_t n); struct zpm_file { @@ -153,8 +165,9 @@ int zpm_package(struct zpm *zp, int n); /* get file information */ int zpm_stat(struct zpm *z, struct zpm_file *f, int n); -/* will also set the package context to the new package */ -int zpm_newpkg(struct zpm *z, char *base, char *version, int release); +//int zpm_newpkg(struct zpm *z, char *base, char *version, int release); +int zpm_create_package(struct zpm *zpm, char *name, char *ver, int rel); +int zpm_create_pkgid(struct zpm *zpm, char *pkgstr); /* transactions */ int zpm_begin(struct zpm *z); @@ -179,12 +192,27 @@ 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 { + const char *verstr; + const char *name; int namelen; + const char *version; int verlen; + const char *relstr; int rellen; + int release; +}; + +int zpm_parse_version(const char *pstr, struct zpm_version_info *info); int zpm_vercmp(const char *a, const char *b); /* add vercmp collation to db */