]> pd.if.org Git - zpackage/commitdiff
cleanup dead code
authorNathan Wagner <nw@hydaspes.if.org>
Fri, 2 Nov 2018 15:25:22 +0000 (15:25 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 3 Nov 2018 12:41:03 +0000 (12:41 +0000)
lib/compress.c
lib/zpm.c
zpm-contents
zpm-syncfs.c
zpm-verify.c

index 72fe159d2d6bb7edfdaecda4dee70643258a62eb..efbec3d94058e700fd84986fe32214bf54079dbb 100644 (file)
@@ -41,16 +41,3 @@ void *compresslzma(void *buf, size_t bufsize, size_t *len) {
        *len = outlen;
        return outbuf;
 }
-
-#if 0
-static int callback(void *NotUsed, int argc, char **argv, char **azColName){
-       int i;
-       for(i=0; i<argc; i++){
-               printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
-       }
-       printf("\n");
-       return 0;
-}
-
-static char *create_table = "create table if not exists files (hash text primary key, size integer, compression text, content blob)";
-#endif
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);
index d6a5996ba34846945b7db0b68074f0314e88b84a..8b7dde005b9f2314da725bfab9f8a5686e6273d0 100755 (executable)
@@ -67,15 +67,10 @@ cols=${cols%,}
                        printf ', '
                fi
 
-               cat <<-EOC
-               case when filetype = 'd' then
-                       rtrim(path,'/') || '/'
-               when filetype = 'l' then
-                       printf('%s -> %s', path, target)
-               else
-                       path
-               end as path
-               EOC
+               printf "case\n";
+               printf "when filetype = 'd' then rtrim(path,'/') || '/'\n"
+               printf "when filetype = 'l' then printf('%s -> %s', path, target)\n"
+               printf "else path end as path\n"
        fi
        printf 'from packagefiles_pkgid\nwhere true\n'
        if [ -n "$globlist" ]; then
index ff80041e6750a5d43097f703c5bb76f3b733f11c..2e43dbef9299c8599bb400ff10916f3dfbedeb80 100644 (file)
@@ -960,13 +960,14 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
                        if (mdsame && hashsame && (accept || overwrite)) {
                                /* do nothing */
                                if (conf->dryrun || conf->verbose) {
-                                       fprintf(stderr, "accepting existing file: %s\n", nitem.dest);
+                                       fprintf(stderr, "accept %s: %s\n",
+                                                       eisdir ? "directory" : "file", nitem.dest);
                                }
                                return 0;
                        }
                        if (mdsame && hashsame && !(accept || overwrite)) {
                                /* error */
-                               return seterror(conf, "will not accept or overwrite existing file: %s", nitem.dest);
+                               return seterror(conf, "file exists: %s", nitem.dest);
                        }
                        if (mdsame && !hashsame && overwrite) {
                                /* install */
index fa690e9736926f90b09fa83e2229ea29704ac20d..14112c2ae7a6071dc2f3a69e46a10e26d5216bb1 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <string.h>
 
-#include "sqlite3.h"
 #include "zpm.h"
 #include "t/ctap/ctap.h"