[oe-commits] [openembedded-core] 25/28: archiver.bbclass: Don't expand python functions in dumpdata

git at git.openembedded.org git at git.openembedded.org
Wed Mar 23 17:53:46 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 6176ea5b3e28c7e26c1f23191a27dafbae2e3e85
Author: Mariano Lopez <mariano.lopez at linux.intel.com>
AuthorDate: Tue Mar 22 14:04:00 2016 +0000

    archiver.bbclass: Don't expand python functions in dumpdata
    
    Currently the dumpdata task expands python data in the datastore, in
    some functions this causes a silent error and the task will fail.
    
    The change also rewrite the function to make a bit clearer.
    
    Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/archiver.bbclass | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index b95176b..221c7f4 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -335,14 +335,13 @@ python do_dumpdata () {
     dumpfile = os.path.join(d.getVar('ARCHIVER_OUTDIR', True), \
         '%s-showdata.dump' % d.getVar('PF', True))
     bb.note('Dumping metadata into %s' % dumpfile)
-    f = open(dumpfile, 'w')
-    # emit variables and shell functions
-    bb.data.emit_env(f, d, True)
-    # emit the metadata which isn't valid shell
-    for e in d.keys():
-        if bb.data.getVarFlag(e, 'python', d):
-            f.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, True)))
-    f.close()
+    with open(dumpfile, "w") as f:
+        # emit variables and shell functions
+        bb.data.emit_env(f, d, True)
+        # emit the metadata which isn't valid shell
+        for e in d.keys():
+            if d.getVarFlag(e, "python", False):
+                f.write("\npython %s () {\n%s}\n" % (e, d.getVar(e, False)))
 }
 
 SSTATETASKS += "do_deploy_archives"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list