Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: Martin Jansa <martin.jansa@gmail.com>,
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] qemuboot: don't fail when QB_DEFAULT_KERNEL isn't symlink
Date: Wed, 28 Sep 2016 15:14:01 +0800	[thread overview]
Message-ID: <4e1404d9-e1b3-ce24-4c20-55757352e2a6@windriver.com> (raw)
In-Reply-To: <20160928070314.24504-1-Martin.Jansa@gmail.com>



On 09/28/2016 03:03 PM, Martin Jansa wrote:
> * in some cases we might set QB_DEFAULT_KERNEL to the real filename
>   instead of symlink and then this whole readlink work around actually
>   breaks the build, because os.readlink fails on normal files:
>
>   >>> os.readlink('deploy/images/qemux86/bzImage-linux-yocto-qemux86-master-20160927084848.bin')
>   'bzImage-linux-yocto-qemux86.bin'
>   >>> os.readlink('deploy/images/qemux86/bzImage-linux-yocto-qemux86.bin')
>   Traceback (most recent call last):
>     File "<stdin>", line 1, in <module>
>   OSError: [Errno 22] Invalid argument: '/jenkins/mjansa/build-starfish-master-mcf/BUILD/deploy/images/qemux86/bzImage-linux-yocto-qemux86.bin'
>
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/classes/qemuboot.bbclass | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
> index 97a2357..a3a05ba 100644
> --- a/meta/classes/qemuboot.bbclass
> +++ b/meta/classes/qemuboot.bbclass
> @@ -69,7 +69,11 @@ python write_qemuboot_conf() {
>      # to the kernel file, which hinders relocatability of the qb conf.
>      # Read the link and replace it with the full filename of the target.
>      kernel_link = os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), d.getVar('QB_DEFAULT_KERNEL', True))
> -    kernel = os.readlink(kernel_link)

os.path.realpath(kernel_link) should work for regular file or symlink.

// Robert

> +    try:
> +        kernel = os.readlink(kernel_link)
> +    except OSError as e:
> +        # we assume it failed, because QB_DEFAULT_KERNEL is already real file or hardlink, not symlink
> +        kernel = kernel_link
>      cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
>
>      bb.utils.mkdirhier(os.path.dirname(qemuboot))
>


  reply	other threads:[~2016-09-28  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28  7:03 [PATCH] qemuboot: don't fail when QB_DEFAULT_KERNEL isn't symlink Martin Jansa
2016-09-28  7:14 ` Robert Yang [this message]
2016-09-28  7:27   ` Martin Jansa
2016-09-28  7:28   ` [PATCHv2] " Martin Jansa

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=4e1404d9-e1b3-ce24-4c20-55757352e2a6@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=martin.jansa@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox