summaryrefslogtreecommitdiff
path: root/recipes-bsp
diff options
context:
space:
mode:
authorStefan Christ <s.christ@phytec.de>2015-11-05 15:20:09 +0100
committerStefan Müller-Klieser <s.mueller-klieser@phytec.de>2015-11-06 14:05:30 +0100
commit94714357ac38449bdef50cd013a91b27690a013e (patch)
tree9a551e18781b42f0d77a4ac032304c19231784e4 /recipes-bsp
parentb72029617426c2b473327011e033dac1912cfddf (diff)
downloadmeta-phytec-94714357ac38449bdef50cd013a91b27690a013e.tar.bz2
meta-phytec-94714357ac38449bdef50cd013a91b27690a013e.zip
barebox: rewrite savedefconfig task in python
Using a python implementation gives the same workflow as for the task 'diffconfig'. The user can simply copy&paste the path and move the generated defconfig into his/her layer. The patch adds a new python function py_oe_runmake for convenience. It's a straightforward reimplementation of the bash function oe_runmake. Since it's to hard to directly call make with an argument list (You would have to parse ${EXTRA_OEMAKE} into an argument list), the function just concats everything into a long string and passes it to the shell for execution. Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Diffstat (limited to 'recipes-bsp')
-rw-r--r--recipes-bsp/barebox/barebox.inc34
1 files changed, 30 insertions, 4 deletions
diff --git a/recipes-bsp/barebox/barebox.inc b/recipes-bsp/barebox/barebox.inc
index 134dbf8..718fadb 100644
--- a/recipes-bsp/barebox/barebox.inc
+++ b/recipes-bsp/barebox/barebox.inc
@@ -108,10 +108,36 @@ do_default_defconfig () {
oe_runmake ${BAREBOX_DEFAULT_DEFCONFIG}
}
-do_savedefconfig() {
- bbplain "saving defconfig to ${WORKDIR}/defconfig.temp"
- oe_runmake savedefconfig
- install -m 644 ${B}/defconfig ${WORKDIR}/defconfig.temp
+
+# Python implementation of function oe_runmake_call and oe_runmake from
+# meta/classes/base.bbclass.
+def py_oe_runmake(d, cmd):
+ import subprocess
+ statement = "%s %s %s" % (d.getVar("MAKE", True) or '',
+ d.getVar("EXTRA_OEMAKE", True) or '',
+ cmd)
+ bb.note(statement)
+ exitcode = subprocess.call(statement, shell=True)
+ if exitcode != 0:
+ bb.fatal("oe_runmake failed")
+
+# This is a python implementation, because the output of bbnote, bbplain, .. is
+# not shown on the bitbake console, it's only saved to a log file. See Bug ????
+# (... I cannot find the bug currently)
+# The function provides the same workflow as for the task 'diffconfig'. The
+# user can simply copy&paste the path and move the generated defconfig file
+# into his/her layer.
+python do_savedefconfig() {
+ import shutil
+ workdir = d.getVar("WORKDIR", True)
+ workdir_defconfig = os.path.join(workdir, "defconfig.temp")
+ B = d.getVar("B", True)
+
+ bb.plain("Saving defconfig to %s" % (workdir_defconfig,))
+ py_oe_runmake(d, "savedefconfig")
+
+ shutil.copyfile(os.path.join(B, "defconfig"), workdir_defconfig)
+
}
addtask savedefconfig after do_configure