X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-syncfs.c;h=9889c606912875a60381ba243f5c1395591d8927;hb=562d7c77072b14a4db68926ce6c8ac3753a1bad0;hp=c630963030dd001de7bacf2043964f41bfe2b43d;hpb=773a014fd257d8ca3d2f8a25f8bb0b0f04d78d0f;p=zpackage diff --git a/zpm-syncfs.c b/zpm-syncfs.c index c630963..9889c60 100644 --- a/zpm-syncfs.c +++ b/zpm-syncfs.c @@ -841,6 +841,14 @@ static int install(struct config *conf, struct nitem *item, unsigned int flags) source = conf->src ? conf->src : conf->log; + if (mkleading) { + rv = create_leading_dirs(item->dest); + if (!rv) { + setsyserr(conf, "can't create leading dirs for %s", item->dest); + return failure; + } + } + if (unlink_file) { rv = remove_existing(conf, item->dest); } else if (rm_dir) { @@ -851,14 +859,6 @@ static int install(struct config *conf, struct nitem *item, unsigned int flags) return failure; } - if (mkleading) { - rv = create_leading_dirs(item->dest); - if (!rv) { - setsyserr(conf, "can't create leading dirs for %s", item->dest); - return failure; - } - } - errno = 0; switch (item->ftype) { case 'r': rv = zpm_extract(source, item->hash, item->dest, item->mode); @@ -1278,13 +1278,14 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { /* fix md */ return set_md(conf, &nitem); } - if (mdsame && !hashsame) { - /* install */ - return install(conf, &nitem, 3); - } - if (!mdsame && !hashsame) { - /* install */ - return install(conf, &nitem, 3); + + if (!hashsame) { + /* doesn't matter on the md */ + int flags = INS_MD | INS_CLD; + if (nitem.ftype == 'l') { + flags |= INS_UNLINK; + } + return install(conf, &nitem, flags); } } @@ -1319,7 +1320,7 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { if (sametype) { if (mdsame && hashsame && (accept || overwrite)) { /* do nothing */ - if (conf->dryrun || conf->verbose) { + if (conf->dryrun || conf->verbose > 1) { fprintf(stderr, "accept %s: %s\n", eisdir ? "directory" : "file", nitem.dest); }