diff options
author | Pavlina Moravcova Varekova <pmoravco@redhat.com> | 2017-03-10 12:06:43 +0100 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2017-03-17 13:50:33 +0200 |
commit | 79ca74e15e15c1d91a9a31a9ee90abc91736f390 (patch) | |
tree | 1ef6798e531c74d384901c5161245708a893e3ff | |
parent | 61737f3f154bfe786e7a8ba1d813baf0191351b0 (diff) | |
download | rpm-79ca74e15e15c1d91a9a31a9ee90abc91736f390.tar.gz |
Add file disposition FA_TOUCH
Installation of FA_TOUCH item only upgrades its metadata.
-rw-r--r-- | lib/fsm.c | 14 | ||||
-rw-r--r-- | lib/rpmfiles.h | 1 |
2 files changed, 12 insertions, 3 deletions
@@ -790,6 +790,7 @@ static const char * fileActionString(rpmFileAction a) case FA_SKIPNSTATE: return "skipnstate"; case FA_SKIPNETSHARED: return "skipnetshared"; case FA_SKIPCOLOR: return "skipcolor"; + case FA_TOUCH: return "touch"; default: return "???"; } } @@ -807,6 +808,9 @@ static void setFileState(rpmfs fs, int i) case FA_SKIPCOLOR: rpmfsSetState(fs, i, RPMFILE_STATE_WRONGCOLOR); break; + case FA_TOUCH: + rpmfsSetState(fs, i, RPMFILE_STATE_NORMAL); + break; default: break; } @@ -854,7 +858,11 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, action = rpmfsGetAction(fs, rpmfiFX(fi)); skip = XFA_SKIPPING(action); suffix = S_ISDIR(rpmfiFMode(fi)) ? NULL : tid; - fpath = fsmFsPath(fi, suffix); + if (action != FA_TOUCH) { + fpath = fsmFsPath(fi, suffix); + } else { + fpath = fsmFsPath(fi, ""); + } /* Remap file perms, owner, and group. */ rc = rpmfiStat(fi, 1, &sb); @@ -885,7 +893,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, if (!suffix) { rc = fsmVerify(fpath, fi); } else { - rc = RPMERR_ENOENT; + rc = (action == FA_TOUCH) ? 0 : RPMERR_ENOENT; } if (S_ISREG(sb.st_mode)) { @@ -937,7 +945,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, if (rc) { if (!skip) { /* XXX only erase if temp fn w suffix is in use */ - if (suffix) { + if (suffix && (action != FA_TOUCH)) { (void) fsmRemove(fpath, sb.st_mode); } errno = saveerrno; diff --git a/lib/rpmfiles.h b/lib/rpmfiles.h index 961adf6f9..4dba88fc4 100644 --- a/lib/rpmfiles.h +++ b/lib/rpmfiles.h @@ -82,6 +82,7 @@ typedef enum rpmFileAction_e { FA_SKIPNSTATE = 9, /*!< ... untouched, state "not installed". */ FA_SKIPNETSHARED = 10, /*!< ... untouched, state "netshared". */ FA_SKIPCOLOR = 11, /*!< ... untouched, state "wrong color". */ + FA_TOUCH = 12, /*!< ... change metadata only. */ /* bits 16-31 reserved */ } rpmFileAction; |