/* * Run pre/post transaction scripts for transaction set * param ts Transaction set * param goal PKG_PRETRANS/PKG_POSTTRANS * return 0 on success */ static int runTransScripts(rpmts ts, pkgGoal goal) { rpmte p; rpmtsi pi = rpmtsiInit(ts); while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) { rpmteProcess(p, goal); } pi = rpmtsiFree(pi); return 0; /* what to do about failures? */ }
/* * Run pre/post transaction scripts for transaction set * param ts Transaction set * param goal PKG_PRETRANS/PKG_POSTTRANS * return 0 on success */ static int runTransScripts(rpmts ts, pkgGoal goal) { int rc = 0; rpmte p; rpmtsi pi = rpmtsiInit(ts); while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) { rc += rpmteProcess(p, goal); } rpmtsiFree(pi); return rc; }
/* * Run pre/post transaction scripts for transaction set * param ts Transaction set * param goal PKG_PRETRANS/PKG_POSTTRANS * return 0 on success */ static int runTransScripts(rpmts ts, pkgGoal goal) { int rc = 0; rpmte p; rpmtsi pi = rpmtsiInit(ts); rpmElementTypes types = TR_ADDED; if (goal == PKG_TRANSFILETRIGGERUN) types = TR_REMOVED; while ((p = rpmtsiNext(pi, types)) != NULL) { rc += rpmteProcess(p, goal); } rpmtsiFree(pi); return rc; }
/* * Transaction main loop: install and remove packages */ static int rpmtsProcess(rpmts ts) { rpmtsi pi; rpmte p; int rc = 0; pi = rpmtsiInit(ts); while ((p = rpmtsiNext(pi, 0)) != NULL) { int failed; rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n", rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p)); failed = rpmteProcess(p, rpmteType(p)); if (failed) { rpmlog(RPMLOG_ERR, "%s: %s %s\n", rpmteNEVRA(p), rpmteTypeString(p), failed > 1 ? _("skipped") : _("failed")); rc++; } } rpmtsiFree(pi); return rc; }