diff options
Diffstat (limited to 'pym/repoman')
-rw-r--r-- | pym/repoman/herdbase.py | 12 | ||||
-rw-r--r-- | pym/repoman/utilities.py | 3 |
2 files changed, 12 insertions, 3 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') diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index cd7f5ea87..719e910d7 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -176,7 +176,8 @@ def check_metadata(metadata_xml_content, herd_base): except (ExpatError, ) as e: raise exception.ParseError("metadata.xml: " + str(e)) - check_metadata_herds(xml_tree, herd_base) + if herd_base is not None: + check_metadata_herds(xml_tree, herd_base) def FindPackagesToScan(settings, startdir, reposplit): |