summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2013-04-10 11:31:41 +0300
committerMikhail Kashkarov <m.kashkarov@partner.samsung.com>2018-01-25 15:09:09 +0300
commitf19535e68f6319ffaf104934b14cb12e665859bb (patch)
tree4639d76dda82b06fbfc995d74947bdc2c7a95541
parent079d890dfd09f5c175d05387c05bfdd7e47c66b4 (diff)
downloadrpm-f19535e68f6319ffaf104934b14cb12e665859bb.tar.gz
rpm-f19535e68f6319ffaf104934b14cb12e665859bb.tar.bz2
rpm-f19535e68f6319ffaf104934b14cb12e665859bb.zip
Add scriptlet-specific disablers for %pretrans and %posttranssubmit/tizen_base/20180330.050344
- Previously %pretrans and %posttrans were tied to --nopre and --nopost disablers (since commit 0b2d7775c5e828652e45829f551352b93890bbc8) because back then, there was no room new disablers in rpmtransFlags bitfield. This is no longer the case as of rpm >= 4.9.x where a bunch of obsolete flags were axed, so we can now add specific --nopretrans and --noposttrans switches + corresponding flags. - This is obviously a behavior change as --nopre and --nopost no longer affect %pretrans and %posttrans, but --noscripts behavior remains the same. Change-Id: I7d8ebba44573f0a72a4eecfc8040af86e95409ce
-rw-r--r--doc/rpm.810
-rw-r--r--lib/poptI.c6
-rw-r--r--lib/rpmts.h7
-rw-r--r--lib/transaction.c4
-rw-r--r--python/rpmmodule.c2
5 files changed, 24 insertions, 5 deletions
diff --git a/doc/rpm.8 b/doc/rpm.8
index ee7266504..0a757b3ed 100644
--- a/doc/rpm.8
+++ b/doc/rpm.8
@@ -281,6 +281,10 @@ packages would normally be reordered to satisfy dependencies.
\fB--nopreun\fR
.TP
\fB--nopostun\fR
+.TP
+\fB--nopretrans\fR
+.TP
+\fB--noposttrans\fR
Don't execute the scriptlet of the same name.
The \fB--noscripts\fR option is equivalent to
@@ -288,12 +292,16 @@ The \fB--noscripts\fR option is equivalent to
\fB--nopost\fR
\fB--nopreun\fR
\fB--nopostun\fR
+\fB--nopretrans\fR
+\fB--noposttrans\fR
and turns off the execution of the corresponding
\fB%pre\fR,
\fB%post\fR,
-\fB%preun\fR, and
+\fB%preun\fR,
\fB%postun\fR
+\fB%pretrans\fR, and
+\fB%posttrans\fR
scriptlet(s).
.TP
\fB--notriggers\fR
diff --git a/lib/poptI.c b/lib/poptI.c
index 8c1ff6edb..051f0f56f 100644
--- a/lib/poptI.c
+++ b/lib/poptI.c
@@ -202,6 +202,12 @@ struct poptOption rpmInstallPoptTable[] = {
{ "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
RPMTRANS_FLAG_NOPOSTUN,
N_("do not execute %%postun scriptlet (if any)"), NULL },
+ { "nopretrans", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
+ RPMTRANS_FLAG_NOPRETRANS,
+ N_("do not execute %%pretrans scriptlet (if any)"), NULL },
+ { "noposttrans", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
+ RPMTRANS_FLAG_NOPOSTTRANS,
+ N_("do not execute %%posttrans scriptlet (if any)"), NULL },
{ "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, _noTransTriggers,
N_("do not execute any scriptlet(s) triggered by this package"), NULL},
diff --git a/lib/rpmts.h b/lib/rpmts.h
index 059f46d24..770504443 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -45,7 +45,8 @@ enum rpmtransFlags_e {
RPMTRANS_FLAG_NOPREUN = (1 << 21), /*!< from --nopreun */
RPMTRANS_FLAG_NOPOSTUN = (1 << 22), /*!< from --nopostun */
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23), /*!< from --notriggerpostun */
- /* bits 24-25 unused */
+ RPMTRANS_FLAG_NOPRETRANS = (1 << 24), /*!< from --nopretrans */
+ RPMTRANS_FLAG_NOPOSTTRANS = (1 << 25), /*!< from --noposttrans */
RPMTRANS_FLAG_NOCOLLECTIONS = (1 << 26), /*!< from --nocollections */
RPMTRANS_FLAG_NOMD5 = (1 << 27), /*!< from --nomd5 */
RPMTRANS_FLAG_NOFILEDIGEST = (1 << 27), /*!< from --nofiledigest (alias to --nomd5) */
@@ -60,7 +61,9 @@ typedef rpmFlags rpmtransFlags;
( RPMTRANS_FLAG_NOPRE | \
RPMTRANS_FLAG_NOPOST | \
RPMTRANS_FLAG_NOPREUN | \
- RPMTRANS_FLAG_NOPOSTUN \
+ RPMTRANS_FLAG_NOPOSTUN | \
+ RPMTRANS_FLAG_NOPRETRANS | \
+ RPMTRANS_FLAG_NOPOSTTRANS \
)
#define _noTransTriggers \
diff --git a/lib/transaction.c b/lib/transaction.c
index fa17d34b7..b91953cf8 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1521,7 +1521,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/* Run pre-transaction scripts, but only if there are no known
* problems up to this point and not disabled otherwise. */
- if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_NOPRE))
+ if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_NOPRETRANS))
|| (rpmpsNumProblems(tsprobs)))) {
rpmlog(RPMLOG_DEBUG, "running pre-transaction scripts\n");
runTransScripts(ts, PKG_PRETRANS);
@@ -1557,7 +1557,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
rc = rpmtsProcess(ts) ? -1 : 0;
/* Run post-transaction scripts unless disabled */
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOST))) {
+ if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS))) {
rpmlog(RPMLOG_DEBUG, "running post-transaction scripts\n");
runTransScripts(ts, PKG_POSTTRANS);
}
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index a4fe217dd..4f2c31869 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -415,6 +415,8 @@ static int initModule(PyObject *m)
REGISTER_ENUM(RPMTRANS_FLAG_NOPREUN);
REGISTER_ENUM(RPMTRANS_FLAG_NOPOSTUN);
REGISTER_ENUM(RPMTRANS_FLAG_NOTRIGGERPOSTUN);
+ REGISTER_ENUM(RPMTRANS_FLAG_NOPRETRANS);
+ REGISTER_ENUM(RPMTRANS_FLAG_NOPOSTTRANS);
REGISTER_ENUM(RPMTRANS_FLAG_NOMD5);
REGISTER_ENUM(RPMTRANS_FLAG_NOFILEDIGEST);
REGISTER_ENUM(RPMTRANS_FLAG_NOSUGGEST);