From a98c0fe282c219cf1fbfd1e15f675694cd61b4ae Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Wed, 19 Jun 2013 13:23:27 -0700 Subject: [PATCH] Improve debugging of missing elements. Print the checked directory when cannot find an element. Change-Id: I2c1f74e4975e66b6ec9d4122c02067bc2c473620 --- diskimage_builder/elements.py | 3 ++- diskimage_builder/test_elementdeps.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/elements.py b/diskimage_builder/elements.py index 9c441c10..d8504428 100644 --- a/diskimage_builder/elements.py +++ b/diskimage_builder/elements.py @@ -50,7 +50,8 @@ def dependencies(element, elements_dir=None): else: raise - sys.stderr.write("ERROR: Element %s doesn't exists\n" % (element, )) + sys.stderr.write("ERROR: Element '%s' not found in '%s'\n" % + (element, elements_dir)) exit(-1) diff --git a/diskimage_builder/test_elementdeps.py b/diskimage_builder/test_elementdeps.py index be704f33..4937e4d6 100644 --- a/diskimage_builder/test_elementdeps.py +++ b/diskimage_builder/test_elementdeps.py @@ -52,6 +52,10 @@ class TestElementDeps(TestCase): elements_dir=self.element_dir) self.assertEquals(set(['requires-foo', 'foo']), result) + def test_missing_deps(self): + self.assertRaises(SystemExit, expand_dependencies, ['fake'], + self.element_dir) + def test_transitive_deps(self): result = expand_dependencies(['requires-requires-foo'], elements_dir=self.element_dir)