import portage.const
import portage.dep
portage.dep._dep_check_strict = True
-import portage.exception
from portage import cvstree, normalize_path
from portage import util
-from portage.exception import ParseError
+from portage.exception import FileNotFound, ParseError, PermissionDenied
from portage.manifest import Manifest
from portage.process import find_binary, spawn
from portage.output import bold, create_color_func, darkgreen, \
try:
herd_base = make_herd_base(os.path.join(repoman_settings["PORTDIR"], "metadata/herds.xml"))
-except (EnvironmentError, ParseError) as e:
+except (EnvironmentError, ParseError, PermissionDenied) as e:
err(str(e))
+except FileNotFound:
+ # TODO: Download as we do for metadata.dtd, but add a way to
+ # disable for non-gentoo repoman users who may not have herds.
+ herd_base = None
for x in scanlist:
#ebuilds and digests added to cvs respectively.
# 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"
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')
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):