Fix traceback when accessing the portage db. (Bug #211716)
authorfuzzyray <fuzzyray@gentoo.org>
Thu, 28 Feb 2008 23:43:45 +0000 (23:43 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Thu, 28 Feb 2008 23:43:45 +0000 (23:43 -0000)
svn path=/; revision=477

trunk/ChangeLog
trunk/src/gentoolkit/__init__.py

index baa3ec0a9cfff3dbd8583bcd77ae775c021ba41c..1c9408606a54e34c1403f68cf34e990ef15d1676 100644 (file)
@@ -1,3 +1,7 @@
+2008-02-28: Paul Varner <fuzzyray@gentoo.org>
+       * gentoolkit: Fix traceback when accessing the portage
+       db. (Bug #211716)
+
 2008-02-21: Paul Varner <fuzzyray@gentoo.org>
        * revdep-rebuild: "Use /etc/init.d/functions.sh instead of
        /sbin/functions.sh. (Bug 210940)
index ecbea69000d3a9c10257a1cc990b6a755ff5e37c..668da0dd6c833a25eb9b544c2a081ffda275c3bf 100644 (file)
@@ -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