|
Lubos Kardos |
3bf180 |
From 31996808c140496c35e3c9543750026292b72287 Mon Sep 17 00:00:00 2001
|
|
Lubos Kardos |
3bf180 |
From: Lubos Kardos <lkardos@redhat.com>
|
|
Lubos Kardos |
3bf180 |
Date: Mon, 23 Nov 2015 15:05:13 +0100
|
|
Lubos Kardos |
3bf180 |
Subject: [PATCH] Add possibility to disable file triggers.
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
Now options --notriggers, --notriggerin, --notriggerun, --notriggerpostun
|
|
Lubos Kardos |
3bf180 |
disable also file triggers and not only normal trigges. Transaction file
|
|
Lubos Kardos |
3bf180 |
triggers can be also disabled with --nopretrans and --nopostrans options.
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
Before this patch file triggers weren't disabled when option --test was
|
|
Lubos Kardos |
3bf180 |
specified. That caused unwanted multiple execution of file triggers
|
|
Lubos Kardos |
3bf180 |
in dnf because dnf executes transaction with flag test before executing
|
|
Lubos Kardos |
3bf180 |
transaction for real (rhbz:1282115).
|
|
Lubos Kardos |
3bf180 |
---
|
|
Lubos Kardos |
3bf180 |
lib/psm.c | 97 ++++++++++++++++++++++++++++++-------------------------
|
|
Lubos Kardos |
3bf180 |
lib/transaction.c | 16 ++++++---
|
|
Lubos Kardos |
3bf180 |
2 files changed, 65 insertions(+), 48 deletions(-)
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
diff --git a/lib/psm.c b/lib/psm.c
|
|
Lubos Kardos |
3bf180 |
index 154237e..08d4919 100644
|
|
Lubos Kardos |
3bf180 |
--- a/lib/psm.c
|
|
Lubos Kardos |
3bf180 |
+++ b/lib/psm.c
|
|
Lubos Kardos |
3bf180 |
@@ -682,21 +682,24 @@ static rpmRC rpmPackageInstall(rpmts ts, rpmpsm psm)
|
|
Lubos Kardos |
3bf180 |
rc = dbAdd(ts, psm->te);
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run upper file triggers i. e. with higher priorities */
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
-
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERIN)) {
|
|
Lubos Kardos |
3bf180 |
+ /* Run upper file triggers i. e. with higher priorities */
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOST)) {
|
|
Lubos Kardos |
3bf180 |
rc = runInstScript(psm, RPMTAG_POSTIN);
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
}
|
|
Lubos Kardos |
3bf180 |
+
|
|
Lubos Kardos |
3bf180 |
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERIN)) {
|
|
Lubos Kardos |
3bf180 |
/* Run triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
rc = runTriggers(psm, RPMSENSE_TRIGGERIN);
|
|
Lubos Kardos |
3bf180 |
@@ -705,18 +708,18 @@ static rpmRC rpmPackageInstall(rpmts ts, rpmpsm psm)
|
|
Lubos Kardos |
3bf180 |
/* Run triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
rc = runImmedTriggers(psm, RPMSENSE_TRIGGERIN);
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
- }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run lower file triggers i. e. with lower priorities */
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
-
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
+ /* Run lower file triggers i. e. with lower priorities */
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERIN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
rc = markReplacedFiles(psm);
|
|
Lubos Kardos |
3bf180 |
}
|
|
Lubos Kardos |
3bf180 |
@@ -734,17 +737,17 @@ static rpmRC rpmPackageErase(rpmts ts, rpmpsm psm)
|
|
Lubos Kardos |
3bf180 |
rpmswEnter(rpmtsOp(psm->ts, RPMTS_OP_ERASE), 0);
|
|
Lubos Kardos |
3bf180 |
while (once--) {
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) {
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) {
|
|
Lubos Kardos |
3bf180 |
/* Run triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
rc = runImmedTriggers(psm, RPMSENSE_TRIGGERUN);
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
@@ -757,22 +760,26 @@ static rpmRC rpmPackageErase(rpmts ts, rpmpsm psm)
|
|
Lubos Kardos |
3bf180 |
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPREUN))
|
|
Lubos Kardos |
3bf180 |
rc = runInstScript(psm, RPMTAG_PREUN);
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) {
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runImmedFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
- if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
+ if (rc) break;
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
rc = rpmpsmRemove(psm);
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
/* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERPOSTUN)) {
|
|
Lubos Kardos |
3bf180 |
+ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 1);
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOSTUN)) {
|
|
Lubos Kardos |
3bf180 |
rc = runInstScript(psm, RPMTAG_POSTUN);
|
|
Lubos Kardos |
3bf180 |
@@ -783,15 +790,17 @@ static rpmRC rpmPackageErase(rpmts ts, rpmpsm psm)
|
|
Lubos Kardos |
3bf180 |
/* Run triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
rc = runTriggers(psm, RPMSENSE_TRIGGERPOSTUN);
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
- }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN,
|
|
Lubos Kardos |
3bf180 |
- RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
+ /* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
+ rc = runFileTriggers(psm->ts, psm->te, RPMSENSE_TRIGGERPOSTUN,
|
|
Lubos Kardos |
3bf180 |
+ RPMSCRIPT_FILETRIGGER, 2);
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
if (rc) break;
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- /* Prepare post transaction uninstall triggers */
|
|
Lubos Kardos |
3bf180 |
- rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te);
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
|
|
Lubos Kardos |
3bf180 |
+ /* Prepare post transaction uninstall triggers */
|
|
Lubos Kardos |
3bf180 |
+ rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te);
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
rc = dbRemove(ts, psm->te);
|
|
Lubos Kardos |
3bf180 |
}
|
|
Lubos Kardos |
3bf180 |
diff --git a/lib/transaction.c b/lib/transaction.c
|
|
Lubos Kardos |
3bf180 |
index 8f440b7..66888af 100644
|
|
Lubos Kardos |
3bf180 |
--- a/lib/transaction.c
|
|
Lubos Kardos |
3bf180 |
+++ b/lib/transaction.c
|
|
Lubos Kardos |
3bf180 |
@@ -1488,7 +1488,9 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
|
|
Lubos Kardos |
3bf180 |
goto exit;
|
|
Lubos Kardos |
3bf180 |
}
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
- if (!rpmpsNumProblems(tsprobs)) {
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_NOPRETRANS|
|
|
Lubos Kardos |
3bf180 |
+ RPMTRANS_FLAG_NOTRIGGERUN) || rpmpsNumProblems(tsprobs))) {
|
|
Lubos Kardos |
3bf180 |
+
|
|
Lubos Kardos |
3bf180 |
/* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
runFileTriggers(ts, NULL, RPMSENSE_TRIGGERUN,
|
|
Lubos Kardos |
3bf180 |
RPMSCRIPT_TRANSFILETRIGGER, 0);
|
|
Lubos Kardos |
3bf180 |
@@ -1541,11 +1543,17 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
|
|
Lubos Kardos |
3bf180 |
}
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
/* Run file triggers in other package(s) this package sets off. */
|
|
Lubos Kardos |
3bf180 |
- runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0);
|
|
Lubos Kardos |
3bf180 |
- runPostUnTransFileTrigs(ts);
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
|
|
Lubos Kardos |
3bf180 |
+ runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0);
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
|
|
Lubos Kardos |
3bf180 |
+ runPostUnTransFileTrigs(ts);
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
|
|
Lubos Kardos |
3bf180 |
/* Run file triggers in this package other package(s) set off. */
|
|
Lubos Kardos |
3bf180 |
- runTransScripts(ts, PKG_TRANSFILETRIGGERIN);
|
|
Lubos Kardos |
3bf180 |
+ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
|
|
Lubos Kardos |
3bf180 |
+ runTransScripts(ts, PKG_TRANSFILETRIGGERIN);
|
|
Lubos Kardos |
3bf180 |
+ }
|
|
Lubos Kardos |
3bf180 |
exit:
|
|
Lubos Kardos |
3bf180 |
/* Run post transaction hook for all plugins */
|
|
Lubos Kardos |
3bf180 |
if (TsmPreDone) /* If TsmPre hook has been called, call the TsmPost hook */
|
|
Lubos Kardos |
3bf180 |
--
|
|
Lubos Kardos |
3bf180 |
1.9.3
|
|
Lubos Kardos |
3bf180 |
|