commit 793ca7ce20a1bb07974e8a468eeb5c641d0aa9a4
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Mar 3 16:00:41 2014 +0100
recipe xml format: add module_dir and tools_dir attributes
These attributes can be used in <task> elements to specify additional
directory paths that should be searched for module and tool resources.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/RecipeParser.py | 16 ++++++++++++++++
schema-recipe.rng | 16 ++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index 2e178e8..e3b6df9 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -152,6 +152,22 @@ class RecipeParser(XmlParser):
if self._has_attribute(task_tag, "quit_on_fail"):
task["quit_on_fail"] = self._get_attribute(task_tag,
"quit_on_fail")
+ if self._has_attribute(task_tag, "module_dir"):
+ base_dir = os.path.dirname(task_tag.attrib["__file"])
+ dir_path = str(self._get_attribute(task_tag, "module_dir"))
+ exp_path = os.path.expanduser(dir_path)
+ abs_path = os.path.join(base_dir, exp_path)
+ norm_path = os.path.normpath(abs_path)
+ task["module_dir"] = norm_path
+
+ if self._has_attribute(task_tag, "tools_dir"):
+ base_dir = os.path.dirname(task_tag.attrib["__file"])
+ dir_path = str(self._get_attribute(task_tag, "tools_dir"))
+ exp_path = os.path.expanduser(dir_path)
+ abs_path = os.path.join(base_dir, exp_path)
+ norm_path = os.path.normpath(abs_path)
+ task["tools_dir"] = norm_path
+
if self._has_attribute(task_tag, "python"):
task["python"] = self._get_attribute(task_tag, "python")
return task
diff --git a/schema-recipe.rng b/schema-recipe.rng
index 7803849..129d7e7 100644
--- a/schema-recipe.rng
+++ b/schema-recipe.rng
@@ -59,6 +59,14 @@
</choice>
</attribute>
</optional>
+
+ <optional>
+ <attribute name="module_dir"/>
+ </optional>
+
+ <optional>
+ <attribute name="tools_dir"/>
+ </optional>
</element>
<ref name="xml_task"/>
</choice>
@@ -81,6 +89,14 @@
</attribute>
</optional>
+ <optional>
+ <attribute name="module_dir"/>
+ </optional>
+
+ <optional>
+ <attribute name="tools_dir"/>
+ </optional>
+
<oneOrMore>
<choice>
<ref name="run"/>
Show replies by date