* [PATCH] qemuboot: don't fail when QB_DEFAULT_KERNEL isn't symlink
@ 2016-09-28 7:03 Martin Jansa
2016-09-28 7:14 ` Robert Yang
0 siblings, 1 reply; 4+ messages in thread
From: Martin Jansa @ 2016-09-28 7:03 UTC (permalink / raw)
To: openembedded-core
* 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)
+ 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))
--
2.10.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] qemuboot: don't fail when QB_DEFAULT_KERNEL isn't symlink
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
2016-09-28 7:27 ` Martin Jansa
2016-09-28 7:28 ` [PATCHv2] " Martin Jansa
0 siblings, 2 replies; 4+ messages in thread
From: Robert Yang @ 2016-09-28 7:14 UTC (permalink / raw)
To: Martin Jansa, openembedded-core
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))
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] qemuboot: don't fail when QB_DEFAULT_KERNEL isn't symlink
2016-09-28 7:14 ` Robert Yang
@ 2016-09-28 7:27 ` Martin Jansa
2016-09-28 7:28 ` [PATCHv2] " Martin Jansa
1 sibling, 0 replies; 4+ messages in thread
From: Martin Jansa @ 2016-09-28 7:27 UTC (permalink / raw)
To: openembedded-core
* 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)
+ 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))
--
2.10.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2] qemuboot: don't fail when QB_DEFAULT_KERNEL isn't symlink
2016-09-28 7:14 ` Robert Yang
2016-09-28 7:27 ` Martin Jansa
@ 2016-09-28 7:28 ` Martin Jansa
1 sibling, 0 replies; 4+ messages in thread
From: Martin Jansa @ 2016-09-28 7:28 UTC (permalink / raw)
To: openembedded-core
* 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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 97a2357..ef9a128 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -69,7 +69,7 @@ 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)
+ kernel = os.path.realpath(kernel_link)
cf.set('config_bsp', 'QB_DEFAULT_KERNEL', kernel)
bb.utils.mkdirhier(os.path.dirname(qemuboot))
--
2.10.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-28 7:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2016-09-28 7:27 ` Martin Jansa
2016-09-28 7:28 ` [PATCHv2] " Martin Jansa
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.