summaryrefslogtreecommitdiff
path: root/yocto-poky/meta/files/ext-sdk-prepare.py
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2016-08-17 22:31:25 +0300
committerPatrick Williams <patrick@stwcx.xyz>2016-08-22 19:43:26 +0300
commit60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch)
treeecb49581a9e41a37943c22cd9ef3f63451b20ee7 /yocto-poky/meta/files/ext-sdk-prepare.py
parente18c61205e0234b03697129c20cc69c9b3940efc (diff)
downloadopenbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.xz
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to hold all of the layers that we import with git-subtree. Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'yocto-poky/meta/files/ext-sdk-prepare.py')
-rw-r--r--yocto-poky/meta/files/ext-sdk-prepare.py103
1 files changed, 0 insertions, 103 deletions
diff --git a/yocto-poky/meta/files/ext-sdk-prepare.py b/yocto-poky/meta/files/ext-sdk-prepare.py
deleted file mode 100644
index 605e2ebef..000000000
--- a/yocto-poky/meta/files/ext-sdk-prepare.py
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env python
-
-# Prepare the build system within the extensible SDK
-
-import sys
-import os
-import subprocess
-
-def exec_watch(cmd, **options):
- """Run program with stdout shown on sys.stdout"""
- if isinstance(cmd, basestring) and not "shell" in options:
- options["shell"] = True
-
- process = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **options
- )
-
- buf = ''
- while True:
- out = process.stdout.read(1)
- if out:
- sys.stdout.write(out)
- sys.stdout.flush()
- buf += out
- elif out == '' and process.poll() != None:
- break
-
- return process.returncode, buf
-
-def check_unexpected(lines, recipes):
- """Check for unexpected output lines from dry run"""
- unexpected = []
- for line in lines.splitlines():
- if 'Running task' in line:
- for recipe in recipes:
- if recipe in line:
- break
- else:
- line = line.split('Running', 1)[-1]
- if 'do_rm_work' not in line:
- unexpected.append(line.rstrip())
- elif 'Running setscene' in line:
- unexpected.append(line.rstrip())
- return unexpected
-
-def main():
- if len(sys.argv) < 2:
- sdk_targets = []
- else:
- sdk_targets = ' '.join(sys.argv[1:]).split()
- if not sdk_targets:
- # Just do a parse so the cache is primed
- ret, _ = exec_watch('bitbake -p')
- return ret
-
- print('Preparing SDK for %s...' % ', '.join(sdk_targets))
-
- ret, out = exec_watch('bitbake %s --setscene-only' % ' '.join(sdk_targets))
- if ret:
- return ret
-
- targetlist = []
- for target in sdk_targets:
- if ':' in target:
- target = target.split(':')[0]
- if not target in targetlist:
- targetlist.append(target)
-
- recipes = []
- for target in targetlist:
- try:
- out = subprocess.check_output(('bitbake -e %s' % target).split(), stderr=subprocess.STDOUT)
- for line in out.splitlines():
- if line.startswith('FILE='):
- splitval = line.rstrip().split('=')
- if len(splitval) > 1:
- recipes.append(splitval[1].strip('"'))
- break
- except subprocess.CalledProcessError as e:
- print('ERROR: Failed to get recipe for target %s:\n%s' % (target, e.output))
- return 1
-
- try:
- out = subprocess.check_output('bitbake %s -n' % ' '.join(sdk_targets), stderr=subprocess.STDOUT, shell=True)
- unexpected = check_unexpected(out, recipes)
- except subprocess.CalledProcessError as e:
- print('ERROR: Failed to execute dry-run:\n%s' % e.output)
- return 1
-
- if unexpected:
- print('ERROR: Unexpected tasks or setscene left over to be executed:')
- for line in unexpected:
- print(' ' + line)
- return 1
-
-if __name__ == "__main__":
- try:
- ret = main()
- except Exception:
- ret = 1
- import traceback
- traceback.print_exc()
- sys.exit(ret)