alexk / rpms / rpm

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