]> pd.if.org Git - zpackage/blobdiff - lib/zpm.c
cleanup dead code
[zpackage] / lib / zpm.c
index f0a0ba256888317757b37f9df104fca9b8f25131..8df7fa82f2048baee280c67cdb918009c28c8674 100644 (file)
--- a/lib/zpm.c
+++ b/lib/zpm.c
 
 #include "sha256.h"
 
-#if 0
-struct zpm {
-       sqlite3 *db;
-       char *path; /* path to package file */
-       char *version;
-       int release;
-       char *pkgname;
-       time_t installed; /* install time, 0 for not installed */
-};
-
-struct zpm_file {
-       char *path;
-       int mode;
-       uint32_t filetype;
-       char *tags;
-       char *owner;
-       char *group;
-       char *hash; /* could be fixed length */
-       time_t mtime;
-       struct zpm_file *next; /* so you can make a linked list */
-};
-
-/* NULL?  Create? */
-/* associate with a package ? if only one?  first? */
-int zpm_open(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 */
-/* puts hash of import in hash */
-/* path can be a hash, with an "INTERNAL" flag, i.e. internally import */
-#define ZPM_MODE 0x1
-#define ZPM_OWNER 0x2
-#define ZPM_MTIME 0x4
-#define ZPM_INTERNAL 0x8
-#define ZPM_NOBLOB 0x10
-/* don't run scripts on install */
-#define ZPM_NOSCRIPTS 0x10
-/* don't associate the file with a package, just do a raw insert */
-/* otherwise, associate it with the current package */
-#define ZPM_NOPACKAGE 0x20
-
-int zpm_import(struct zpm *zp, char *path, uint32_t flags, uint8_t *hash);
-
-/* link and unlink hashes to packages */
-int zpm_link(struct zpm *pkg, char *path, char *hash, struct zpm_file *fileinfo);
-int zpm_unlink(struct zpm *pkg, char *path);
-
-/* tag a file.  relative to "current package" */
-int zpm_tag(struct zpm *zp, char *path, char *tags);
-/* should this be broken up into separage functions ? */
-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);
-
-/* export path to dest */
-int zpm_export(struct zpm *zp, char *path, uint32_t flags, char *dest);
-
-int zpm_close(struct zpm *zp);
-
-/* attach a signature to a package */
-int zpm_sign(struct zpm *z, size_t s, void *signature);
-
-/* set the package info to the nth package, -1 to return count? */
-/* further import/exports and such will be relative to this package */
-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);
-
-/* transactions */
-int zpm_begin(struct zpm *z);
-int zpm_commit(struct zpm *z);
-int zpm_rollback(struct zpm *z);
-
-/* higher level operations */
-
-/* install or uninstall the package */
-/* flag for keeping the blobs in local */
-/* what about tag filtering */
-int zpm_install(struct zpm *z, struct zpm *local, uint32_t flags);
-int zpm_uninstall(struct zpm *local);
-
-/* slurp up the actual blobs */
-/* what about versioning them if they change */
-int zpm_preserve(struct zpm *local);
-
-/* check file integrity */
-int zpm_checkinstall(struct zpm *local);
-
-int zpm_merge(struct zpm *z, struct zpm *src, uint32_t flags);
-
-void uncompresslzma(void *buf, size_t bufsize, FILE *out);
-#define SQLERROR(x) fprintf(stderr, "%s %d: %s\n", __func__, __LINE__, (x))
-#endif
-
-#if 0
-int zpm_newpkg(struct zpm *z, char *base, char *version, int release) {
-       char *sql = "insert or ignore into packages (package,version,release) values (?,?,?)";
-       int rc;
-       sqlite3_stmt *ifile;
-
-       rc = sqlite3_prepare(db, sql, -1, &ifile,0);
-       if (rc != SQLITE_OK) {
-               SQLERROR(sqlite3_errmsg(db));
-               return 0;
-       }
-       rc = sqlite3_bind_text(ifile, 1, base, strlen(base), SQLITE_STATIC);
-       if (rc != SQLITE_OK) {
-               SQLERROR(sqlite3_errmsg(db));
-               fprintf(stderr, "cant bind package name\n");
-               zpm_rollback(pkg);
-               return 0;
-       }
-       sqlite3_bind_text(ifile, 2, version, strlen(version), SQLITE_STATIC);
-       sqlite3_bind_int(ifile, 3, release)
-
-       rc = sqlite3_step(ifile);
-
-       if (rc != SQLITE_DONE) {
-               SQLERROR(sqlite3_errmsg(db));
-               sqlite3_finalize(ifile);
-               return 0;
-       }
-       sqlite3_finalize(ifile);
-       z->pkg = dupstr(base);
-       z->version = dupstr(version);
-       z->release = release;
-}
-#endif
-
 int zpm_begin(struct zpm *z) {
        char *errstr = 0;
        sqlite3_exec(z->db, "begin;", NULL, NULL, &errstr);