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.
This commit is contained in:
parent
015a34e0df
commit
dc71b7ef15
14
lib/fsm.c
14
lib/fsm.c
|
@ -447,26 +447,24 @@ static int fsmMapPath(FSM_t fsm)
|
|||
fsm->dirName = rpmfiDNIndex(fi, rpmfiDIIndex(fi, i));
|
||||
fsm->baseName = rpmfiBNIndex(fi, i);
|
||||
|
||||
if (rpmteType(te) == TR_ADDED) {
|
||||
/* Never create backup for %ghost files. */
|
||||
if (fsm->goal != FSM_PKGBUILD && !(fsm->fflags & RPMFILE_GHOST)) {
|
||||
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;
|
||||
case FA_BACKUP:
|
||||
fsm->osuffix = (fsm->goal == FSM_PKGINSTALL) ?
|
||||
SUFFIX_RPMORIG : 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;
|
||||
}
|
||||
|
||||
if ((fsm->mapFlags & CPIO_MAP_PATH) || fsm->nsuffix) {
|
||||
fsm->path = _free(fsm->path);
|
||||
fsm->path = fsmFsPath(fsm, S_ISDIR(fsm->sb.st_mode),
|
||||
|
|
Loading…
Reference in New Issue