Blob Blame Raw
From eac732ebd8977da7bb5c3e3fa95a1f7dc276f6b7 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Fri, 8 Feb 2013 13:45:13 +0100
Subject: [PATCH 4/7] Use REVIEW_NO_MOCKGROUP_TEST to inhibit test of mock
 group (#78)

---
 fedora-review.1              |  5 +++++
 src/FedoraReview/settings.py | 11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fedora-review.1 b/fedora-review.1
index 45542f6..c575a52 100644
--- a/fedora-review.1
+++ b/fedora-review.1
@@ -285,6 +285,11 @@ User supplied directory with shell-based plugins
 loglevel used when not using -v/--verbose. A logging.* value like 'DEBUG', 'Info', or 'warning'. Setting
 REVIEW_LOGLEVEL to 'debug' is the same as providing the -v/--verbose option.
 .TP
+.B REVIEW_NO_MOCKGROUP_CHECK
+Normally, fedora-review checks  that user is member of the mock group
+before proceeding since this is required to run mock in most setups.
+In cases this check is not useful it can be suppressed by this variable.
+.TP
 .B XDG_DATA_HOME
 fedora-review respects XDG_DATA_HOME which defaults to ~/.local/share. Eg g.,
 the personal data directory with plugins is by default ~/.local/share/fedora-review/plugins,
diff --git a/src/FedoraReview/settings.py b/src/FedoraReview/settings.py
index 86cc2bd..81d94a3 100644
--- a/src/FedoraReview/settings.py
+++ b/src/FedoraReview/settings.py
@@ -16,9 +16,9 @@
 #
 # (C) 2011 - Tim Lauridsen <timlau@fedoraproject.org>
 
-'''
-Tools for helping Fedora package reviewers
-'''
+''' Tools for helping Fedora package reviewers '''
+
+# pylint: disable=R0924
 
 import argparse
 import grp
@@ -44,8 +44,11 @@ def _check_mock_grp():
     mock_msg = \
     'No mock group - mock not installed or mock not in effective' \
     'groups. Try running  "newgrp" or logging out from all your local '\
-    'sessions and logging back in.'
+    'sessions and logging back in. Or disable test using ' \
+    'REVIEW_NO_MOCKGROUP_CHECK, see manpage'
 
+    if 'REVIEW_NO_MOCKGROUP_CHECK' in os.environ:
+        return
     mock_gid = grp.getgrnam('mock')[2]
     if not mock_gid in os.getgroups():
         raise ReviewError(mock_msg)
-- 
1.8.1