Make it possible to disable %pre- and %posttrans scriptlets (rhbz#475582)
authorPanu Matilainen <pmatilai@redhat.com>
Sat, 17 Jan 2009 12:15:50 +0000 (14:15 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Sat, 17 Jan 2009 12:15:50 +0000 (14:15 +0200)
- rpmtransFlags_e is overcrowded, map to "regular" %pre and %post
  scriptlet behavior for now
- split up the transaction flags at some point to permit more precise
  control

lib/transaction.c

index 7259d02..9b7fb12 100644 (file)
@@ -1058,8 +1058,8 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
 
 
     /* Run pre-transaction scripts, but only if there are no known
-     * problems up to this point. */
-    if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_TEST))
+     * problems up to this point and not disabled otherwise. */
+    if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_NOPRE))
          || (rpmpsNumProblems(ts->probs) &&
                (okProbs == NULL || rpmpsTrim(ts->probs, okProbs))))) {
        rpmlog(RPMLOG_DEBUG, "running pre-transaction scripts\n");
@@ -1245,7 +1245,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
     /* Actually install and remove packages */
     rc = rpmtsProcess(ts);
 
-    if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
+    if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_NOPOST))) {
        rpmlog(RPMLOG_DEBUG, "running post-transaction scripts\n");
        runTransScripts(ts, RPMTAG_POSTTRANS);
     }