From c5cc3e4e7c44041ec56c0f08f1ff4ec283dee533 Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Thu, 28 Feb 2008 23:43:45 +0000 Subject: [PATCH] Fix traceback when accessing the portage db. (Bug #211716) svn path=/; revision=477 --- trunk/ChangeLog | 4 ++++ trunk/src/gentoolkit/__init__.py | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/trunk/ChangeLog b/trunk/ChangeLog index baa3ec0..1c94086 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,7 @@ +2008-02-28: Paul Varner + * gentoolkit: Fix traceback when accessing the portage + db. (Bug #211716) + 2008-02-21: Paul Varner * revdep-rebuild: "Use /etc/init.d/functions.sh instead of /sbin/functions.sh. (Bug 210940) diff --git a/trunk/src/gentoolkit/__init__.py b/trunk/src/gentoolkit/__init__.py index ecbea69..668da0d 100644 --- a/trunk/src/gentoolkit/__init__.py +++ b/trunk/src/gentoolkit/__init__.py @@ -27,11 +27,20 @@ except ImportError: import re from threading import Lock -settingslock = Lock() -settings = portage.config(clone=portage.settings) -porttree = portage.db[portage.root]["porttree"] -vartree = portage.db[portage.root]["vartree"] -virtuals = portage.db[portage.root]["virtuals"] +try: + import portage.exception as portage_exception +except ImportError: + import portage_exception + +try: + settingslock = Lock() + settings = portage.config(clone=portage.settings) + porttree = portage.db[portage.root]["porttree"] + vartree = portage.db[portage.root]["vartree"] + virtuals = portage.db[portage.root]["virtuals"] +except portage_exception.PermissionDenied, e: + sys.stderr.write("Permission denied: '%s'\n" % str(e)) + sys.exit(e.errno) Config = { "verbosityLevel": 3 -- 2.26.2