diff options
-rw-r--r-- | build/pack.c | 8 | ||||
-rw-r--r-- | lib/fsm.c | 9 | ||||
-rw-r--r-- | lib/fsm.h | 1 | ||||
-rw-r--r-- | lib/psm.c | 6 |
4 files changed, 17 insertions, 7 deletions
diff --git a/build/pack.c b/build/pack.c index 29e1d0524..71ff1b15a 100644 --- a/build/pack.c +++ b/build/pack.c @@ -29,6 +29,7 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, { rpmts ts = rpmtsCreate(); rpmfi fi = csa->cpioList; + rpmte te = NULL; char *failedFile = NULL; FD_t cfd; rpmRC rc = RPMRC_OK; @@ -44,7 +45,11 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, if (cfd == NULL) return RPMRC_FAIL; - xx = fsmSetup(rpmfiFSM(fi), FSM_PKGBUILD, ts, fi, cfd, + /* make up a transaction element for passing to fsm */ + rpmtsAddInstallElement(ts, h, NULL, 0, NULL); + te = rpmtsElement(ts, 0); + + xx = fsmSetup(rpmfiFSM(fi), FSM_PKGBUILD, ts, te, fi, cfd, &csa->cpioArchiveSize, &failedFile); if (xx) rc = RPMRC_FAIL; @@ -61,6 +66,7 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, cpioStrerror(rc)); rc = RPMRC_FAIL; } + rpmtsEmpty(ts); failedFile = _free(failedFile); ts = rpmtsFree(ts); @@ -46,6 +46,7 @@ struct hardLink_s { */ struct fsmIterator_s { rpmts ts; /*!< transaction set. */ + rpmte te; /*!< transaction element. */ rpmfi fi; /*!< transaction element file info. */ int reverse; /*!< reversed traversal? */ int isave; /*!< last returned iterator index. */ @@ -133,6 +134,7 @@ static void * mapFreeIterator(void * p) if (iter) { /* XXX rpmswExit() */ iter->ts = rpmtsFree(iter->ts); + iter->te = NULL; /* XXX rpmte is not refcounted yet */ iter->fi = rpmfiUnlink(iter->fi, RPMDBG_M("mapFreeIterator")); } return _free(p); @@ -145,12 +147,13 @@ static void * mapFreeIterator(void * p) * @return file info iterator */ static void * -mapInitIterator(rpmts ts, rpmfi fi) +mapInitIterator(rpmts ts, rpmte te, rpmfi fi) { FSMI_t iter = NULL; iter = xcalloc(1, sizeof(*iter)); iter->ts = rpmtsLink(ts, RPMDBG_M("mapIterator")); + iter->te = te; /* XXX rpmte is not refcounted yet */ iter->fi = rpmfiLink(fi, RPMDBG_M("mapIterator")); iter->reverse = (rpmteType(fi->te) == TR_REMOVED); iter->i = (iter->reverse ? (fi->fc - 1) : 0); @@ -509,7 +512,7 @@ FSM_t freeFSM(FSM_t fsm) } int fsmSetup(FSM_t fsm, fileStage goal, - rpmts ts, rpmfi fi, FD_t cfd, + rpmts ts, rpmte te, rpmfi fi, FD_t cfd, rpm_loff_t * archiveSize, char ** failedFile) { rpm_loff_t pos = 0; @@ -521,7 +524,7 @@ int fsmSetup(FSM_t fsm, fileStage goal, pos = fdGetCpioPos(fsm->cfd); fdSetCpioPos(fsm->cfd, 0); } - fsm->iter = mapInitIterator(ts, fi); + fsm->iter = mapInitIterator(ts, te, fi); fsm->digestalgo = fi->digestalgo; if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) { @@ -199,6 +199,7 @@ FSM_t freeFSM(FSM_t fsm); */ int fsmSetup(FSM_t fsm, fileStage goal, rpmts ts, + rpmte te, rpmfi fi, FD_t cfd, rpm_loff_t * archiveSize, @@ -1335,7 +1335,7 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage) break; } - rc = fsmSetup(rpmfiFSM(fi), FSM_PKGINSTALL, ts, fi, + rc = fsmSetup(rpmfiFSM(fi), FSM_PKGINSTALL, ts, psm->te, fi, psm->cfd, NULL, &psm->failedFile); (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), fdOp(psm->cfd, FDSTAT_READ)); @@ -1393,7 +1393,7 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage) psm->total = fc; xx = rpmpsmNext(psm, PSM_NOTIFY); - rc = fsmSetup(rpmfiFSM(fi), FSM_PKGERASE, ts, fi, + rc = fsmSetup(rpmfiFSM(fi), FSM_PKGERASE, ts, psm->te, fi, NULL, NULL, &psm->failedFile); xx = fsmTeardown(rpmfiFSM(fi)); @@ -1540,7 +1540,7 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage) if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_PKGCOMMIT)) break; if (rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break; - rc = fsmSetup(rpmfiFSM(fi), FSM_PKGCOMMIT, ts, fi, + rc = fsmSetup(rpmfiFSM(fi), FSM_PKGCOMMIT, ts, psm->te, fi, NULL, NULL, &psm->failedFile); xx = fsmTeardown(rpmfiFSM(fi)); break; |