[yocto] [yocto-autobuilder2][PATCH 2/3] Added remote distribution of config JSON files

Thomas Goodwin btgoodwin at geontech.com
Tue Jul 30 11:36:20 PDT 2019


This feature/fix allows the worker to download the
autobuilder helper JSON files from the controller
rather than having to store them in the
yocto-autobuilder-helper repository.  The process
installs the file into the worker's
builddir/yocto-autobuilder-helper path.

Signed-off-by: Thomas Goodwin <btgoodwin at geontech.com>
---
 builders.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/builders.py b/builders.py
index 3d12969..35903de 100644
--- a/builders.py
+++ b/builders.py
@@ -18,6 +18,26 @@ extra_env = {}
 if os.environ.get('ABHELPER_JSON'):
     extra_env['ABHELPER_JSON'] = os.environ['ABHELPER_JSON']
 
+def add_abhelper_steps(factory):
+    """
+    Adds FileDownload steps to the factory for each specified autobuilder
+    helper JSON file and installs the file in the worker's
+    builddir/yocto-autobuilder-helper/ path.
+    """
+    abhelper_dir = os.path.expanduser("~/yocto-autobuilder-helper")
+    abhelper_configs = extra_env.get("ABHELPER_JSON", "config.json").split(" ")
+    for helper in abhelper_configs:
+        helper_name = os.path.basename(helper)
+        worker_helper = util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/" + helper_name)
+        master_helper = helper
+        if not helper.startswith("/"):
+            master_helper = os.path.join(abhelper_dir, helper)
+        factory.addStep(steps.FileDownload(
+            name="Download '{}'".format(helper_name),
+            mastersrc=master_helper,
+            workerdest=worker_helper,
+            haltOnFailure=True ))
+
 @util.renderer
 def get_sstate_release_number(props):
     """
@@ -145,6 +165,7 @@ def create_builder_factory():
         mode='incremental',
         haltOnFailure=True,
         name='Fetch yocto-autobuilder-helper'))
+    add_abhelper_steps(f)
     f.addStep(steps.SetProperties(properties=ensure_props_set))
     f.addStep(WriteLayerInfo(name='Write main layerinfo.json', haltOnFailure=True))
     f.addStep(steps.ShellCommand(
@@ -213,6 +234,7 @@ def create_parent_builder_factory(buildername, waitname):
         mode='incremental',
         haltOnFailure=True,
         name='Fetch yocto-autobuilder-helper'))
+    add_abhelper_steps(factory)
     factory.addStep(WriteLayerInfo(name='Write main layerinfo.json', haltOnFailure=True))
     factory.addStep(steps.ShellCommand(
         command=[
-- 
2.17.1



More information about the yocto mailing list