public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Daniel Wagner <daniel.wagner@siemens.com>,
	"kas-devel@googlegroups.com" <kas-devel@googlegroups.com>
Cc: isar-users@googlegroups.com, Baurzhan Ismagulov <ibr@ilbers.de>,
	Johann Pfefferl <johann.pfefferl@siemens.com>
Subject: [PATCH v2] Add support for Isar build system
Date: Thu, 22 Jun 2017 10:29:10 +0200	[thread overview]
Message-ID: <d81581b6-4700-134f-31eb-5a18c02f0030@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>
---

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)
 

                 reply	other threads:[~2017-06-22  8:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=d81581b6-4700-134f-31eb-5a18c02f0030@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