diff --git a/lib/depends.c b/lib/depends.c index d1e30bbb6..3d70e681c 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -395,6 +395,11 @@ int rpmtsAddInstallElement(rpmts ts, Header h, int ec = 0; int oc = tsmem->orderCount; + if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL) { + ec = 1; + goto exit; + } + /* Check for supported payload format if it's a package */ if (key && headerCheckPayloadFormat(h) != RPMRC_OK) { ec = 1; @@ -462,6 +467,8 @@ exit: int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset) { + if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL) + return 1; return removePackage(ts, h, NULL); } diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index 91818afe5..812a93886 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -92,6 +92,8 @@ rpmal rpmtsCreateAl(rpmts ts, rpmElementTypes types); RPM_GNUC_INTERNAL int rpmtsSolve(rpmts ts, rpmds key); +RPM_GNUC_INTERNAL +rpmRC rpmtsSetupTransactionPlugins(rpmts ts); #ifdef __cplusplus } #endif diff --git a/lib/transaction.c b/lib/transaction.c index 818c6e8db..a8109da61 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1415,13 +1415,21 @@ static int rpmtsProcess(rpmts ts) return rc; } -static rpmRC rpmtsSetupTransactionPlugins(rpmts ts) +rpmRC rpmtsSetupTransactionPlugins(rpmts ts) { rpmRC rc = RPMRC_OK; char *plugins = NULL, *plugin = NULL; const char *delims = ","; rpmPlugins tsplugins; + /* + * Assume allocated equals initialized. There are some oddball cases + * (verification of non-installed package) where this is not true + * currently but that's not a new issue. + */ + if (ts->plugins != NULL) + return RPMRC_OK; + plugins = rpmExpand("%{?__transaction_plugins}", NULL); if (!plugins || rstreq(plugins, "")) { goto exit; @@ -1475,10 +1483,6 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) goto exit; } - if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL) { - goto exit; - } - rpmtsSetupCollections(ts); /* Check package set for problems */