Add support for Isar build system

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 commit is contained in:
Jan Kiszka 2017-06-22 10:29:10 +02:00 committed by Daniel Wagner
parent f3cee3b296
commit 013af80599
2 changed files with 17 additions and 14 deletions

View File

@ -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):

View File

@ -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)