]> pd.if.org Git - zpackage/blobdiff - zpm.h
separate zpm library database create and open
[zpackage] / zpm.h
diff --git a/zpm.h b/zpm.h
index 43d394cdc11affde6911744a54a410bf6106415c..43c6687a1208af219dd6dcc0f75715c8000675e4 100644 (file)
--- a/zpm.h
+++ b/zpm.h
@@ -29,6 +29,8 @@ struct zpm {
        sqlite3 *db;
        char *path; /* path to db file */
        int error;
+       char *errmsg;
+       char *pkgid;
        struct zpm_package *current_package;
 };
 
@@ -45,26 +47,36 @@ struct zpm_tag {
 
 struct zpm_package {
        struct zpm *zpm;
+       struct jsw_hash *ht;
+
+       /* char pointers are just pointers into the hash table */
+       /* integers/times and such are passed through atoi */
+       /* tags and licenses are trees, NULL if not fetched */
        char *name;
        char *version;
        int release;
        char *id;
-       char *tags;
+       /* null if tags not collected */
+       //struct zpm_tree *tags;
        char *description;
        char *architecture;
        char *url;
-       char *status;
-       char *licenses;
-       char *package;
+       char *status; /* integer code ? */
+       //struct zpm_tree *licenses;
        time_t build_time;
        time_t install_time;
        char checksum[ZPM_HASH_STRLEN+1];
+       struct zpm_package *next;
 };
 
+int zpm_parse_package(char *pstr, char *name, char *ver, int *rel);
+char *zpm_findpkg(struct zpm *zpm, char *pkgstr);
+int zpm_quote(char *value, char *dest, size_t n);
+
 struct zpm_file {
        char path[ZPM_PATH_MAX];
        int mode;
-       char tags[64];
+       //struct zpm_tree *tags;
        char owner[32];
        char group[32];
        time_t mtime;
@@ -72,9 +84,8 @@ struct zpm_file {
        struct zpm_file *next; /* so you can make a linked list */
 };
 
-
-/* NULL?  Create? */
 int zpm_open(struct zpm *pkg, char *path);
+int zpm_init(struct zpm *pkg, char *path);
 int zpm_pkgname(char *base, char *version, int release); /* construct a package file name */
 
 /* flags for preserving mode, owner, etc */
@@ -160,5 +171,8 @@ int zpm_foreach_path(struct zpm *zpm, char *pkgid,
 int (*callback)(void *f, int ncols, char **vals, char **cols),
 void *data, char **errmsg);
 
+int zpm_script_hash(struct zpm *zpm, char *pkgstr, char *phase, char *hash);
+
+sqlite3_stmt *zpm_dbquery(struct zpm *zpm, char *query, ...);
 
 #endif