Repository: modm-io/lbuild

Issue:
No warning/error on non-existing modules
You can add arbitrary module lines like `<module>This does not exist and is bullshit</module>` and there will be no error or warning. This is very unpleasant if modules names in modm changed and you will get no feedback from lbuild that a requested module was not found.

Accidentally reported against wrong project dergraaf/library-builder#31

Discussion:

Patch:
diff --git a/lbuild/main.py b/lbuild/main.py
index 7593491..95016c1 100644
--- a/lbuild/main.py
+++ b/lbuild/main.py
@@ -24,7 +24,7 @@ from lbuild.format import format_option_short_description
 
 from lbuild.api import Builder
 
-__version__ = '1.4.3'
+__version__ = '1.4.4'
 
 
 class InitAction:
diff --git a/lbuild/node.py b/lbuild/node.py
index ae95df9..030ca97 100644
--- a/lbuild/node.py
+++ b/lbuild/node.py
@@ -308,7 +308,7 @@ class BaseNode(anytree.Node):
             except LbuildException as b:
                 if not ignore_failure:
                     raise LbuildException("Cannot resolve dependencies!\n" + str(b))
-                print("ignoring", dependency_name)
+                LOGGER.debug("ignoring", dependency_name)
         self._dependencies = list(dependencies)
         self._dependencies_resolved = not ignore_failure
         for child in self.children:
diff --git a/lbuild/parser.py b/lbuild/parser.py
index 7c9fb19..dbc69d0 100644
--- a/lbuild/parser.py
+++ b/lbuild/parser.py
@@ -220,7 +220,10 @@ class Parser(BaseNode):
     def find_any(self, queries, types=None):
         nodes = set()
         for query in utils.listify(queries):
-            nodes |= set(self._resolve_partial(query, set()))
+            result = self._resolve_partial(query, None)
+            if result is None:
+                raise LbuildException("Cannot resolve '{}'".format(query))
+            nodes |= set(result)
         if types:
             types = utils.listify(types)
             nodes = [n for n in nodes if any(n.type == t for t in types)]


Test patch:
diff --git a/test/parser_test.py b/test/parser_test.py
index 4479f3b..20834a0 100644
--- a/test/parser_test.py
+++ b/test/parser_test.py
@@ -138,6 +138,16 @@ class ParserTest(unittest.TestCase):
         self.assertIn("repo1:other", self.parser.modules)
         self.assertIn("repo1:module1", self.parser.modules)
 
+    def test_raise_unknown_module(self):
+        self.parser.parse_repository(self._get_path("combined/repo1.lb"))
+        self.parser._config_flat = lbuild.config.ConfigNode.from_file(self._get_path("combined/test1.xml"))
+
+        self.parser.merge_repository_options()
+        modules = self.parser.prepare_repositories()
+        self.parser.config.modules.append(":unknown")
+        self.assertRaises(lbuild.exception.LbuildException,
+                          lambda: self.parser.find_modules(self.parser.config.modules))
+
     def _get_build_modules(self):
         self.parser.parse_repository(self._get_path("combined/repo1.lb"))
         self.parser.parse_repository(self._get_path("combined/repo2/repo2.lb"))