]> pd.if.org Git - zpackage/commitdiff
fix some todo items
authorNathan Wagner <nw@hydaspes.if.org>
Mon, 11 Feb 2019 13:55:38 +0000 (13:55 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 11 Feb 2019 13:55:38 +0000 (13:55 +0000)
zpm-add.c
zpm-parse.c
zpm-syncfs.c

index d72a7896a9aed277b37b57cf100b1978dff6d76d..86b289d9748d836aff391c7ef4f32f6f3d20bb4c 100644 (file)
--- a/zpm-add.c
+++ b/zpm-add.c
@@ -440,7 +440,6 @@ int main(int ac, char **av) {
        char *pkgid;
        pkgstr = av[optind++];
        pkgid = zpm_findpkg(&zpm, pkgstr, NULL);
-       /* TODO if not found, error */
        if (!pkgid) {
                die("package %s not found\n", pkgstr);
        }
index ec053567aa61bba98f3a5381d2111349df1301ac..896dba91d9aeee4f347a838da7a72abbd851bdfa 100644 (file)
@@ -36,10 +36,11 @@ int main(int ac, char **av) {
        pver = pver || pdefault;
        prel = prel || pdefault;
 
-       /* TODO need to quote single quotes for eval'able output */
        for (i=optind; i<ac; i++) {
                printed = 0;
                found = zpm_parse_package(av[i], name, ver, &rel);
+               /* single quotes aren't allowed, so a simple single quote
+                * is sufficient for eval */
                if (found >= 1 && pname) {
                        if (eval) {
                                printf("name='%s'\n", name);
index 0e82b13b87a91c727c2c1c95bcbd35ab969ae260..220ee039c38ab0428266f29e8c2e8d5580bc16c4 100644 (file)
@@ -697,7 +697,9 @@ static int remove_files(void *f, int ncols, char **vals, char **cols) {
        if (lstat(dest, &st) == -1) {
                switch (errno) {
                        case ENOENT:
-                               /* TODO chatter if verbose */
+                               if (conf->verbose > 1) {
+                                       fprintf(stderr, "expected file not found: '%s'\n", dest);
+                               }
                                break;
                        default:
                                return seterror(conf, "can't stat %s: %s", dest, strerror(errno));
@@ -721,7 +723,7 @@ static int remove_files(void *f, int ncols, char **vals, char **cols) {
                                break;
                        case ENOTEMPTY: /* fall through */
                        case EEXIST:
-                               /* TODO chatter, or possibly require */
+                               fprintf(stderr, "expected empty directory: %s\n", dest);
                                break;
                        default:
                                return seterror(conf, "can't unlink %s: %s", dest, strerror(errno));
@@ -939,7 +941,7 @@ static int adjust_for_config(struct nitem *n, unsigned int diffs) {
        int isdir = (diffs & D_ISDIR);
        int eisdir = (diffs & D_EISDIR);
        
-       /* TODO what if old was a directory? */
+       /* what if old was a directory? */
        if (!n->configuration) {
                /* replacing conf with non-conf */
                /* absorb file, mark todo */
@@ -1157,7 +1159,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
        struct stat existing;
        int update = 0;
 
-       /* TODO put the result row in a hash table.  May not actually
+       /* put the result row in a hash table?  May not actually
         * be faster
         */
        if (!read_item(conf, ncols, vals, cols, &nitem)) {
@@ -1260,6 +1262,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
                                 * and group, it might be correct on disk
                                 * but not as in the local database
                                 */
+
                                /* TODO detect whether this a logic bug or
                                 * an on-disk difference
                                 */
@@ -1331,7 +1334,9 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
                        }
 
                        if (!mdsame && isdir && conf->ignoredirmd) {
-                               /* TODO warn ignoring dir md */
+                               if (conf->verbose > 1) {
+                                       fprintf(stderr, "ignoring directory metadata difference: %s\n", nitem.dest);
+                               }
                                return 0;
                        }
 
@@ -1393,7 +1398,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
                                /* error */
                                return seterror(conf, "%s (md+hash): %s", accept ? "existing file not acceptable" : "file exists", nitem.dest);
                        }
-                       /* TODO error, should be impossible */
+                       /* error, should be impossible */
                        return seterror(conf, "impossible state reached");
                }
 
@@ -1412,9 +1417,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
                /* existing path is a directory */
                if (isdir) {
                        /* fix md */
-                       /* impossible, if isdir and eisdir, would
-                        * be same type
-                        * TODO
+                       /* impossible, if isdir and eisdir, would be same type
                         */
                        return set_md(conf, &nitem);
                } else {
@@ -1423,12 +1426,10 @@ static int install_files(void *f, int ncols, char **vals, char **cols) {
                        return install(conf, &nitem, 11);
                }
                /* if we get here, we missed a case */
-               /* TODO error */
                return seterror(conf, "impossible state 2 reached");
        }
 
-       /* TODO extra verbose print perms, mtime, etc, probably ls -l
-        * format
+       /* TODO extra verbose print perms, mtime, etc, probably ls -l format
         */ 
        if (conf->verbose) {
                printf("%s\n", nitem.path);
@@ -1586,12 +1587,10 @@ int main(int ac, char **av) {
 
        localdbfile = ZPM_LOCAL_DB;
        if ((s = getenv("ZPMDB"))) {
-               /* TODO does this need to be copied ? */
                localdbfile = s;
        }
 
        if ((s = getenv("ZPM_ROOT_DIR"))) {
-               /* TODO does this need to be copied ? */
                conf.rootdir = s;
        }
 
@@ -1647,8 +1646,6 @@ int main(int ac, char **av) {
                }
        }
 
-       /* TODO find pkgid from arg */
-
        /* TODO set conf var to finalize error reporting */
        if (conf.verbose) {
                fprintf(stderr, "syncing filesystem %s (ldb %s) from %s\n",