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 3/3] qemuboot.bbclass: save relative paths in conf file
Date: Wed, 19 Apr 2017 12:49:04 -0700	[thread overview]
Message-ID: <d82c57b76da9eb71b7713e22c72f46190a01b28c.1492631156.git.brian.avery@intel.com> (raw)
In-Reply-To: <cover.1492631156.git.brian.avery@intel.com>

This saves relative paths in the qemuboot.conf file instead of absolute
paths. This is to allow the images and kernels to be relocated and still
have the testimage and runqemu work.

[YOCTO #11375]

Signed-off-by: brian avery <brian.avery@intel.com>
---
 meta/classes/qemuboot.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index cc5314e..86b3060 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -84,6 +84,7 @@ python do_write_qemuboot_conf() {
 
     qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME'))
     qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
+    topdir="%s/"%(d.getVar('TOPDIR')).replace("//","/")
     cf = configparser.ConfigParser()
     cf.add_section('config_bsp')
     for k in qemuboot_vars(d):
@@ -94,6 +95,9 @@ python do_write_qemuboot_conf() {
                                'qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/')
         else:
             val = d.getVar(k)
+        # we only want to write out relative paths so that we can relocate images
+        # and still run them
+        val=val.replace(topdir,"")
         cf.set('config_bsp', k, '%s' % val)
 
     # QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink
@@ -101,6 +105,9 @@ python do_write_qemuboot_conf() {
     # Read the link and replace it with the full filename of the target.
     kernel_link = os.path.join(d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('QB_DEFAULT_KERNEL'))
     kernel = os.path.realpath(kernel_link)
+    # we only want to write out relative paths so that we can relocate images
+    # and still run them
+    kernel=kernel.replace(topdir,"")
     cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
 
     bb.utils.mkdirhier(os.path.dirname(qemuboot))
-- 
1.9.1



      parent 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 ` [PATCH 1/3] meta: add search, replace strings to export2json brian avery
2017-04-19 19:49 ` [PATCH 2/3] rootfs-postcommands.bbclass: save relative paths brian avery
2017-04-19 19:49 ` brian avery [this message]

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=d82c57b76da9eb71b7713e22c72f46190a01b28c.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.