All of lore.kernel.org
 help / color / mirror / Atom feed
From: brian avery <brian.avery@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/3] meta: add search, replace strings to export2json
Date: Wed, 19 Apr 2017 12:49:02 -0700	[thread overview]
Message-ID: <aa964cc32c1285466bca7a952e4c173b644e19c5.1492631156.git.brian.avery@intel.com> (raw)
In-Reply-To: <cover.1492631156.git.brian.avery@intel.com>

We want to be able to save relative paths so that we can relocate the
deploy dir images and kernels, yet still have qemu and testimage work
correctly.  This extends export2json with 2 named arguments so a
search/replace operation can be done to remove the leading path.

[YOCTO #11375]

Signed-off-by: brian avery <brian.avery@intel.com>
---
 meta/lib/oe/data.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py
index 80bba2b..b8901e6 100644
--- a/meta/lib/oe/data.py
+++ b/meta/lib/oe/data.py
@@ -17,7 +17,7 @@ def typed_value(key, d):
     except (TypeError, ValueError) as exc:
         bb.msg.fatal("Data", "%s: %s" % (key, str(exc)))
 
-def export2json(d, json_file, expand=True):
+def export2json(d, json_file, expand=True, searchString="",replaceString=""):
     data2export = {}
     keys2export = []
 
@@ -37,9 +37,11 @@ def export2json(d, json_file, expand=True):
 
     for key in keys2export:
         try:
-            data2export[key] = d.getVar(key, expand)
+            data2export[key] = d.getVar(key, expand).replace(searchString,replaceString)
         except bb.data_smart.ExpansionError:
             data2export[key] = ''
+        except AttributeError:
+            pass
 
     with open(json_file, "w") as f:
         json.dump(data2export, f, skipkeys=True, indent=4, sort_keys=True)
-- 
1.9.1



  reply	other threads:[~2017-04-19 19:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 19:49 [PATCH 0/3] meta: save relative paths to qemuboot.conf and testdata.json brian avery
2017-04-19 19:49 ` brian avery [this message]
2017-04-19 19:49 ` [PATCH 2/3] rootfs-postcommands.bbclass: save relative paths brian avery
2017-04-19 19:49 ` [PATCH 3/3] qemuboot.bbclass: save relative paths in conf file brian avery

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=aa964cc32c1285466bca7a952e4c173b644e19c5.1492631156.git.brian.avery@intel.com \
    --to=brian.avery@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.