From 86e7c4ecfd94737f5ede5cadcc2600ea654c399f Mon Sep 17 00:00:00 2001 From: Elena Reshetova Date: Fri, 30 Nov 2012 18:35:44 +0200 Subject: 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 --- lib/psm.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib/psm.c') 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: -- cgit v1.2.3