public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "kas-devel@googlegroups.com" <kas-devel@googlegroups.com>,
	Baurzhan Ismagulov <ibr@ilbers.de>,
	Daniel Wagner <daniel.wagner@siemens.com>
Cc: isar-users@googlegroups.com,
	Johann Pfefferl <johann.pfefferl@siemens.com>
Subject: [PATCH] Add support for Isar build system
Date: Thu, 22 Jun 2017 08:14:40 +0200	[thread overview]
Message-ID: <5153df1f-347d-32e6-3b4d-dff378979427@siemens.com> (raw)

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

             reply	other threads:[~2017-06-22  6:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  6:14 Jan Kiszka [this message]
     [not found] ` <4f366f37-6c4e-527a-3562-495bdf5cbccb@siemens.com>
2017-06-22  8:00   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5153df1f-347d-32e6-3b4d-dff378979427@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=daniel.wagner@siemens.com \
    --cc=ibr@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=johann.pfefferl@siemens.com \
    --cc=kas-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox