summaryrefslogtreecommitdiffstats
path: root/pym/repoman/herdbase.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-04-02 10:22:38 -0700
committerZac Medico <zmedico@gentoo.org>2010-04-02 10:22:38 -0700
commit7a33618e8189384861b412176a3ddbef240b6777 (patch)
tree3c13576422a40d36d8f52e2c8d660c4565019b70 /pym/repoman/herdbase.py
parent0840af0260786b6d9d5b5d03eab269c6c545e722 (diff)
downloadportage-7a33618e8189384861b412176a3ddbef240b6777.tar.gz
portage-7a33618e8189384861b412176a3ddbef240b6777.tar.bz2
portage-7a33618e8189384861b412176a3ddbef240b6777.zip
Handle missing $PORTDIR/metadata/herds.xml. Thanks to Arfrever for reporting.
Diffstat (limited to 'pym/repoman/herdbase.py')
-rw-r--r--pym/repoman/herdbase.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/repoman/herdbase.py b/pym/repoman/herdbase.py
index 924839a61..6f92abfb8 100644
--- a/pym/repoman/herdbase.py
+++ b/pym/repoman/herdbase.py
@@ -3,9 +3,10 @@
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import errno
import xml.etree.ElementTree as ET
from xml.parsers.expat import ExpatError
-from portage.exception import ParseError
+from portage.exception import FileNotFound, ParseError, PermissionDenied
__all__ = [
"make_herd_base"
@@ -44,7 +45,14 @@ def make_herd_base(filename):
xml_tree = ET.parse(filename)
except ExpatError as e:
raise ParseError("metadata.xml: " + str(e))
-
+ except EnvironmentError as e:
+ func_call = "open('%s')" % filename
+ if e.errno == errno.EACCES:
+ raise PermissionDenied(func_call)
+ elif e.errno == errno.ENOENT:
+ raise FileNotFound(filename)
+ raise
+
herds = xml_tree.findall('herd')
for h in herds:
_herd_name = h.find('name')