public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2] Add support for Isar build system
@ 2017-06-22  8:29 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2017-06-22  8:29 UTC (permalink / raw)
  To: Daniel Wagner, kas-devel; +Cc: isar-users, Baurzhan Ismagulov, Johann Pfefferl

From: Jan Kiszka <jan.kiszka@siemens.com>

Isar allows to build Debian-based images using bitbake and the usual
layer structures. It's very similar to OE, we just need to account for
a different init script name.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - rebased over next

Here is the updated kas file:

header:
  version: "0.9"

machine:    qemu-amd64
distro:     debian-stretch
target:     isar-image-base

repos:
  isar:
    layers:
      meta:
      meta-isar:

bblayers_conf_header:
  standard: |
    LCONF_VERSION = "6"
    BBPATH = "${TOPDIR}"
    BBFILES ?= ""

local_conf_header:
  distro-arch: |
    CONF_VERSION = "1"
    DISTRO_ARCH = "amd64"

 kas/libcmds.py |  4 ++--
 kas/libkas.py  | 27 +++++++++++++++------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/kas/libcmds.py b/kas/libcmds.py
index 70733c5..91133f0 100644
--- a/kas/libcmds.py
+++ b/kas/libcmds.py
@@ -28,7 +28,7 @@ import logging
 import shutil
 import os
 from .libkas import (ssh_cleanup_agent, ssh_setup_agent, ssh_no_host_key_check,
-                     run_cmd, get_oe_environ)
+                     run_cmd, get_build_environ)
 
 __license__ = 'MIT'
 __copyright__ = 'Copyright (c) Siemens AG, 2017'
@@ -168,7 +168,7 @@ class SetupEnviron(Command):
         return 'setup_environ'
 
     def execute(self, config):
-        config.environ.update(get_oe_environ(config, config.build_dir))
+        config.environ.update(get_build_environ(config, config.build_dir))
 
 
 class WriteConfig(Command):
diff --git a/kas/libkas.py b/kas/libkas.py
index 53fc8e0..3c08acc 100644
--- a/kas/libkas.py
+++ b/kas/libkas.py
@@ -158,29 +158,32 @@ def find_program(paths, name):
     return None
 
 
-def get_oe_environ(config, build_dir):
+def get_build_environ(config, build_dir):
     """
-        Create the openembedded environment variables.
+        Create the build environment variables.
     """
     # pylint: disable=too-many-locals
-    # nasty side effect function: running oe-init-build-env also
+    # nasty side effect function: running oe/isar-init-build-env also
     # creates the conf directory
 
-    oe_path = None
-    for repo in config.get_repos():
-        if os.path.exists(repo.path + '/oe-init-build-env'):
-            oe_path = repo.path
+    permutations = \
+        [(repo, script) for repo in config.get_repos()
+         for script in ['oe-init-build-env', 'isar-init-build-env']]
+    for (repo, script) in permutations:
+        if os.path.exists(repo.path + '/' + script):
+            init_path = repo.path
+            init_script = script
             break
-    if not oe_path:
-        logging.error('Did not find oe-init-build-env')
+    else:
+        logging.error('Did not find any init-build-env script')
         sys.exit(1)
 
     get_bb_env_file = tempfile.mktemp()
     with open(get_bb_env_file, 'w') as fds:
         script = """#!/bin/bash
-        source oe-init-build-env $1 > /dev/null 2>&1
+        source %s $1 > /dev/null 2>&1
         env
-        """
+        """ % init_script
         fds.write(script)
     os.chmod(get_bb_env_file, 0o775)
 
@@ -188,7 +191,7 @@ def get_oe_environ(config, build_dir):
     env['PATH'] = '/bin:/usr/bin'
 
     (_, output) = run_cmd([get_bb_env_file, build_dir],
-                          cwd=oe_path, env=env, liveupdate=False)
+                          cwd=init_path, env=env, liveupdate=False)
 
     os.remove(get_bb_env_file)
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-22  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22  8:29 [PATCH v2] Add support for Isar build system Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox