chantra / rpms / rpm

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