summaryrefslogtreecommitdiff
path: root/lib/psm.c
diff options
context:
space:
mode:
authorElena Reshetova <elena.reshetova@intel.com>2012-11-30 18:35:44 +0200
committerAnas Nashif <anas.nashif@intel.com>2013-02-02 16:44:45 -0800
commit86e7c4ecfd94737f5ede5cadcc2600ea654c399f (patch)
treef775ce105008011df57ea4eca7d55159bdb253c0 /lib/psm.c
parent78b3ad646be7c502f0e9b7d1b76de76ba50601ca (diff)
downloadlibrpm-tizen-86e7c4ecfd94737f5ede5cadcc2600ea654c399f.tar.gz
librpm-tizen-86e7c4ecfd94737f5ede5cadcc2600ea654c399f.tar.bz2
librpm-tizen-86e7c4ecfd94737f5ede5cadcc2600ea654c399f.zip
Making pre/post tsm/psm hooks more consistent.
-All post hooks take an additional rc argument that indicates general return code from operation. -All post hooks are always called if correspoding pre hook has been called. -The return value from post hooks is curently ignored Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Diffstat (limited to 'lib/psm.c')
-rw-r--r--lib/psm.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/psm.c b/lib/psm.c
index 3e4cf9cca..fcc6749cc 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -1048,21 +1048,22 @@ rpmRC rpmpsmRun(rpmts ts, rpmte te, pkgGoal goal)
case PKG_INSTALL:
case PKG_ERASE:
/* Run pre transaction element hook for all plugins */
- if (rpmpluginsCallPsmPre(ts->plugins, te) == RPMRC_FAIL)
- break;
- op = (goal == PKG_INSTALL) ? RPMTS_OP_INSTALL : RPMTS_OP_ERASE;
- rpmswEnter(rpmtsOp(psm->ts, op), 0);
+ if (rpmpluginsCallPsmPre(ts->plugins, te) != RPMRC_FAIL) {
- rc = rpmpsmNext(psm, PSM_INIT);
- if (!rc) rc = rpmpsmNext(psm, PSM_PRE);
- if (!rc) rc = rpmpsmNext(psm, PSM_PROCESS);
- if (!rc) rc = rpmpsmNext(psm, PSM_POST);
- (void) rpmpsmNext(psm, PSM_FINI);
+ op = (goal == PKG_INSTALL) ? RPMTS_OP_INSTALL : RPMTS_OP_ERASE;
+ rpmswEnter(rpmtsOp(psm->ts, op), 0);
- rpmswExit(rpmtsOp(psm->ts, op), 0);
- /* Run post transaction element hook for all plugins */
- if (!rc) rc = rpmpluginsCallPsmPost(ts->plugins, te);
+ rc = rpmpsmNext(psm, PSM_INIT);
+ if (!rc) rc = rpmpsmNext(psm, PSM_PRE);
+ if (!rc) rc = rpmpsmNext(psm, PSM_PROCESS);
+ if (!rc) rc = rpmpsmNext(psm, PSM_POST);
+ (void) rpmpsmNext(psm, PSM_FINI);
+ rpmswExit(rpmtsOp(psm->ts, op), 0);
+ }
+
+ /* Run post transaction element hook for all plugins */
+ rpmpluginsCallPsmPost(ts->plugins, te, rc);
break;
case PKG_PRETRANS:
case PKG_POSTTRANS: