public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] Add support for Isar build system
@ 2017-06-22  6:14 Jan Kiszka
       [not found] ` <4f366f37-6c4e-527a-3562-495bdf5cbccb@siemens.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2017-06-22  6:14 UTC (permalink / raw)
  To: kas-devel, Baurzhan Ismagulov, Daniel Wagner; +Cc: isar-users, 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>
---

This was tested against next branch of kas using a full-fledged Debian
8.8 as host, a private bug-fix branch of Isar (hope we can resolve that
soon) and the following basic config:

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

repos:
  - url: ""
    sublayers:
      - meta
      - meta-isar

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

local_conf_header: |
  CONF_VERSION = "1"
  DISTRO_ARCH = "amd64"

We probably need to discuss if/how multiconfig support could be added to
kas.

Note that Docker support is WiP (Baurzhan is helping me to debug a
remaining issue).

 kas/libcmds.py |  4 ++--
 kas/libkas.py  | 25 ++++++++++++++-----------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/kas/libcmds.py b/kas/libcmds.py
index 6dcef1f..d9d8a87 100644
--- a/kas/libcmds.py
+++ b/kas/libcmds.py
@@ -26,7 +26,7 @@ import shutil
 import os
 from urllib.parse import urlparse
 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'
@@ -126,7 +126,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 b2e6dd0..72acf34 100644
--- a/kas/libkas.py
+++ b/kas/libkas.py
@@ -128,25 +128,28 @@ def find_program(paths, name):
     return None


-def get_oe_environ(config, build_dir):
-    # nasty side effect function: running oe-init-build-env also
+def get_build_environ(config, build_dir):
+    # 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 f:
         script = """#!/bin/bash
-        source oe-init-build-env $1 > /dev/null 2>&1
+        source %s $1 > /dev/null 2>&1
         env
-        """
+        """ % init_script
         f.write(script)
     os.chmod(get_bb_env_file, 0o775)

@@ -154,7 +157,7 @@ def get_oe_environ(config, build_dir):
     env['PATH'] = '/bin:/usr/bin'

     (rc, 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)

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-22  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22  6:14 [PATCH] Add support for Isar build system Jan Kiszka
     [not found] ` <4f366f37-6c4e-527a-3562-495bdf5cbccb@siemens.com>
2017-06-22  8:00   ` Jan Kiszka

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