dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
2a5b6a
From 454285b3a259c6bbf5fee4300fac2f50a40e4ac4 Mon Sep 17 00:00:00 2001
2a5b6a
From: Panu Matilainen <pmatilai@redhat.com>
2a5b6a
Date: Tue, 24 Jun 2014 15:11:32 +0300
2a5b6a
Subject: [PATCH] Add disabler flag + --noplugins cli switch for plugins
2a5b6a
2a5b6a
- Always knew we'd need a plugin disabler flag sooner than later but
2a5b6a
  didn't realize enabled plugins would fail basically the entire
2a5b6a
  test-suite :)
2a5b6a
- Enable --noplugins for entire test-suite for now, but eventually
2a5b6a
  we'll need to come up with ways to test plugins as well
2a5b6a
---
2a5b6a
 lib/poptALL.c      | 5 +++++
2a5b6a
 lib/rpmts.h        | 2 +-
2a5b6a
 lib/transaction.c  | 2 +-
2a5b6a
 python/rpmmodule.c | 1 +
2a5b6a
 tests/atlocal.in   | 2 +-
2a5b6a
 5 files changed, 9 insertions(+), 3 deletions(-)
2a5b6a
2a5b6a
diff --git a/lib/poptALL.c b/lib/poptALL.c
2a5b6a
index 31e1210..2e894e0 100644
2a5b6a
--- a/lib/poptALL.c
2a5b6a
+++ b/lib/poptALL.c
2a5b6a
@@ -187,6 +187,11 @@ struct poptOption rpmcliAllPoptTable[] = {
2a5b6a
 	N_("read <FILE:...> instead of default file(s)"),
2a5b6a
 	N_("<FILE:...>") },
2a5b6a
 
2a5b6a
+ /* XXX this is a bit out of place here but kinda unavoidable... */
2a5b6a
+ { "noplugins", '\0', POPT_BIT_SET,
2a5b6a
+	&rpmIArgs.transFlags, RPMTRANS_FLAG_NOPLUGINS,
2a5b6a
+	N_("don't enable any plugins"), NULL },
2a5b6a
+
2a5b6a
  { "nodigest", '\0', 0, 0, RPMCLI_POPT_NODIGEST,
2a5b6a
         N_("don't verify package digest(s)"), NULL },
2a5b6a
  { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOHDRCHK,
2a5b6a
diff --git a/lib/rpmts.h b/lib/rpmts.h
2a5b6a
index e1b260d..5231c80 100644
2a5b6a
--- a/lib/rpmts.h
2a5b6a
+++ b/lib/rpmts.h
2a5b6a
@@ -34,7 +34,7 @@ enum rpmtransFlags_e {
2a5b6a
     RPMTRANS_FLAG_NOTRIGGERS	= (1 <<  4),	/*!< from --notriggers */
2a5b6a
     RPMTRANS_FLAG_NODOCS	= (1 <<  5),	/*!< from --excludedocs */
2a5b6a
     RPMTRANS_FLAG_ALLFILES	= (1 <<  6),	/*!< from --allfiles */
2a5b6a
-    /* bit 7 unused */
2a5b6a
+    RPMTRANS_FLAG_NOPLUGINS	= (1 <<  7),	/*!< from --noplugins */
2a5b6a
     RPMTRANS_FLAG_NOCONTEXTS	= (1 <<  8),	/*!< from --nocontexts */
2a5b6a
     /* bits 9-15 unused */
2a5b6a
     RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16),	/*!< from --notriggerprein */
2a5b6a
diff --git a/lib/transaction.c b/lib/transaction.c
2a5b6a
index 0317c1e..736f64d 100644
2a5b6a
--- a/lib/transaction.c
2a5b6a
+++ b/lib/transaction.c
2a5b6a
@@ -1361,6 +1361,9 @@ rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
2a5b6a
      * (verification of non-installed package) where this is not true
2a5b6a
      * currently but that's not a new issue.
2a5b6a
      */
2a5b6a
+
2a5b6a
+    if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOPLUGINS)
2a5b6a
+ 	return RPMRC_OK;
2a5b6a
 
2a5b6a
     dsoPath = rpmExpand("%{__plugindir}/*.so", NULL);
2a5b6a
     if (rpmGlob(dsoPath, &nfiles, &files) == 0) {
2a5b6a
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
2a5b6a
index e0fcef0..4e6fe27 100644
2a5b6a
--- a/python/rpmmodule.c
2a5b6a
+++ b/python/rpmmodule.c
2a5b6a
@@ -428,6 +428,7 @@ static int initModule(PyObject *m)
2a5b6a
     REGISTER_ENUM(RPMTRANS_FLAG_NOTRIGGERS);
2a5b6a
     REGISTER_ENUM(RPMTRANS_FLAG_NODOCS);
2a5b6a
     REGISTER_ENUM(RPMTRANS_FLAG_ALLFILES);
2a5b6a
+    REGISTER_ENUM(RPMTRANS_FLAG_NOPLUGINS);
2a5b6a
     REGISTER_ENUM(RPMTRANS_FLAG_KEEPOBSOLETE);
2a5b6a
     REGISTER_ENUM(RPMTRANS_FLAG_NOCONTEXTS);
2a5b6a
     REGISTER_ENUM(RPMTRANS_FLAG_REPACKAGE);
2a5b6a
diff --git a/tests/atlocal.in b/tests/atlocal.in
2a5b6a
index 10ff27a..c2a07d5 100644
2a5b6a
--- a/tests/atlocal.in
2a5b6a
+++ b/tests/atlocal.in
2a5b6a
@@ -30,6 +30,6 @@ function run()
2a5b6a
 function runroot()
2a5b6a
 {
2a5b6a
     (cd ${RPMTEST} && \
2a5b6a
-     MAGIC="/magic/magic" FAKECHROOT_BASE="${RPMTEST}" fakechroot "$@" --define "_topdir /build"
2a5b6a
+     MAGIC="/magic/magic" FAKECHROOT_BASE="${RPMTEST}" fakechroot "$@" --define "_topdir /build" --noplugins
2a5b6a
     )
2a5b6a
 }
2a5b6a
-- 
2a5b6a
2.5.5
2a5b6a
2a5b6a
--- current/doc/rpm.8.orig	2016-07-14 14:34:14.286125290 +0200
2a5b6a
+++ current/doc/rpm.8	2016-07-14 14:36:29.715481426 +0200
2a5b6a
@@ -86,7 +86,7 @@
2a5b6a
  [\fB--excludedocs\fR] [\fB--force\fR] [\fB-h,--hash\fR]
2a5b6a
  [\fB--ignoresize\fR] [\fB--ignorearch\fR] [\fB--ignoreos\fR]
2a5b6a
  [\fB--includedocs\fR] [\fB--justdb\fR] [\fB--nocollections\fR]
2a5b6a
- [\fB--nodeps\fR] [\fB--nodigest\fR] [\fB--nosignature\fR]
2a5b6a
+ [\fB--nodeps\fR] [\fB--nodigest\fR] [\fB--nosignature\fR] [\fB--noplugins\fR]
2a5b6a
  [\fB--noorder\fR] [\fB--noscripts\fR] [\fB--notriggers\fR] 
2a5b6a
  [\fB--oldpackage\fR] [\fB--percent\fR] [\fB--prefix \fINEWPATH\fB\fR]
2a5b6a
  [\fB--relocate \fIOLDPATH\fB=\fINEWPATH\fB\fR]
2a5b6a
@@ -269,6 +269,9 @@
2a5b6a
 Don't reorder the packages for an install. The list of
2a5b6a
 packages would normally be reordered to satisfy dependencies.
2a5b6a
 .TP
2a5b6a
+\fB--noplugins\fR
2a5b6a
+Do not load and execute plugins.
2a5b6a
+.TP
2a5b6a
 \fB--noscripts\fR
2a5b6a
 .TP
2a5b6a
 \fB--nopre\fR