[jhbuild] Don't fallback to local moduleset in case of undefined repository



commit b768e610b57f9b8e25f4677d641521106446d180
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun Jan 30 15:20:42 2011 +0100

    Don't fallback to local moduleset in case of undefined repository

 jhbuild/errors.py            |    2 ++
 jhbuild/modtypes/__init__.py |   13 ++++++++-----
 jhbuild/moduleset.py         |    5 ++++-
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/jhbuild/errors.py b/jhbuild/errors.py
index 227a7e6..841948c 100644
--- a/jhbuild/errors.py
+++ b/jhbuild/errors.py
@@ -49,6 +49,8 @@ class BuildStateError(JhbuildException):
 class DependencyCycleError(JhbuildException):
     '''There is a dependency cycle in the module set'''
 
+class UndefinedRepositoryError(FatalError):
+    '''There is a module depending on an undefined repository'''
 
 class SkipToPhase(Exception):
     def __init__(self, phase):
diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index ddcde15..a559b3a 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -29,7 +29,8 @@ __all__ = [
 
 import os
 
-from jhbuild.errors import FatalError, CommandError, BuildStateError, SkipToEnd
+from jhbuild.errors import FatalError, CommandError, BuildStateError, \
+             SkipToEnd, UndefinedRepositoryError
 from jhbuild.utils.sxml import sxml
 
 _module_types = {}
@@ -98,14 +99,16 @@ def get_branch(node, repositories, default_repo, config):
         try:
             repo = repositories[childnode.getAttribute('repo')]
         except KeyError:
-            raise FatalError(_('Repository=%s not found for module id=%s. Possible repositories are %s' )
-                             % (childnode.getAttribute('repo'), name, repositories))
+            raise UndefinedRepositoryError(
+                _('Repository=%s not found for module id=%s. Possible repositories are %s')
+                  % (childnode.getAttribute('repo'), name, repositories))
     else:
         try:
             repo = repositories[default_repo]
         except KeyError:
-            raise FatalError(_('Default Repository=%s not found for module id=%s. Possible repositories are %s')
-                             % (default_repo, name, repositories))
+            raise UndefinedRepositoryError(
+                _('Default Repository=%s not found for module id=%s. Possible repositories are %s')
+                % (default_repo, name, repositories))
 
     if repo.mirrors:
         mirror_type = config.mirror_policy
diff --git a/jhbuild/moduleset.py b/jhbuild/moduleset.py
index 6bac640..8c5a801 100644
--- a/jhbuild/moduleset.py
+++ b/jhbuild/moduleset.py
@@ -24,7 +24,8 @@ import sys
 import urlparse
 import logging
 
-from jhbuild.errors import UsageError, FatalError, DependencyCycleError, CommandError
+from jhbuild.errors import UsageError, FatalError, DependencyCycleError, \
+             CommandError, UndefinedRepositoryError
 
 try:
     import xml.dom.minidom
@@ -410,6 +411,8 @@ def _parse_module_set(config, uri):
             inc_uri = urlparse.urljoin(uri, href)
             try:
                 inc_moduleset = _parse_module_set(config, inc_uri)
+            except UndefinedRepositoryError:
+                raise
             except FatalError, e:
                 if inc_uri[0] == '/':
                     raise e



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]