From: Nathan Wagner Date: Sat, 20 Oct 2018 02:53:35 +0000 (+0000) Subject: add syncfs support for update sync columns X-Git-Tag: v0.2.16~75 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=a4c082eb84ba2313af33892d2869485fd3319902 add syncfs support for update sync columns --- diff --git a/zpm-syncfs.c b/zpm-syncfs.c index d2847cf..218c538 100644 --- a/zpm-syncfs.c +++ b/zpm-syncfs.c @@ -41,7 +41,9 @@ struct nitem { char *dest; char *path; char *hash, *ohash; + char *mds, *omds; char *target; + char *pkglist; /* space separated */ time_t mtime; mode_t mode; int ftype; @@ -481,7 +483,11 @@ static int read_item(struct config *conf, int ncols, char **vals, char **cols, } n->ftype = *val; - n->ohash = COL("hash"); + /* these can be null */ + n->ohash = COL("ohash"); + n->mds = COL("mds"); + n->omds = COL("omds"); + n->pkglist = COL("pkglist"); if (n->ftype == 'r') { n->hash = COL("hash"); @@ -776,6 +782,10 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { /* fhash != ohash, install as dest.zpmnew, warn */ /* TODO handle replacing config file * with config directory */ + /* We don't have the information as to which + * package this is a config file for, so + * we'll need to look it up. + */ if (diffs & D_OHASH) { if (strlen(nitem.dest) > sizeof dest - 8) { return seterror(conf,"config file path too long for install as %s.zpmnew", nitem.dest); @@ -789,12 +799,28 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { /* file exists in filesystem */ if (sametype) { if (mdsame && hashsame) { - fprintf(stderr, "%s should not be an update", nitem.dest); - /* warn, bug in logic. This shouldn't - * occur, because if there is nothing - * to do, it shouldn't be listed - * as an update + /* warn, bug in logic. This shouldn't occur, + * because if there is nothing to do, it + * shouldn't be listed as an update + */ + /* could be an update. We're checking against + * what's actually on disk, not what was + * expected to have been on disk. So, if + * the admin has modified the file, or if + * it had been installed ignoring the user + * 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 */ +#if 0 + fprintf(stderr, "%s should not be an update\n", nitem.dest); + fprintf(stderr, "old hash: %s\n", nitem.ohash); + fprintf(stderr, "new hash: %s\n", nitem.hash); + fprintf(stderr, "old mds: %s\n", nitem.omds); + fprintf(stderr, "new mds: %s\n", nitem.mds); +#endif /* do nothing */ return 0; }