summaryrefslogtreecommitdiff
path: root/lib/fsm.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-04-24 13:48:11 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-04-24 13:48:11 +0300
commitdc71b7ef15d43051683bcd8bac973af10b763732 (patch)
tree862c5158a6205563429c9f10f627938126ace761 /lib/fsm.c
parent015a34e0df0f74006b48d76eae72cfdbe9121018 (diff)
downloadlibrpm-tizen-dc71b7ef15d43051683bcd8bac973af10b763732.tar.gz
librpm-tizen-dc71b7ef15d43051683bcd8bac973af10b763732.tar.bz2
librpm-tizen-dc71b7ef15d43051683bcd8bac973af10b763732.zip
Clean up file backup logic a bit
- Ghosts are never backed up, and the whole business is irrelevant for package building. Use fsm goal instead of rpmte mode to determine what to do, rpmte in build code is nothing but an ugly hack.
Diffstat (limited to 'lib/fsm.c')
-rw-r--r--lib/fsm.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/fsm.c b/lib/fsm.c
index 981c33b0f..da34bf704 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -447,25 +447,23 @@ static int fsmMapPath(FSM_t fsm)
fsm->dirName = rpmfiDNIndex(fi, rpmfiDIIndex(fi, i));
fsm->baseName = rpmfiBNIndex(fi, i);
- if (rpmteType(te) == TR_ADDED) {
- switch (fsm->action) {
- case FA_ALTNAME:
- if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
- fsm->nsuffix = SUFFIX_RPMNEW;
- break;
- case FA_SAVE:
- if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
- fsm->osuffix = SUFFIX_RPMSAVE;
- break;
- default:
- break;
- }
- }
-
- if (fsm->action == FA_BACKUP && !(fsm->fflags & RPMFILE_GHOST)) {
- /* XXX Don't if %ghost file. */
- fsm->osuffix = (rpmteType(te) == TR_ADDED) ? SUFFIX_RPMORIG : SUFFIX_RPMSAVE;
- }
+ /* Never create backup for %ghost files. */
+ if (fsm->goal != FSM_PKGBUILD && !(fsm->fflags & RPMFILE_GHOST)) {
+ switch (fsm->action) {
+ case FA_ALTNAME:
+ fsm->nsuffix = SUFFIX_RPMNEW;
+ break;
+ case FA_SAVE:
+ fsm->osuffix = SUFFIX_RPMSAVE;
+ break;
+ case FA_BACKUP:
+ fsm->osuffix = (fsm->goal == FSM_PKGINSTALL) ?
+ SUFFIX_RPMORIG : SUFFIX_RPMSAVE;
+ break;
+ default:
+ break;
+ }
+ }
if ((fsm->mapFlags & CPIO_MAP_PATH) || fsm->nsuffix) {
fsm->path = _free(fsm->path);