summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-01-05 14:24:33 +0200
committerPanu Matilainen <pmatilai@redhat.com>2012-01-05 16:05:10 +0200
commitef75cadf038ab919f3ec37cf5c5ee77fd52b5c82 (patch)
treee50e59d9a2605df0eddd90e8b190e7575eadd32c
parent91a58bd423da4841e0b2fb569599f19f61e95174 (diff)
downloadlibrpm-tizen-ef75cadf038ab919f3ec37cf5c5ee77fd52b5c82.tar.gz
librpm-tizen-ef75cadf038ab919f3ec37cf5c5ee77fd52b5c82.tar.bz2
librpm-tizen-ef75cadf038ab919f3ec37cf5c5ee77fd52b5c82.zip
Pass and remember the controlling psm (if any) in fsm
-rw-r--r--build/pack.c2
-rw-r--r--lib/fsm.c3
-rw-r--r--lib/fsm.h5
-rw-r--r--lib/psm.c7
4 files changed, 12 insertions, 5 deletions
diff --git a/build/pack.c b/build/pack.c
index af3af9a5f..194cc675d 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -64,7 +64,7 @@ static rpmRC cpio_doio(FD_t fdo, Header h, CSA_t csa, const char * fmodeMacro)
rpmfsSetAction(fs, i, FA_COPYOUT);
}
- if (fsmSetup(rpmfiFSM(fi), FSM_PKGBUILD, ts, te, fi, cfd,
+ if (fsmSetup(rpmfiFSM(fi), FSM_PKGBUILD, ts, te, fi, cfd, NULL,
&csa->cpioArchiveSize, &failedFile))
rc = RPMRC_FAIL;
diff --git a/lib/fsm.c b/lib/fsm.c
index 76f607ed3..8ef4b7044 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -613,7 +613,7 @@ static int fsmCreate(FSM_t fsm)
}
int fsmSetup(FSM_t fsm, fileStage goal,
- rpmts ts, rpmte te, rpmfi fi, FD_t cfd,
+ rpmts ts, rpmte te, rpmfi fi, FD_t cfd, rpmpsm psm,
rpm_loff_t * archiveSize, char ** failedFile)
{
int rc, ec = 0;
@@ -625,6 +625,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
fsm->cpioPos = 0;
fsm->iter = mapInitIterator(ts, te, fi);
fsm->digestalgo = rpmfiDigestAlgo(fi);
+ fsm->psm = psm;
if (fsm->goal == FSM_PKGINSTALL) {
fsm->archivePos = 0;
diff --git a/lib/fsm.h b/lib/fsm.h
index 22aa935a4..5d33fce0b 100644
--- a/lib/fsm.h
+++ b/lib/fsm.h
@@ -104,6 +104,7 @@ typedef rpmFlags cpioMapFlags;
typedef struct fsmIterator_s * FSMI_t;
typedef struct fsm_s * FSM_t;
+typedef struct rpmpsm_s * rpmpsm;
typedef struct hardLink_s * hardLink_t;
@@ -163,6 +164,8 @@ struct fsm_s {
fileStage nstage; /*!< Next file stage. */
struct stat sb; /*!< Current file stat(2) info. */
struct stat osb; /*!< Original file stat(2) info. */
+
+ rpmpsm psm; /*!< "parent" package state machine */
};
#ifdef __cplusplus
@@ -192,6 +195,7 @@ FSM_t freeFSM(FSM_t fsm);
* @param ts transaction set
* @param fi transaction element file info
* @param cfd
+ * @param psm owner psm (or NULL)
* @retval archiveSize pointer to archive size
* @retval failedFile pointer to first file name that failed (malloced)
* @return 0 on success
@@ -201,6 +205,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
rpmte te,
rpmfi fi,
FD_t cfd,
+ rpmpsm psm,
rpm_loff_t * archiveSize,
char ** failedFile);
diff --git a/lib/psm.c b/lib/psm.c
index c23816a66..36bdebd59 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -49,7 +49,7 @@ typedef enum pkgStage_e {
} pkgStage;
-typedef struct rpmpsm_s {
+struct rpmpsm_s {
rpmts ts; /*!< transaction set */
rpmte te; /*!< current transaction element */
rpmfi fi; /*!< transaction element file info */
@@ -68,7 +68,7 @@ typedef struct rpmpsm_s {
pkgStage nstage; /*!< Next psm stage. */
int nrefs; /*!< Reference count. */
-} * rpmpsm;
+};
static rpmpsm rpmpsmNew(rpmts ts, rpmte te);
static rpmpsm rpmpsmFree(rpmpsm psm);
@@ -661,7 +661,8 @@ static int runFsm(rpmpsm psm, FD_t payload)
sc = fsmSetup(rpmfiFSM(psm->fi),
(psm->goal == PKG_INSTALL) ? FSM_PKGINSTALL : FSM_PKGERASE,
- psm->ts, psm->te, psm->fi, payload, NULL, &psm->failedFile);
+ psm->ts, psm->te, psm->fi, payload, psm,
+ NULL, &psm->failedFile);
if (psm->goal == PKG_INSTALL) {
rpmswAdd(rpmtsOp(psm->ts, RPMTS_OP_UNCOMPRESS),
fdOp(payload, FDSTAT_READ));