#include <limits.h>
#include <stdarg.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
-#include <sqlite3.h>
+#include "sqlite3.h"
+#include "lib/jsw/jsw_atree.h"
#define ZPM_HASH_STRLEN 64
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];
struct zpm_package {
struct zpm *zpm;
- struct jsw_hash *ht;
+ struct jsw_hash_t *ht;
/* char pointers are just pointers into the hash table */
/* integers/times and such are passed through atoi */
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 {
- char path[ZPM_PATH_MAX];
- int mode;
+ char *package;
+ char *version;
+ int release;
+
+ char *status;
+ char *path;
+ char *target;
+
+ mode_t mode;
+
//struct zpm_tree *tags;
- char owner[32];
- char group[32];
+
+ char *owner;
+ char *group;
+ gid_t gid;
+ uid_t uid;
+
+ int configuration;
time_t mtime;
+ char type;
+ dev_t device;
char hash[ZPM_HASH_STRLEN+1];
+ char confhash[ZPM_HASH_STRLEN+1];
+ void *data; /* hook for applications to attach data */
struct zpm_file *next; /* so you can make a linked list */
};
/* 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);
int zpm_hash(char *path, char *hash, uint32_t flags);
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 */
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_path_ds(struct zpm *zpm, char *pkgid, char *where,
+int (*callback)(struct zpm *, struct zpm_file *, void *), void *cbd);
+
int zpm_foreach_package(struct zpm *zpm, char *where,
int (*callback)(void *cbdata, int ncols, char **vals, char **cols),
void *data, char **errmsg);
struct zpm_note {
int64_t id;
- time_t ts; /* or timespec */
+ char *ts; /* applications can parse it if they need to */
char *note;
char *pkgid;
char *path;