Cpio flags are only relevant for fsm, get them out of rpmfi
This commit is contained in:
parent
0d168d173a
commit
fbc06059cb
|
@ -485,9 +485,10 @@ static void * freeHardLink(hardLink_t li)
|
|||
return _free(li);
|
||||
}
|
||||
|
||||
FSM_t newFSM(void)
|
||||
FSM_t newFSM(cpioMapFlags mapflags)
|
||||
{
|
||||
FSM_t fsm = xcalloc(1, sizeof(*fsm));
|
||||
fsm->mapFlags = mapflags;
|
||||
return fsm;
|
||||
}
|
||||
|
||||
|
@ -623,7 +624,6 @@ static int fsmMapPath(FSM_t fsm)
|
|||
fsm->nsuffix = NULL;
|
||||
fsm->astriplen = 0;
|
||||
fsm->action = FA_UNKNOWN;
|
||||
fsm->mapFlags = 0;
|
||||
|
||||
i = fsm->ix;
|
||||
if (fi && i >= 0 && i < fi->fc) {
|
||||
|
@ -631,7 +631,6 @@ static int fsmMapPath(FSM_t fsm)
|
|||
fsm->astriplen = fi->astriplen;
|
||||
fsm->action = (fi->actions ? fi->actions[i] : fi->action);
|
||||
fsm->fflags = (fi->fflags ? fi->fflags[i] : fi->flags);
|
||||
fsm->mapFlags = fi->mapflags;
|
||||
|
||||
/* src rpms have simple base name in payload. */
|
||||
fsm->dirName = fi->dnl[fi->dil[i]];
|
||||
|
|
|
@ -174,10 +174,11 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* Create file state machine instance.
|
||||
* @param mapflags CPIO map flags to use
|
||||
* @return file state machine
|
||||
*/
|
||||
RPM_GNUC_INTERNAL
|
||||
FSM_t newFSM(void);
|
||||
FSM_t newFSM(cpioMapFlags mapflags);
|
||||
|
||||
/**
|
||||
* Destroy file state machine instance.
|
||||
|
|
20
lib/rpmfi.c
20
lib/rpmfi.c
|
@ -1196,6 +1196,8 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
|
|||
const char * Type;
|
||||
rpm_loff_t *asize = NULL;
|
||||
unsigned char * t;
|
||||
cpioMapFlags mapflags;
|
||||
int isBuild, isSource;
|
||||
struct rpmtd_s fdigests, digalgo;
|
||||
struct rpmtd_s td;
|
||||
headerGetFlags scareFlags = (flags & RPMFI_KEEPHEADER) ?
|
||||
|
@ -1223,15 +1225,16 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
|
|||
fi->keep_header = (flags & RPMFI_KEEPHEADER);
|
||||
fi->h = fi->keep_header ? headerLink(h) : NULL;
|
||||
|
||||
if (fi->fsm == NULL)
|
||||
fi->fsm = newFSM();
|
||||
|
||||
if (headerGet(h, RPMTAG_LONGARCHIVESIZE, &td, HEADERGET_EXT)) {
|
||||
asize = rpmtdGetUint64(&td);
|
||||
}
|
||||
/* 0 means unknown */
|
||||
fi->archiveSize = asize ? *asize : 0;
|
||||
rpmtdFreeData(&td);
|
||||
|
||||
/* Archive size is not set when this gets called from build */
|
||||
isBuild = (asize == NULL);
|
||||
isSource = headerIsSource(h);
|
||||
|
||||
/* See if we have pre/posttrans scripts. */
|
||||
fi->transscripts |= (headerIsEntry(h, RPMTAG_PRETRANS) &&
|
||||
|
@ -1292,13 +1295,14 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
|
|||
* - if archive size is not known, we're only building this package,
|
||||
* different rules apply
|
||||
*/
|
||||
fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
||||
if (asize) {
|
||||
if (!headerIsSource(h)) fi->mapflags |= CPIO_SBIT_CHECK;
|
||||
mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
||||
if (isBuild) {
|
||||
mapflags |= CPIO_MAP_TYPE;
|
||||
if (isSource) mapflags |= CPIO_FOLLOW_SYMLINKS;
|
||||
} else {
|
||||
fi->mapflags |= CPIO_MAP_TYPE;
|
||||
if (headerIsSource(h)) fi->mapflags |= CPIO_FOLLOW_SYMLINKS;
|
||||
if (!isSource) mapflags |= CPIO_SBIT_CHECK;
|
||||
}
|
||||
fi->fsm = newFSM(mapflags);
|
||||
|
||||
_hgfi(h, RPMTAG_FILELINKTOS, &td, defFlags, fi->flinks);
|
||||
_hgfi(h, RPMTAG_FILELANGS, &td, defFlags, fi->flangs);
|
||||
|
|
|
@ -101,7 +101,6 @@ struct rpmfi_s {
|
|||
size_t striplen;
|
||||
rpm_loff_t archiveSize;
|
||||
const char ** apath;
|
||||
cpioMapFlags mapflags;
|
||||
FSM_t fsm; /*!< File state machine data. */
|
||||
int keep_header; /*!< Keep header? */
|
||||
sharedFileInfo replaced; /*!< (TR_ADDED) */
|
||||
|
|
Loading…
Reference in New Issue