[OE-core] [PATCH] script/yocto-bsp: Fail to add kernel feature in custom linux kernel

2017-06-20 Thread Choong YinThong
Missing file {machine}-user-feature.scc on
yocto-bsp custom linux kernel creation
and causes failure in yocto-kernel feature add.

[YOCTO #11585]

Signed-off-by: Choong YinThong 
---
 .../target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb| 1 +
 .../recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc| 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc

diff --git 
a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb
 
b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb
index fda955b..3ba4226 100644
--- 
a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb
+++ 
b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb
@@ -42,6 +42,7 @@ SRC_URI += "file://{{=machine}}.scc \
 file://{{=machine}}.cfg \
 file://{{=machine}}-user-config.cfg \
 file://{{=machine}}-user-patches.scc \
+file://{{=machine}}-user-features.scc \
"
 
 {{ if kernel_choice == "custom" and custom_kernel_need_kbranch == "y" and 
custom_kernel_kbranch and custom_kernel_kbranch != "master": }}
diff --git 
a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc
 
b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc
new file mode 100644
index 000..85be26d
--- /dev/null
+++ 
b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc
@@ -0,0 +1 @@
+# yocto-bsp-filename {{=machine}}-user-features.scc
\ No newline at end of file
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] Update script yocto-bsp for custom linux kernel creation

2017-06-20 Thread Choong YinThong
Update script/yocto-bsp to fix missing file 
{machine}-user-feature.scc when execute 
script/yocto-bsp custom linux kernel creation.

Choong YinThong (1):
  script/yocto-bsp: Fail to add kernel feature in custom linux
kernel

 .../target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb| 1 +
 .../recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc| 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 
scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-features.scc

-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Gary Thomas

On 2017-06-21 07:22, Denys Dmytriyenko wrote:

On Tue, Jun 20, 2017 at 09:33:24PM -0500, Brad Mouring wrote:

On Tue, Jun 20, 2017 at 10:59:55PM +0200, Marek Vasut wrote:

On 06/20/2017 10:53 PM, Brad Mouring wrote:

On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:

On 06/20/2017 10:40 PM, Brad Mouring wrote:

As implemented currently, the fw-utils recipe does not allow for
...
+# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
+# By default, use the default included in the U-Boot source
+UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
+
  inherit uboot-config
  
  do_compile () {

@@ -19,7 +24,7 @@ do_install () {
install -d ${D}${sysconfdir}
install -m 755 ${S}/tools/env/fw_printenv 
${D}${base_sbindir}/fw_printenv
install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
-   install -m 0644 ${S}/tools/env/fw_env.config 
${D}${sysconfdir}/fw_env.config
+   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config


Do we really need yet another variable ? Wouldn't it make more sense to
add do_install_append_yourmachine() {} in your meta-whatever to
u-boot-fw-utils_%.bbappend and install whatever additional files you need ?


This is (kinda) what we were doing, there was some discussion as to
whether or not this made sense upstream.


Link?


I know it's not a great answer, but we've not pushed the version of the
branch where these changes are going in. Eventually, they'll end up in
this repo:

https://github.com/ni/meta-nilrt


I was unsure of the
acceptability of a do_install_append.*() clobbering a file of the
original do_install().


That's probably what really needs to be discussed.

We can probably add some task which by default installs the
fw_env.config example and can be overridden in meta-whatever . Maybe the
others can jump into here and explain how to handle overriding the
default config file best.


That sounds like a solution that would certainly work for this
use-case, if no one pipes up with objections or a currently-unseen
silver bullet solution, I'll try to whip something together tomorrow
and post. Thanks for the idea.

Denys, I know you keep pushing the "shove it in a do_install_append()",
but to me and my under-informed sensibilities, this seems weird and
unclean to clobber a file in a _append(), would it cause some QA failure?


Hmm, I mentioned it only once... To a patch that does already mention
appending stuff...



We do this all the time for this recipe.  It just takes a simple .bbappend
like this one.

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += "file://fw_env.config \
"

do_install_append() {
   install -d ${D}${sysconfdir}
   install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config   
}

PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "${MACHINE}"

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Denys Dmytriyenko
On Tue, Jun 20, 2017 at 09:33:24PM -0500, Brad Mouring wrote:
> On Tue, Jun 20, 2017 at 10:59:55PM +0200, Marek Vasut wrote:
> > On 06/20/2017 10:53 PM, Brad Mouring wrote:
> > > On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
> > >> On 06/20/2017 10:40 PM, Brad Mouring wrote:
> > >>> As implemented currently, the fw-utils recipe does not allow for
> > >>> ...
> > >>> +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
> > >>> +# By default, use the default included in the U-Boot source
> > >>> +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
> > >>> +
> > >>>  inherit uboot-config
> > >>>  
> > >>>  do_compile () {
> > >>> @@ -19,7 +24,7 @@ do_install () {
> > >>> install -d ${D}${sysconfdir}
> > >>> install -m 755 ${S}/tools/env/fw_printenv 
> > >>> ${D}${base_sbindir}/fw_printenv
> > >>> install -m 755 ${S}/tools/env/fw_printenv 
> > >>> ${D}${base_sbindir}/fw_setenv
> > >>> -   install -m 0644 ${S}/tools/env/fw_env.config 
> > >>> ${D}${sysconfdir}/fw_env.config
> > >>> +   install -m 0644 ${UBOOT_FW_ENV_CONFIG} 
> > >>> ${D}${sysconfdir}/fw_env.config
> > >>
> > >> Do we really need yet another variable ? Wouldn't it make more sense to
> > >> add do_install_append_yourmachine() {} in your meta-whatever to
> > >> u-boot-fw-utils_%.bbappend and install whatever additional files you 
> > >> need ?
> > > 
> > > This is (kinda) what we were doing, there was some discussion as to
> > > whether or not this made sense upstream.
> > 
> > Link?
> 
> I know it's not a great answer, but we've not pushed the version of the
> branch where these changes are going in. Eventually, they'll end up in
> this repo:
> 
> https://github.com/ni/meta-nilrt
> 
> > > I was unsure of the
> > > acceptability of a do_install_append.*() clobbering a file of the
> > > original do_install().
> > 
> > That's probably what really needs to be discussed.
> > 
> > We can probably add some task which by default installs the
> > fw_env.config example and can be overridden in meta-whatever . Maybe the
> > others can jump into here and explain how to handle overriding the
> > default config file best.
> 
> That sounds like a solution that would certainly work for this
> use-case, if no one pipes up with objections or a currently-unseen
> silver bullet solution, I'll try to whip something together tomorrow
> and post. Thanks for the idea.
> 
> Denys, I know you keep pushing the "shove it in a do_install_append()",
> but to me and my under-informed sensibilities, this seems weird and
> unclean to clobber a file in a _append(), would it cause some QA failure?

Hmm, I mentioned it only once... To a patch that does already mention 
appending stuff...

-- 
Denys
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4] image_types.bbclass: Prompt error message on missing setting in UBI and UBIFS

2017-06-20 Thread yin . thong . choong
From: Choong YinThong 

Prompt error message to guide user add argument
MKUBIFS_ARGS and UBINIZE_ARGS in local.conf on
every UBI and UBIFS image creation.

[YOCTO #11589]

Signed-off-by: Choong YinThong 
---
 meta/classes/image_types.bbclass | 8 
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 7749b00..e496385 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -145,6 +145,14 @@ UBI_VOLNAME ?= "${MACHINE}-rootfs"
 multiubi_mkfs() {
local mkubifs_args="$1"
local ubinize_args="$2"
+
+# Added prompt error message for ubi and ubifs image creation.
+if [ -z "$mkubifs_args"] || [ -z "$ubinize_args" ]; then
+bberror "MKUBIFS_ARGS and UBINIZE_ARGS argument have to set in 
machine.conf for UBI and UBIFS image creation."
+bberror "Detail please visit this link 
http://www.linux-mtd.infradead.org/faq/ubifs.html";
+return
+fi
+
if [ -z "$3" ]; then
local vname=""
else
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4] Prompt error message on missing setting for

2017-06-20 Thread yin . thong . choong
From: Choong YinThong 

Prompt error message on missing setting in machine.conf for 
UBI and UBIFS image creation.

Choong YinThong (1):
  image_types.bbclass: Prompt error message on missing setting in
UBI and UBIFS

 meta/classes/image_types.bbclass | 8 
 1 file changed, 8 insertions(+)

-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] ✗ patchtest: failure for systemd: work-around ppc gold linker error

2017-06-20 Thread Patchwork
== Series Details ==

Series: systemd: work-around ppc gold linker error
Revision: 1
URL   : https://patchwork.openembedded.org/series/7390/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue Added patch file is missing Upstream-Status in the header 
[test_upstream_status_presence] 
  Suggested fixAdd Upstream-Status:  to the header of 
meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch (possible 
values: Pending, Submitted, Accepted, Backport, Denied, Inappropriate)

* Issue A patch file has been added, but does not have a 
Signed-off-by tag [test_signed_off_by_presence] 
  Suggested fixSign off the added patch file 
(meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] systemd: work-around ppc gold linker error

2017-06-20 Thread Randy MacLeod

On 2017-06-20 10:41 PM, Khem Raj wrote:

On Tue, Jun 20, 2017 at 10:28 PM, Randy MacLeod
 wrote:

Signed-off-by: Randy MacLeod 
---
  .../systemd/systemd/systemd-drop-gold-use-bfd.patch   | 11 +++
  meta/recipes-core/systemd/systemd_232.bb  |  2 ++
  2 files changed, 13 insertions(+)
  create mode 100644 
meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch

diff --git a/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch 
b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
new file mode 100644
index 000..eac2199
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac
 b/configure.ac
+@@ -260,7 +260,7 @@
+ -Wl,-z,relro \
+ -Wl,-z,now \
+ -pie \
+--Wl,-fuse-ld=gold])
++-Wl,-fuse-ld=bfd])
+ AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
+
+ AC_CHECK_SIZEOF(pid_t)


may be a sed expression in do_configure_prepend is better


Maybe?... hmmm.

I could do but this works and is intended to be reverted once
the proper fix is merged so unless you or someone else insists
and explains why it's better to do it in configure_prepend,
I'll leave it as is.



diff --git a/meta/recipes-core/systemd/systemd_232.bb 
b/meta/recipes-core/systemd/systemd_232.bb
index 1007360..1ce9dc1 100644
--- a/meta/recipes-core/systemd/systemd_232.bb
+++ b/meta/recipes-core/systemd/systemd_232.bb
@@ -41,6 +41,8 @@ SRC_URI_append_libc-uclibc = "\
  "
  SRC_URI_append_qemuall = " 
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"

+SRC_URI_append_qemuppc = " file://systemd-drop-gold-use-bfd.patch"


is it specific to qemu alone ? 


Probably not. I'll figure out a better pattern for v2.


if its generic across ppc then this is not
right override. Infact you should also describe what the problem is in detail
here.


Right. I'll do that in v2.

Meanwhile, some details are here for those interested:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11696

Thanks for the review.

../Randy




+
  PACKAGECONFIG ??= "xz \
 ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux 
ldconfig', d)} \
 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 
'xkbcommon', '', d)} \
--
2.7.4

--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core



--
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, 
Canada, K2K 2W5

--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] systemd: work-around ppc gold linker error

2017-06-20 Thread Khem Raj
On Tue, Jun 20, 2017 at 10:28 PM, Randy MacLeod
 wrote:
> Signed-off-by: Randy MacLeod 
> ---
>  .../systemd/systemd/systemd-drop-gold-use-bfd.patch   | 11 
> +++
>  meta/recipes-core/systemd/systemd_232.bb  |  2 ++
>  2 files changed, 13 insertions(+)
>  create mode 100644 
> meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
>
> diff --git 
> a/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch 
> b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
> new file mode 100644
> index 000..eac2199
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
> @@ -0,0 +1,11 @@
> +--- a/configure.ac
>  b/configure.ac
> +@@ -260,7 +260,7 @@
> + -Wl,-z,relro \
> + -Wl,-z,now \
> + -pie \
> +--Wl,-fuse-ld=gold])
> ++-Wl,-fuse-ld=bfd])
> + AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
> +
> + AC_CHECK_SIZEOF(pid_t)

may be a sed expression in do_configure_prepend is better

> diff --git a/meta/recipes-core/systemd/systemd_232.bb 
> b/meta/recipes-core/systemd/systemd_232.bb
> index 1007360..1ce9dc1 100644
> --- a/meta/recipes-core/systemd/systemd_232.bb
> +++ b/meta/recipes-core/systemd/systemd_232.bb
> @@ -41,6 +41,8 @@ SRC_URI_append_libc-uclibc = "\
>  "
>  SRC_URI_append_qemuall = " 
> file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
>
> +SRC_URI_append_qemuppc = " file://systemd-drop-gold-use-bfd.patch"

is it specific to qemu alone ? if its generic across ppc then this is not
right override. Infact you should also describe what the problem is in detail
here.

> +
>  PACKAGECONFIG ??= "xz \
> ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux 
> ldconfig', d)} \
> ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 
> 'xkbcommon', '', d)} \
> --
> 2.7.4
>
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] systemd: work-around ppc gold linker error

2017-06-20 Thread Randy MacLeod
Signed-off-by: Randy MacLeod 
---
 .../systemd/systemd/systemd-drop-gold-use-bfd.patch   | 11 +++
 meta/recipes-core/systemd/systemd_232.bb  |  2 ++
 2 files changed, 13 insertions(+)
 create mode 100644 
meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch

diff --git a/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch 
b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
new file mode 100644
index 000..eac2199
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac
 b/configure.ac
+@@ -260,7 +260,7 @@
+ -Wl,-z,relro \
+ -Wl,-z,now \
+ -pie \
+--Wl,-fuse-ld=gold])
++-Wl,-fuse-ld=bfd])
+ AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
+ 
+ AC_CHECK_SIZEOF(pid_t)
diff --git a/meta/recipes-core/systemd/systemd_232.bb 
b/meta/recipes-core/systemd/systemd_232.bb
index 1007360..1ce9dc1 100644
--- a/meta/recipes-core/systemd/systemd_232.bb
+++ b/meta/recipes-core/systemd/systemd_232.bb
@@ -41,6 +41,8 @@ SRC_URI_append_libc-uclibc = "\
 "
 SRC_URI_append_qemuall = " 
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
+SRC_URI_append_qemuppc = " file://systemd-drop-gold-use-bfd.patch"
+
 PACKAGECONFIG ??= "xz \
${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux 
ldconfig', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', 
'', d)} \
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Brad Mouring
On Tue, Jun 20, 2017 at 10:59:55PM +0200, Marek Vasut wrote:
> On 06/20/2017 10:53 PM, Brad Mouring wrote:
> > On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
> >> On 06/20/2017 10:40 PM, Brad Mouring wrote:
> >>> As implemented currently, the fw-utils recipe does not allow for
> >>> ...
> >>> +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
> >>> +# By default, use the default included in the U-Boot source
> >>> +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
> >>> +
> >>>  inherit uboot-config
> >>>  
> >>>  do_compile () {
> >>> @@ -19,7 +24,7 @@ do_install () {
> >>>   install -d ${D}${sysconfdir}
> >>>   install -m 755 ${S}/tools/env/fw_printenv 
> >>> ${D}${base_sbindir}/fw_printenv
> >>>   install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
> >>> - install -m 0644 ${S}/tools/env/fw_env.config 
> >>> ${D}${sysconfdir}/fw_env.config
> >>> + install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config
> >>
> >> Do we really need yet another variable ? Wouldn't it make more sense to
> >> add do_install_append_yourmachine() {} in your meta-whatever to
> >> u-boot-fw-utils_%.bbappend and install whatever additional files you need ?
> > 
> > This is (kinda) what we were doing, there was some discussion as to
> > whether or not this made sense upstream.
> 
> Link?

I know it's not a great answer, but we've not pushed the version of the
branch where these changes are going in. Eventually, they'll end up in
this repo:

https://github.com/ni/meta-nilrt

> > I was unsure of the
> > acceptability of a do_install_append.*() clobbering a file of the
> > original do_install().
> 
> That's probably what really needs to be discussed.
> 
> We can probably add some task which by default installs the
> fw_env.config example and can be overridden in meta-whatever . Maybe the
> others can jump into here and explain how to handle overriding the
> default config file best.

That sounds like a solution that would certainly work for this
use-case, if no one pipes up with objections or a currently-unseen
silver bullet solution, I'll try to whip something together tomorrow
and post. Thanks for the idea.

Denys, I know you keep pushing the "shove it in a do_install_append()",
but to me and my under-informed sensibilities, this seems weird and
unclean to clobber a file in a _append(), would it cause some QA failure?

> -- 
> Best regards,
> Marek Vasut

Regards,
Brad Mouring
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] x86-base.inc: Don't add live to IMAGE_FSTYPES, default instead

2017-06-20 Thread California Sullivan
Using += makes it difficult to remove. Soft-set with ?= instead.

Signed-off-by: California Sullivan 
---
 meta/conf/machine/include/x86-base.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/machine/include/x86-base.inc 
b/meta/conf/machine/include/x86-base.inc
index 7365953..bfacdf5 100644
--- a/meta/conf/machine/include/x86-base.inc
+++ b/meta/conf/machine/include/x86-base.inc
@@ -10,7 +10,7 @@ MACHINE_FEATURES += "screen keyboard pci usbhost ext2 ext3 
x86 \
 
 MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
 
-IMAGE_FSTYPES += "live"
+IMAGE_FSTYPES ?= "live"
 
 KERNEL_IMAGETYPE ?= "bzImage"
 
-- 
2.5.5

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] u-boot-fw-utils: Allow replacement of fw_env.config

2017-06-20 Thread Denys Dmytriyenko
On Tue, Jun 20, 2017 at 07:15:12PM -0300, Otavio Salvador wrote:
> If a fw_env.config file is found in workdir, this is preferred over
> the U-Boot example.
> 
> Signed-off-by: Otavio Salvador 
> ---
> 
>  meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb 
> b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
> index c2e8f0fb84..0682f9274b 100644
> --- a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
> +++ b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
> @@ -19,7 +19,14 @@ do_install () {
>   install -d ${D}${sysconfdir}
>   install -m 755 ${S}/tools/env/fw_printenv 
> ${D}${base_sbindir}/fw_printenv
>   install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
> - install -m 0644 ${S}/tools/env/fw_env.config 
> ${D}${sysconfdir}/fw_env.config
> +
> + # If a specific file is added in a .bbappend, this is used instead
> + # of the generic one
> + if [ -e ${WORKDIR}/fw_env.config ]; then
> + install -m 0644 ${WORKDIR}/fw_env.config 
> ${D}${sysconfdir}/fw_env.config

I don't get it - if it's expected that a .bbappend will be adding a more 
specific version of fw_env.config, why that .bbappend can't simply install 
it with do_install_append()?


> + else
> + install -m 0644 ${S}/tools/env/fw_env.config 
> ${D}${sysconfdir}/fw_env.config.example
> + fi
>  }
>  
>  do_install_class-cross () {
> -- 
> 2.13.1
> 
> -- 
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 2/4] masterimage.py: fix stop()

2017-06-20 Thread Stephano Cetola
From: Erik Botö 

The stop() function is called in the context of the masterimage,
so self.master should be used instead of self.connection which is
undefined at that time.

[YOCTO #11524]

Signed-off-by: Erik Botö 
---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index 07418fcda1..6aa7fba6eb 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -156,7 +156,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
 
 def stop(self):
 bb.plain("%s - reboot/powercycle target" % self.pn)
-self.power_cycle(self.connection)
+self.power_cycle(self.master)
 
 
 class SystemdbootTarget(MasterImageHardwareTarget):
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 4/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-06-20 Thread Stephano Cetola
From: Erik Botö 

On systemd systems calling reboot over an ssh connection doesn't
return as expected causing an exception, therefore wrap the call
to reboot in order to avoid this issue.

Also sync the filesystems before rebooting cause otherwise, it will be
done as part of the reboot and could take a very long time and testimage
will fail to access the machine. This issue was observed consistently with
one of our rootfs at Pelagicore.

[YOCTO #11524]

Signed-off-by: Erik Botö 
---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index e43e4d8889..a2912fc568 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -108,7 +108,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
 time.sleep(10)
 self.power_ctl("cycle")
 else:
-status, output = conn.run("reboot")
+status, output = conn.run("sync; { sleep 1; reboot; } > /dev/null 
&")
 if status != 0:
 bb.error("Failed rebooting target and no power control command 
defined. You need to manually reset the device.\n%s" % output)
 
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 3/4] masterimage.py: rename parameter "params" in start() to "extra_bootparams"

2017-06-20 Thread Stephano Cetola
From: Erik Botö 

This matches how it is called, and how it is named in qmeu target.

[YOCTO #11524]

Signed-off-by: Erik Botö 
---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index 6aa7fba6eb..e43e4d8889 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -143,7 +143,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
 def _deploy(self):
 pass
 
-def start(self, params=None):
+def start(self, extra_bootparams=None):
 bb.plain("%s - boot test image on target" % self.pn)
 self._start()
 # set the ssh object for the target/test image
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 1/4] sshcontrol.py: in copy_to() always use scp

2017-06-20 Thread Stephano Cetola
From: Erik Botö 

The current implementation is broken when the localpath is a link.
Then only a symlink would be created on the target, instead of copying
the actual file.

[YOCTO #11524]

Signed-off-by: Erik Botö 
---
 meta/lib/oeqa/utils/sshcontrol.py | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/meta/lib/oeqa/utils/sshcontrol.py 
b/meta/lib/oeqa/utils/sshcontrol.py
index 05d6502550..d292893c08 100644
--- a/meta/lib/oeqa/utils/sshcontrol.py
+++ b/meta/lib/oeqa/utils/sshcontrol.py
@@ -150,12 +150,9 @@ class SSHControl(object):
 
 def copy_to(self, localpath, remotepath):
 if os.path.islink(localpath):
-link = os.readlink(localpath)
-dst_dir, dst_base = os.path.split(remotepath)
-return self.run("cd %s; ln -s %s %s" % (dst_dir, link, dst_base))
-else:
-command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, 
remotepath)]
-return self._internal_run(command, ignore_status=False)
+localpath = os.path.dirname(localpath) + "/" + 
os.readlink(localpath)
+command = self.scp + [localpath, '%s@%s:%s' % (self.user, self.ip, 
remotepath)]
+return self._internal_run(command, ignore_status=False)
 
 def copy_from(self, remotepath, localpath):
 command = self.scp + ['%s@%s:%s' % (self.user, self.ip, remotepath), 
localpath]
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 0/4] fix runtime testing using systemd-boot targe

2017-06-20 Thread Stephano Cetola
I'm sending this on behalf of Zeeshan Ali . One of
the patches required a rebase and he is on vacation. This fixes
[YOCTO #11524].

Erik Botö (4):
  sshcontrol.py: in copy_to() always use scp
  masterimage.py: fix stop()
  masterimage.py: rename parameter "params" in start() to
"extra_bootparams"
  masterimage.py: fix issue with calling reboot on masterimage/DUT

 meta/lib/oeqa/controllers/masterimage.py | 6 +++---
 meta/lib/oeqa/utils/sshcontrol.py| 9 +++--
 2 files changed, 6 insertions(+), 9 deletions(-)

-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] u-boot-fw-utils: Allow replacement of fw_env.config

2017-06-20 Thread Otavio Salvador
If a fw_env.config file is found in workdir, this is preferred over
the U-Boot example.

Signed-off-by: Otavio Salvador 
---

 meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb 
b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
index c2e8f0fb84..0682f9274b 100644
--- a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
+++ b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
@@ -19,7 +19,14 @@ do_install () {
install -d ${D}${sysconfdir}
install -m 755 ${S}/tools/env/fw_printenv 
${D}${base_sbindir}/fw_printenv
install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
-   install -m 0644 ${S}/tools/env/fw_env.config 
${D}${sysconfdir}/fw_env.config
+
+   # If a specific file is added in a .bbappend, this is used instead
+   # of the generic one
+   if [ -e ${WORKDIR}/fw_env.config ]; then
+   install -m 0644 ${WORKDIR}/fw_env.config 
${D}${sysconfdir}/fw_env.config
+   else
+   install -m 0644 ${S}/tools/env/fw_env.config 
${D}${sysconfdir}/fw_env.config.example
+   fi
 }
 
 do_install_class-cross () {
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Otavio Salvador
On Tue, Jun 20, 2017 at 6:16 PM, Marek Vasut  wrote:
> On 06/20/2017 10:57 PM, Otavio Salvador wrote:
>> On Tue, Jun 20, 2017 at 5:53 PM, Brad Mouring  wrote:
>>> On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
 On 06/20/2017 10:40 PM, Brad Mouring wrote:
> As implemented currently, the fw-utils recipe does not allow for
> ...
> +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
> +# By default, use the default included in the U-Boot source
> +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
> +
>  inherit uboot-config
>
>  do_compile () {
> @@ -19,7 +24,7 @@ do_install () {
> install -d ${D}${sysconfdir}
> install -m 755 ${S}/tools/env/fw_printenv 
> ${D}${base_sbindir}/fw_printenv
> install -m 755 ${S}/tools/env/fw_printenv 
> ${D}${base_sbindir}/fw_setenv
> -   install -m 0644 ${S}/tools/env/fw_env.config 
> ${D}${sysconfdir}/fw_env.config
> +   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config

 Do we really need yet another variable ? Wouldn't it make more sense to
 add do_install_append_yourmachine() {} in your meta-whatever to
 u-boot-fw-utils_%.bbappend and install whatever additional files you need ?
>>>
>>> This is (kinda) what we were doing, there was some discussion as to
>>> whether or not this made sense upstream. I was unsure of the
>>> acceptability of a do_install_append.*() clobbering a file of the
>>> original do_install().
>>>
>>> Thanks for the input.
>>
>> Or split up the configuration to u-boot-fw-utils-config package and
>> make u-boot-fw-utils generic? So we can have the configuration in a
>> specific package.
>
> Keep in mind that u-boot-fw-utils is actually built for particular
> machine (it contains ie. the default env for that machine) so bundling
> the config file with it is IMO OK. No need to introduce additional
> packages for every simple file.

I will propose one patch. See what you think ...

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] ✗ patchtest: failure for oeqa: fix runtime testing using systemd-boot target (rev2)

2017-06-20 Thread Zeeshan Ali
Hi Stephano,

Thanks. I'm already on my 2 weeks vacation so if you could kindly rebase
the patch series, that'd be very nice. Otherwise, I'll just do it after I
return. Thanks.

On Tue, 20 Jun 2017, 23:34 Stephano Cetola, 
wrote:

> Hey Zeeshan,
>
> Let me know if you need any help with this. This probably requires
> that you do a rebase with master and resubmit a V4.
>
> Cheers,
> Stephano
>
> On 06/19, Patchwork wrote:
> > == Series Details ==
> >
> > Series: oeqa: fix runtime testing using systemd-boot target (rev2)
> > Revision: 2
> > URL   : https://patchwork.openembedded.org/series/6953/
> > State : failure
> >
> > == Summary ==
> >
> >
> > Thank you for submitting this patch series to OpenEmbedded Core. This is
> > an automated response. Several tests have been executed on the proposed
> > series by patchtest resulting in the following failures:
> >
> >
> >
> > * Issue Series does not apply on top of target branch
> [test_series_merge_on_head]
> >   Suggested fixRebase your series on top of targeted branch
> >   Targeted branch  master (currently at 1d9a88f635)
> >
> >
> >
> > If you believe any of these test results are incorrect, please reply to
> the
> > mailing list (openembedded-core@lists.openembedded.org) raising your
> concerns.
> > Otherwise we would appreciate you correcting the issues and submitting a
> new
> > version of the patchset if applicable. Please ensure you add/increment
> the
> > version number when sending the new version (i.e. [PATCH] -> [PATCH v2]
> ->
> > [PATCH v3] -> ...).
> >
> > ---
> > Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
> > Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
> >
> > --
> > ___
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH][krogoth] initrdscripts/init-install*: Add rootwait when installing to USB devices

2017-06-20 Thread Alejandro Hernandez
From: California Sullivan 

It can take a bit for USB devices to be detected, so if a USB device is
your rootfs and you don't set rootwait you will most likely get a kernel
panic. Fix this by adding rootwait to the kernel command line on
installation.

Fixes [YOCTO #9462].

(From OE-Core rev: 40e2d36573a7a6bce377b1f9653607065ba5ffb6)

Signed-off-by: Alejandro Hernandez 
Signed-off-by: California Sullivan 
Signed-off-by: Ross Burton 
Signed-off-by: Richard Purdie 
---
 meta/recipes-core/initrdscripts/files/init-install-efi.sh | 6 ++
 meta/recipes-core/initrdscripts/files/init-install.sh | 5 +
 2 files changed, 11 insertions(+)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh 
b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index f564f4e2d6a..bf8a76b96bb 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -144,6 +144,12 @@ if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
 part_prefix="p"
 rootwait="rootwait"
 fi
+
+# USB devices also require rootwait
+if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then
+rootwait="rootwait"
+fi
+
 bootfs=${device}${part_prefix}1
 rootfs=${device}${part_prefix}2
 swap=${device}${part_prefix}3
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh 
b/meta/recipes-core/initrdscripts/files/init-install.sh
index 72ce92b9640..5f2599e7242 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -152,6 +152,11 @@ if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
 rootwait="rootwait"
 fi
 
+# USB devices also require rootwait
+if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then
+rootwait="rootwait"
+fi
+
 if [ $grub_version -eq 0 ] ; then
 bios_boot=''
 bootfs=${device}${part_prefix}1
-- 
2.12.2

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Marek Vasut
On 06/20/2017 10:57 PM, Otavio Salvador wrote:
> On Tue, Jun 20, 2017 at 5:53 PM, Brad Mouring  wrote:
>> On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
>>> On 06/20/2017 10:40 PM, Brad Mouring wrote:
 As implemented currently, the fw-utils recipe does not allow for
 ...
 +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
 +# By default, use the default included in the U-Boot source
 +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
 +
  inherit uboot-config

  do_compile () {
 @@ -19,7 +24,7 @@ do_install () {
 install -d ${D}${sysconfdir}
 install -m 755 ${S}/tools/env/fw_printenv 
 ${D}${base_sbindir}/fw_printenv
 install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
 -   install -m 0644 ${S}/tools/env/fw_env.config 
 ${D}${sysconfdir}/fw_env.config
 +   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config
>>>
>>> Do we really need yet another variable ? Wouldn't it make more sense to
>>> add do_install_append_yourmachine() {} in your meta-whatever to
>>> u-boot-fw-utils_%.bbappend and install whatever additional files you need ?
>>
>> This is (kinda) what we were doing, there was some discussion as to
>> whether or not this made sense upstream. I was unsure of the
>> acceptability of a do_install_append.*() clobbering a file of the
>> original do_install().
>>
>> Thanks for the input.
> 
> Or split up the configuration to u-boot-fw-utils-config package and
> make u-boot-fw-utils generic? So we can have the configuration in a
> specific package.

Keep in mind that u-boot-fw-utils is actually built for particular
machine (it contains ie. the default env for that machine) so bundling
the config file with it is IMO OK. No need to introduce additional
packages for every simple file.

-- 
Best regards,
Marek Vasut
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] ✗ patchtest: failure for oeqa: fix runtime testing using systemd-boot target (rev2)

2017-06-20 Thread Stephano Cetola
Hey Zeeshan,

Let me know if you need any help with this. This probably requires
that you do a rebase with master and resubmit a V4.

Cheers,
Stephano

On 06/19, Patchwork wrote:
> == Series Details ==
> 
> Series: oeqa: fix runtime testing using systemd-boot target (rev2)
> Revision: 2
> URL   : https://patchwork.openembedded.org/series/6953/
> State : failure
> 
> == Summary ==
> 
> 
> Thank you for submitting this patch series to OpenEmbedded Core. This is
> an automated response. Several tests have been executed on the proposed
> series by patchtest resulting in the following failures:
> 
> 
> 
> * Issue Series does not apply on top of target branch 
> [test_series_merge_on_head] 
>   Suggested fixRebase your series on top of targeted branch
>   Targeted branch  master (currently at 1d9a88f635)
> 
> 
> 
> If you believe any of these test results are incorrect, please reply to the
> mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
> Otherwise we would appreciate you correcting the issues and submitting a new
> version of the patchset if applicable. Please ensure you add/increment the
> version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
> [PATCH v3] -> ...).
> 
> ---
> Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
> Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
> 
> -- 
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Brad Mouring
As implemented currently, the fw-utils recipe does not allow for
a board- or distro-specific fw_env.config override, instead opting
to include the default (commented, example-filled) fw_env.config
from the u-boot source. This change introduces a variable that allows
for overriding this, while defaulting to the example config file from
the u-boot source.

Signed-off-by: Brad Mouring 
---
 meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb 
b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
index c2e8f0fb84..b06282ac03 100644
--- a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
+++ b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
@@ -7,6 +7,11 @@ INSANE_SKIP_${PN} = "already-stripped"
 EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} 
${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" V=1'
 EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} 
${LDFLAGS}" V=1'
 
+# U-Boot environment configuration file variables. This file is used
+# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
+# By default, use the default included in the U-Boot source
+UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
+
 inherit uboot-config
 
 do_compile () {
@@ -19,7 +24,7 @@ do_install () {
install -d ${D}${sysconfdir}
install -m 755 ${S}/tools/env/fw_printenv 
${D}${base_sbindir}/fw_printenv
install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
-   install -m 0644 ${S}/tools/env/fw_env.config 
${D}${sysconfdir}/fw_env.config
+   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config
 }
 
 do_install_class-cross () {
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3] mesa: Update to 17.1.3 release

2017-06-20 Thread Otavio Salvador
17.1.2 release includes fixes for:

  Bug 98833 - [REGRESSION, bisected] Wayland revert commit breaks
  non-Vsync fullscreen frame updates
  Bug 100741 - Chromium - Memory leak
  Bug 100877 - vulkan/tests/block_pool_no_free regression
  Bug 101110 - Build failure in GNOME Continuous

17.1.3 release includes fixes for:

  Bug 100988 - glXGetCurrentDisplay() no longer works for FakeGLX
   contexts?

The 17.1.3 release includes the "util/rand_xor: add missing include
statements" which is now merged upstream (thanks Nicolas Dechesne);
the referred patch is then dropped from the recipe.

Signed-off-by: Otavio Salvador 
---

Changes in v3:
- update to 17.1.3 release

Changes in v2:
- rebase on top of master

 ...l-rand_xor-add-missing-include-statements.patch | 35 --
 .../mesa/{mesa-gl_17.1.1.bb => mesa-gl_17.1.3.bb}  |  0
 .../mesa/{mesa_17.1.1.bb => mesa_17.1.3.bb}|  5 ++--
 3 files changed, 2 insertions(+), 38 deletions(-)
 delete mode 100644 
meta/recipes-graphics/mesa/files/0001-util-rand_xor-add-missing-include-statements.patch
 rename meta/recipes-graphics/mesa/{mesa-gl_17.1.1.bb => mesa-gl_17.1.3.bb} 
(100%)
 rename meta/recipes-graphics/mesa/{mesa_17.1.1.bb => mesa_17.1.3.bb} (77%)

diff --git 
a/meta/recipes-graphics/mesa/files/0001-util-rand_xor-add-missing-include-statements.patch
 
b/meta/recipes-graphics/mesa/files/0001-util-rand_xor-add-missing-include-statements.patch
deleted file mode 100644
index ffe8b96163..00
--- 
a/meta/recipes-graphics/mesa/files/0001-util-rand_xor-add-missing-include-statements.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From a8a1081ec05634e667d6670ab7c128d536cc60a9 Mon Sep 17 00:00:00 2001
-From: Nicolas Dechesne 
-Date: Thu, 1 Jun 2017 11:59:42 +0200
-Subject: [PATCH] util/rand_xor: add missing include statements
-
-Fixes for:
-
-src/util/rand_xor.c:60:13: error: implicit declaration of function 'open' 
[-Werror=implicit-function-declaration]
-int fd = open("/dev/urandom", O_RDONLY);
- ^~~~
-src/util/rand_xor.c:60:34: error: 'O_RDONLY' undeclared (first use in this 
function)
-int fd = open("/dev/urandom", O_RDONLY);
-  ^~~~
-
-Upstream-Status: Submitted [ 
https://lists.freedesktop.org/archives/mesa-dev/2017-June/157542.html ]
-Signed-off-by: Nicolas Dechesne 

- src/util/rand_xor.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
-index de05fa64b3..de04bbc284 100644
 a/src/util/rand_xor.c
-+++ b/src/util/rand_xor.c
-@@ -25,6 +25,7 @@
- #if defined(__linux__)
- #include 
- #include 
-+#include 
- #else
- #include 
- #endif
--- 
-2.13.0
-
diff --git a/meta/recipes-graphics/mesa/mesa-gl_17.1.1.bb 
b/meta/recipes-graphics/mesa/mesa-gl_17.1.3.bb
similarity index 100%
rename from meta/recipes-graphics/mesa/mesa-gl_17.1.1.bb
rename to meta/recipes-graphics/mesa/mesa-gl_17.1.3.bb
diff --git a/meta/recipes-graphics/mesa/mesa_17.1.1.bb 
b/meta/recipes-graphics/mesa/mesa_17.1.3.bb
similarity index 77%
rename from meta/recipes-graphics/mesa/mesa_17.1.1.bb
rename to meta/recipes-graphics/mesa/mesa_17.1.3.bb
index 55c6f71ab4..d9860213f2 100644
--- a/meta/recipes-graphics/mesa/mesa_17.1.1.bb
+++ b/meta/recipes-graphics/mesa/mesa_17.1.3.bb
@@ -4,12 +4,11 @@ SRC_URI = 
"https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
file://replace_glibc_check_with_linux.patch \
file://disable-asm-on-non-gcc.patch \
file://0001-Use-wayland-scanner-in-the-path.patch \
-   file://0001-util-rand_xor-add-missing-include-statements.patch \
file://0002-hardware-gloat.patch \
 "
 
-SRC_URI[md5sum] = "a4844bc6052578574f9629458bcbb749"
-SRC_URI[sha256sum] = 
"aed503f94c0c1630a162a3e276f4ee12a86764cee4cb92338ea2dea99a04e7ef"
+SRC_URI[md5sum] = "1946a93d543bc219427e2bebe2ac4752"
+SRC_URI[sha256sum] = 
"5f1ee9a8aea2880f887884df2dea0c16dd1b13eb42fd2e52265db0dc1b380e8c"
 
 #because we cannot rely on the fact that all apps will use pkgconfig,
 #make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
-- 
2.13.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Marek Vasut
On 06/20/2017 10:53 PM, Brad Mouring wrote:
> On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
>> On 06/20/2017 10:40 PM, Brad Mouring wrote:
>>> As implemented currently, the fw-utils recipe does not allow for
>>> ...
>>> +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
>>> +# By default, use the default included in the U-Boot source
>>> +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
>>> +
>>>  inherit uboot-config
>>>  
>>>  do_compile () {
>>> @@ -19,7 +24,7 @@ do_install () {
>>> install -d ${D}${sysconfdir}
>>> install -m 755 ${S}/tools/env/fw_printenv 
>>> ${D}${base_sbindir}/fw_printenv
>>> install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
>>> -   install -m 0644 ${S}/tools/env/fw_env.config 
>>> ${D}${sysconfdir}/fw_env.config
>>> +   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config
>>
>> Do we really need yet another variable ? Wouldn't it make more sense to
>> add do_install_append_yourmachine() {} in your meta-whatever to
>> u-boot-fw-utils_%.bbappend and install whatever additional files you need ?
> 
> This is (kinda) what we were doing, there was some discussion as to
> whether or not this made sense upstream.

Link?

> I was unsure of the
> acceptability of a do_install_append.*() clobbering a file of the
> original do_install().

That's probably what really needs to be discussed.

We can probably add some task which by default installs the
fw_env.config example and can be overridden in meta-whatever . Maybe the
others can jump into here and explain how to handle overriding the
default config file best.

-- 
Best regards,
Marek Vasut
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Otavio Salvador
On Tue, Jun 20, 2017 at 5:53 PM, Brad Mouring  wrote:
> On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
>> On 06/20/2017 10:40 PM, Brad Mouring wrote:
>> > As implemented currently, the fw-utils recipe does not allow for
>> > ...
>> > +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
>> > +# By default, use the default included in the U-Boot source
>> > +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
>> > +
>> >  inherit uboot-config
>> >
>> >  do_compile () {
>> > @@ -19,7 +24,7 @@ do_install () {
>> > install -d ${D}${sysconfdir}
>> > install -m 755 ${S}/tools/env/fw_printenv 
>> > ${D}${base_sbindir}/fw_printenv
>> > install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
>> > -   install -m 0644 ${S}/tools/env/fw_env.config 
>> > ${D}${sysconfdir}/fw_env.config
>> > +   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config
>>
>> Do we really need yet another variable ? Wouldn't it make more sense to
>> add do_install_append_yourmachine() {} in your meta-whatever to
>> u-boot-fw-utils_%.bbappend and install whatever additional files you need ?
>
> This is (kinda) what we were doing, there was some discussion as to
> whether or not this made sense upstream. I was unsure of the
> acceptability of a do_install_append.*() clobbering a file of the
> original do_install().
>
> Thanks for the input.

Or split up the configuration to u-boot-fw-utils-config package and
make u-boot-fw-utils generic? So we can have the configuration in a
specific package.


-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Brad Mouring
On Tue, Jun 20, 2017 at 10:43:51PM +0200, Marek Vasut wrote:
> On 06/20/2017 10:40 PM, Brad Mouring wrote:
> > As implemented currently, the fw-utils recipe does not allow for
> > ...
> > +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
> > +# By default, use the default included in the U-Boot source
> > +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
> > +
> >  inherit uboot-config
> >  
> >  do_compile () {
> > @@ -19,7 +24,7 @@ do_install () {
> > install -d ${D}${sysconfdir}
> > install -m 755 ${S}/tools/env/fw_printenv 
> > ${D}${base_sbindir}/fw_printenv
> > install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
> > -   install -m 0644 ${S}/tools/env/fw_env.config 
> > ${D}${sysconfdir}/fw_env.config
> > +   install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config
> 
> Do we really need yet another variable ? Wouldn't it make more sense to
> add do_install_append_yourmachine() {} in your meta-whatever to
> u-boot-fw-utils_%.bbappend and install whatever additional files you need ?

This is (kinda) what we were doing, there was some discussion as to
whether or not this made sense upstream. I was unsure of the
acceptability of a do_install_append.*() clobbering a file of the
original do_install().

Thanks for the input.

> >  }
> >  
> >  do_install_class-cross () {
> > 
> 
> 
> -- 
> Best regards,
> Marek Vasut

- Brad
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [RFC] u-boot-fw-utils: Allow target-specific fw_env.config

2017-06-20 Thread Marek Vasut
On 06/20/2017 10:40 PM, Brad Mouring wrote:
> As implemented currently, the fw-utils recipe does not allow for
> a board- or distro-specific fw_env.config override, instead opting
> to include the default (commented, example-filled) fw_env.config
> from the u-boot source. This change introduces a variable that allows
> for overriding this, while defaulting to the example config file from
> the u-boot source.
> 
> Signed-off-by: Brad Mouring 
> ---
>  meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb 
> b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
> index c2e8f0fb84..b06282ac03 100644
> --- a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
> +++ b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2017.05.bb
> @@ -7,6 +7,11 @@ INSANE_SKIP_${PN} = "already-stripped"
>  EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} 
> ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" 
> V=1'
>  EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} 
> ${LDFLAGS}" V=1'
>  
> +# U-Boot environment configuration file variables. This file is used
> +# by the U-Boot environment utilities "fw_printenv" and "fw_setenv".
> +# By default, use the default included in the U-Boot source
> +UBOOT_FW_ENV_CONFIG ??= "${S}/tools/env/fw_env.config"
> +
>  inherit uboot-config
>  
>  do_compile () {
> @@ -19,7 +24,7 @@ do_install () {
>   install -d ${D}${sysconfdir}
>   install -m 755 ${S}/tools/env/fw_printenv 
> ${D}${base_sbindir}/fw_printenv
>   install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
> - install -m 0644 ${S}/tools/env/fw_env.config 
> ${D}${sysconfdir}/fw_env.config
> + install -m 0644 ${UBOOT_FW_ENV_CONFIG} ${D}${sysconfdir}/fw_env.config

Do we really need yet another variable ? Wouldn't it make more sense to
add do_install_append_yourmachine() {} in your meta-whatever to
u-boot-fw-utils_%.bbappend and install whatever additional files you need ?

>  }
>  
>  do_install_class-cross () {
> 


-- 
Best regards,
Marek Vasut
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 0/3] Two new devtool plugins: export and import

2017-06-20 Thread leonardo . sandoval . gonzalez
From: Leonardo Sandoval 

These two plugins can be used to share the devtool workspace between users.

The following changes since commit ef506f58da3a95fba2696df749b2b81f9c118847:

  cve-check-tool: backport a patch to make CVE checking work (2017-05-18 
14:01:48 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib lsandov1/devtool-import-export
  
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lsandov1/devtool-import-export

Leonardo Sandoval (3):
  export: new plugin to export the devtool workspace
  devtool: function to replace strings inside a text file
  import: new plugin to import the devtool workspace

 scripts/lib/devtool/__init__.py |  37 +++
 scripts/lib/devtool/export.py   | 119 +
 scripts/lib/devtool/import.py   | 142 
 3 files changed, 298 insertions(+)
 create mode 100644 scripts/lib/devtool/export.py
 create mode 100644 scripts/lib/devtool/import.py

-- 
2.12.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 2/3] devtool: function to replace strings inside a text file

2017-06-20 Thread leonardo . sandoval . gonzalez
From: Leonardo Sandoval 

Signed-off-by: Leonardo Sandoval 
---
 scripts/lib/devtool/__init__.py | 37 +
 1 file changed, 37 insertions(+)

diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index d646b0cf63..95307e63fa 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -292,3 +292,40 @@ def ensure_npm(config, basepath, fixed_setup=False, 
check_exists=True):
 raise DevtoolError(msg)
 else:
 raise
+
+def replace_from_file(path, old, new):
+"""Replace strings on a file"""
+
+def read_file(path):
+data = None
+with open(path) as f:
+data = f.read()
+return data
+
+def write_file(path, data):
+if data is None:
+return
+wdata = data.rstrip() + "\n"
+with open(path, "w") as f:
+f.write(wdata)
+
+# In case old is None, return immediately
+if old is None:
+return
+try:
+rdata = read_file(path)
+except IOError as e:
+# if file does not exit, just quit, otherwise raise an exception
+if e.errno == errno.ENOENT:
+return
+else:
+raise
+
+old_contents = rdata.splitlines()
+new_contents = []
+for old_content in old_contents:
+try:
+new_contents.append(old_content.replace(old, new))
+except ValueError:
+pass
+write_file(path, "\n".join(new_contents))
-- 
2.12.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 3/3] import: new plugin to import the devtool workspace

2017-06-20 Thread leonardo . sandoval . gonzalez
From: Leonardo Sandoval 

Takes a tar archive created by 'devtool export' and export it (untar) to
workspace. By default, the whole tar archive is imported, thus there is no
way to limit what is imported.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10510

[YOCTO #10510]

Signed-off-by: Leonardo Sandoval 
---
 scripts/lib/devtool/import.py | 142 ++
 1 file changed, 142 insertions(+)
 create mode 100644 scripts/lib/devtool/import.py

diff --git a/scripts/lib/devtool/import.py b/scripts/lib/devtool/import.py
new file mode 100644
index 00..26084ec3b8
--- /dev/null
+++ b/scripts/lib/devtool/import.py
@@ -0,0 +1,142 @@
+# Development tool - import command plugin
+#
+# Copyright (C) 2014-2017 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""Devtool import plugin"""
+
+import os
+import tarfile
+import logging
+import re
+import json
+import fnmatch
+
+from devtool import standard, setup_tinfoil, replace_from_file
+from devtool import export
+
+logger = logging.getLogger('devtool')
+
+def devimport(args, config, basepath, workspace):
+"""Entry point for the devtool 'import' subcommand"""
+
+if not os.path.exists(args.file):
+logger.error('Tar archive %s does not exist. Export your workspace 
using "devtool export"')
+return 1
+
+
+tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
+
+imported = []
+tar = tarfile.open(args.file)
+members = tar.getmembers()
+
+# get exported metadata so values containing paths can be automatically 
replaced it
+export_workspace_path = export_workspace = None
+try:
+metadata = tar.getmember(export.metadata)
+tar.extract(metadata)
+with open(metadata.name) as fdm:
+export_workspace_path, export_workspace = json.load(fdm)
+os.unlink(metadata.name)
+except KeyError as ke:
+logger.error('The export metadata file created by "devtool export" was 
not found')
+return 1
+
+try:
+recipe_files = [os.path.basename(recipe[0]) for recipe in 
tinfoil.cooker.recipecaches[''].pkg_fn.items()]
+finally:
+if tinfoil:
+tinfoil.shutdown()
+
+for member in members:
+# do not export the metadata
+if member.name == export.metadata:
+continue
+
+is_bbappend = False
+
+# check bbappend has its corresponding recipe, if not warn continue 
with next tar member
+if member.name.startswith('appends'):
+is_bbappend = True
+append_root,_ = os.path.splitext(os.path.basename(member.name))
+
+# check on new recipes introduced by the export
+for exported_recipe in export_workspace.keys():
+if append_root.startswith(exported_recipe):
+break
+else:
+# check on current recipes
+for recipe_file in recipe_files:
+if fnmatch.fnmatch(recipe_file, append_root.replace('%', 
'') + '*'):
+break
+else:
+logger.warn('No recipe to append %s, skipping' % 
append_root)
+continue
+
+# extract
+path = os.path.join(config.workspace_path, member.name)
+if os.path.exists(path):
+# by default, no file overwrite is done unless -o is given by the 
user
+if args.overwrite:
+try:
+tar.extract(member, path=config.workspace_path)
+except PermissionError as pe:
+logger.warn(pe)
+else:
+logger.warn('File already present. Use --overwrite/-o to 
overwrite it: %s' % member.name)
+continue
+else:
+tar.extract(member, path=config.workspace_path)
+
+# bbappend require extra handling
+if is_bbappend:
+
+# we need to get the exported PN from the exported metadata,
+for exported_recipe in export_workspace.keys():
+if exported_recipe in member.name:
+pn = exported_recipe
+break
+else:
+logger.error('Exported metadata does not correspond to data')
+
+# Update EXTERNALSRC
+if export_workspace_path:
+# appends cre

[OE-core] [PATCH v3 1/3] export: new plugin to export the devtool workspace

2017-06-20 Thread leonardo . sandoval . gonzalez
From: Leonardo Sandoval 

By default, exports the whole workspace (all recipes) including the source code.
User can also limit what is exported with --included/--excluded flags. As
a result of this operation, a tar archive containing only workspace metadata
and its corresponding source code is created, which can be properly imported
with 'devtool import'.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10510

[YOCTO #10510]

Signed-off-by: Leonardo Sandoval 
---
 scripts/lib/devtool/export.py | 119 ++
 1 file changed, 119 insertions(+)
 create mode 100644 scripts/lib/devtool/export.py

diff --git a/scripts/lib/devtool/export.py b/scripts/lib/devtool/export.py
new file mode 100644
index 00..13ee258e7a
--- /dev/null
+++ b/scripts/lib/devtool/export.py
@@ -0,0 +1,119 @@
+# Development tool - export command plugin
+#
+# Copyright (C) 2014-2017 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""Devtool export plugin"""
+
+import os
+import argparse
+import tarfile
+import logging
+import datetime
+import json
+
+logger = logging.getLogger('devtool')
+
+# output files
+default_arcname_prefix = "workspace-export"
+metadata = '.export_metadata'
+
+def export(args, config, basepath, workspace):
+"""Entry point for the devtool 'export' subcommand"""
+
+def add_metadata(tar):
+"""Archive the workspace object"""
+# finally store the workspace metadata
+with open(metadata, 'w') as fd:
+fd.write(json.dumps((config.workspace_path, workspace)))
+tar.add(metadata)
+os.unlink(metadata)
+
+def add_recipe(tar, recipe, data):
+"""Archive recipe with proper arcname"""
+# Create a map of name/arcnames
+arcnames = []
+for key, name in data.items():
+if name:
+if key == 'srctree':
+# all sources, no matter where are located, goes into the 
sources directory
+arcname = 'sources/%s' % recipe
+else:
+arcname = name.replace(config.workspace_path, '')
+arcnames.append((name, arcname))
+
+for name, arcname in arcnames:
+tar.add(name, arcname=arcname)
+
+
+# Make sure workspace is non-empty and possible listed include/excluded 
recipes are in workspace
+if not workspace:
+logger.info('Workspace contains no recipes, nothing to export')
+return 0
+else:
+for param, recipes in 
{'include':args.include,'exclude':args.exclude}.items():
+for recipe in recipes:
+if recipe not in workspace:
+logger.error('Recipe (%s) on %s argument not in the 
current workspace' % (recipe, param))
+return 1
+
+name = args.file
+
+default_name = "%s-%s.tar.gz" % (default_arcname_prefix, 
datetime.datetime.now().strftime('%Y%m%d%H%M%S'))
+if not name:
+name = default_name
+else:
+# if name is a directory, append the default name
+if os.path.isdir(name):
+name = os.path.join(name, default_name)
+
+if os.path.exists(name) and not args.overwrite:
+logger.error('Tar archive %s exists. Use --overwrite/-o to overwrite 
it')
+return 1
+
+# if all workspace is excluded, quit
+if not len(set(workspace.keys()).difference(set(args.exclude))):
+logger.warn('All recipes in workspace excluded, nothing to export')
+return 0
+
+exported = []
+with tarfile.open(name, 'w:gz') as tar:
+if args.include:
+for recipe in args.include:
+add_recipe(tar, recipe, workspace[recipe])
+exported.append(recipe)
+else:
+for recipe, data in workspace.items():
+if recipe not in args.exclude:
+add_recipe(tar, recipe, data)
+exported.append(recipe)
+
+add_metadata(tar)
+
+logger.info('Tar archive created at %s with the following recipes: %s' % 
(name, ', '.join(exported)))
+return 0
+
+def register_commands(subparsers, context):
+"""Register devtool export subcommands"""
+parser = subparsers.add_parser('export',
+   help='Export workspace into a tar archive',
+   description='Export one or

[OE-core] [PATCH v3] slang: add ptest

2017-06-20 Thread Stefan Strogin
This patch adds ptest for slang, it uses `make runtests` to run tests.
The Makefile runs runtests.sh for each *.sl and *.slc tests.
runtests.sh is patched for printing test results in a common format,
Makefile is patched in order not to compile any dependencies.

Changes v2->v3: rebased on the latest master (1d9a88f6).

Signed-off-by: Stefan Strogin 
Cc: xe-linux-exter...@cisco.com
---
 meta/recipes-extended/slang/slang/run-ptest|  3 +++
 ...-add-output-in-the-format-result-testname.patch | 30 ++
 meta/recipes-extended/slang/slang_2.3.1a.bb| 25 +-
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/slang/slang/run-ptest
 create mode 100644 
meta/recipes-extended/slang/slang/test-add-output-in-the-format-result-testname.patch

diff --git a/meta/recipes-extended/slang/slang/run-ptest 
b/meta/recipes-extended/slang/slang/run-ptest
new file mode 100644
index 00..39f474af31
--- /dev/null
+++ b/meta/recipes-extended/slang/slang/run-ptest
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+make -C test runtests
diff --git 
a/meta/recipes-extended/slang/slang/test-add-output-in-the-format-result-testname.patch
 
b/meta/recipes-extended/slang/slang/test-add-output-in-the-format-result-testname.patch
new file mode 100644
index 00..27a9bb87ea
--- /dev/null
+++ 
b/meta/recipes-extended/slang/slang/test-add-output-in-the-format-result-testname.patch
@@ -0,0 +1,30 @@
+From 38688ee2754415cf2a1935dafb8278861b7315e7 Mon Sep 17 00:00:00 2001
+From: Stefan Strogin 
+Date: Thu, 2 Mar 2017 00:26:31 +0200
+Subject: [PATCH] test: add output in the format "result: testname"
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Stefan Strogin 
+---
+ src/test/runtests.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/test/runtests.sh b/src/test/runtests.sh
+index a3eaad0..64f0705 100755
+--- a/src/test/runtests.sh
 b/src/test/runtests.sh
+@@ -34,8 +34,10 @@ do
+ then
+   n_failed=`expr ${n_failed} + 1`
+   tests_failed="$tests_failed $testfile"
++  echo "FAIL: $testfile"
+ else
+ touch lastrun/$testfile
++  echo "PASS: $testfile"
+ fi
+ done
+ 
+-- 
+2.11.0
+
diff --git a/meta/recipes-extended/slang/slang_2.3.1a.bb 
b/meta/recipes-extended/slang/slang_2.3.1a.bb
index c71d80481f..b302104ee1 100644
--- a/meta/recipes-extended/slang/slang_2.3.1a.bb
+++ b/meta/recipes-extended/slang/slang_2.3.1a.bb
@@ -17,6 +17,8 @@ LIC_FILES_CHKSUM = 
"file://COPYING;md5=a52a18a472d4f7e45479b06563717c02"
 SRC_URI = "http://www.jedsoft.org/releases/${BPN}/${BP}.tar.bz2 \
file://no-x.patch \
file://dont-link-to-host.patch \
+   file://test-add-output-in-the-format-result-testname.patch \
+   file://run-ptest \
   "
 
 SRC_URI[md5sum] = "c5235313042ed0e71ec708f7b85ec241"
@@ -25,7 +27,7 @@ SRC_URI[sha256sum] = 
"54f0c3007fde918039c058965dffdfd6c5aec0bad0f4227192cc486021
 UPSTREAM_CHECK_URI = "http://www.jedsoft.org/releases/slang/";
 PREMIRRORS_append = "\n http://www.jedsoft.org/releases/slang/.* 
http://www.jedsoft.org/releases/slang/old/ \n"
 
-inherit autotools-brokensep
+inherit autotools-brokensep ptest
 CLEANBROKEN = "1"
 
 EXTRA_OECONF = "--without-onig"
@@ -49,6 +51,27 @@ do_configure_prepend() {
 cd ${B}
 }
 
+do_compile_ptest() {
+   oe_runmake -C src static
+   oe_runmake -C src/test sltest
+}
+
+do_install_ptest() {
+   mkdir ${D}${PTEST_PATH}/test
+   for f in Makefile sltest runtests.sh *.sl *.inc; do
+   cp ${S}/src/test/$f ${D}${PTEST_PATH}/test/
+   done
+   sed -e 's/\ \$(TEST_PGM)\.c\ assoc\.c\ list\.c\ 
\$(SLANGLIB)\/libslang\.a//' \
+   -e '/\$(CC).*(TEST_PGM)/d' \
+   -i ${D}${PTEST_PATH}/test/Makefile
+
+   cp ${S}/slsh/lib/require.sl ${D}${PTEST_PATH}/test/
+   sed -i 's/\.\.\/\.\.\/slsh\/lib\/require\.sl/require\.sl/' 
${D}${PTEST_PATH}/test/req.sl
+
+   cp ${S}/doc/text/slangfun.txt ${D}${PTEST_PATH}/test/
+   sed -i 's/\.\.\/\.\.\/doc\/text\/slangfun\.txt/slangfun\.txt/' 
${D}${PTEST_PATH}/test/docfun.sl
+}
+
 FILES_${PN} += "${libdir}/${BPN}/v2/modules/ ${datadir}/slsh/"
 
 PARALLEL_MAKE = ""
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v2 1/1] imagefeatures.py: Added testcase to track IMAGE_GEN_DEBUGFS

2017-06-20 Thread Humberto Ibarra
Add new testcase to check varibale IMAGE_GEN_DEBUGFS. Test makes
sure that debug filesystem is created accordingly.

[YOCTO #10906]

Signed-off-by: Humberto Ibarra 
---
 meta/lib/oeqa/selftest/cases/imagefeatures.py | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py 
b/meta/lib/oeqa/selftest/cases/imagefeatures.py
index 45a06fe..9a26253 100644
--- a/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -3,6 +3,7 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, 
runqemu
 from oeqa.core.decorator.oeid import OETestID
 from oeqa.utils.sshcontrol import SSHControl
 import os
+import glob
 
 class ImageFeatures(OESelftestTestCase):
 
@@ -123,3 +124,28 @@ class ImageFeatures(OESelftestTestCase):
 # check if result image is sparse
 image_stat = os.stat(image_path)
 self.assertTrue(image_stat.st_size > image_stat.st_blocks * 512)
+
+def test_image_gen_debugfs(self):
+"""
+Summary: Check debugfs generation
+Expected:1. core-image-minimal can be build with IMAGE_GEN_DEBUGFS 
variable set
+ 2. debug filesystem is created when variable set
+Product: oe-core
+Author:  Humberto Ibarra 
+"""
+
+image_name = 'core-image-minimal'
+clean_cmd = '-c clean %s' % image_name
+deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
+
+for pack_class in [ "rpm", "deb", "ipk"]:
+bitbake(clean_cmd)
+features = 'IMAGE_GEN_DEBUGFS = "1"\n'
+features += 'IMAGE_FSTYPES_DEBUGFS = "tar.bz2"\n'
+features += 'PACKAGE_CLASSES = "package_%s"' % pack_class
+self.write_config(features)
+
+bitbake(image_name)
+debug_files = 
glob.glob(os.path.join(deploy_dir_image,"*-dbg.rootfs.tar.bz2"))
+self.assertNotEqual(len(debug_files), 0,
+'debug filesystem not generated for %s' % pack_class)
-- 
2.7.5

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v2 0/1] imagefeatures.py: Added testcase to track IMAGE_GEN_DEBUGFS

2017-06-20 Thread Humberto Ibarra
Patch to add a testcase for IMAGE_GEN_DEBUGFS variable. Checks if debug 
filesystem
was created.

The following changes since commit 9ea5a31776440abd6468f003c5e1905f079446d3:

  ovmf: fix secureboot PACKAGECONFIG + OpenSSL update (2017-06-16 10:58:23 
+0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib humberto/ImageGenDebugfs
  
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=humberto/ImageGenDebugfs

Humberto Ibarra (1):
  imagefeatures.py: Added testcase to track IMAGE_GEN_DEBUGFS

 meta/lib/oeqa/selftest/cases/imagefeatures.py | 26 ++
 1 file changed, 26 insertions(+)

-- 
2.7.5

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] ltp: use upstream patch to fix faccessat/fchmodat build warnings

2017-06-20 Thread Fathi Boudra
Use 0037-faccessat-and-fchmodat-Fx-build-warnings.patch instead of
0012-fix-faccessat01.c-build-fails-with-security-flags.patch.
The new patch has been merged upstream and will be available in next LTP
release.

Signed-off-by: Fathi Boudra 
---
 ...essat01.c-build-fails-with-security-flags.patch | 70 --
 ...faccessat-and-fchmodat-Fix-build-warnings.patch | 68 +
 meta/recipes-extended/ltp/ltp_20170516.bb  |  2 +-
 3 files changed, 69 insertions(+), 71 deletions(-)
 delete mode 100644 
meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch
 create mode 100644 
meta/recipes-extended/ltp/ltp/0037-faccessat-and-fchmodat-Fix-build-warnings.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch
 
b/meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch
deleted file mode 100644
index 2600bd60d0..00
--- 
a/meta/recipes-extended/ltp/ltp/0012-fix-faccessat01.c-build-fails-with-security-flags.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 32f563008f95975d26d1c4fcb266c72c56f934be Mon Sep 17 00:00:00 2001
-From: Dengke Du 
-Date: Wed, 22 Feb 2017 01:21:55 -0500
-Subject: [PATCH] fix faccessat01.c build fails with security flags
-
-When the distro is poky-lsb, fix the following error:
-
-| In file included from ../../../../include/old/test.h:47:0,
-|  from faccessat01.c:44:
-| faccessat01.c: In function 'setup':
-| ../../../../include/old/old_safe_file_ops.h:55:27: error: format not a 
string literal and no format arguments [-Werror=format-security]
-|(path), (fmt), ## __VA_ARGS__)
-|^
-| faccessat01.c:132:2: note: in expansion of macro 'SAFE_FILE_PRINTF'
-|   SAFE_FILE_PRINTF(cleanup, testfile, testfile);
-|   ^~~~
-| ../../../../include/old/old_safe_file_ops.h:55:27: error: format not a 
string literal and no format arguments [-Werror=format-security]
-|(path), (fmt), ## __VA_ARGS__)
-|^
-| faccessat01.c:133:2: note: in expansion of macro 'SAFE_FILE_PRINTF'
-|   SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
-|   ^~~~
-
-This is because in macro "SAFE_FILE_PRINTF", its third argument should be a
-format arguments, but in file faccessat01.c, it passed the same argument to
-macro "SAFE_FILE_PRINTF", so it results in the fails. It should pass the format
-string to the third argument.
-
-The same for file fchmodat01.c.
-
-Signed-off-by: Dengke Du 
-Upstream-Status: Pending

- testcases/kernel/syscalls/faccessat/faccessat01.c | 4 ++--
- testcases/kernel/syscalls/fchmodat/fchmodat01.c   | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/testcases/kernel/syscalls/faccessat/faccessat01.c 
b/testcases/kernel/syscalls/faccessat/faccessat01.c
-index 622dfd3..1ca90e9 100644
 a/testcases/kernel/syscalls/faccessat/faccessat01.c
-+++ b/testcases/kernel/syscalls/faccessat/faccessat01.c
-@@ -129,8 +129,8 @@ void setup(void)
-   fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
-   fds[1] = fds[4] = fds[0];
- 
--  SAFE_FILE_PRINTF(cleanup, testfile, testfile);
--  SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
-+  SAFE_FILE_PRINTF(cleanup, testfile, "faccessattestfile%d.txt");
-+  SAFE_FILE_PRINTF(cleanup, testfile2, "%s/faccessattestfile%d.txt");
- 
-   fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
- 
-diff --git a/testcases/kernel/syscalls/fchmodat/fchmodat01.c 
b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
-index 6bf66d8..89d072a 100644
 a/testcases/kernel/syscalls/fchmodat/fchmodat01.c
-+++ b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
-@@ -127,8 +127,8 @@ void setup(void)
-   fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
-   fds[1] = fds[4] = fds[0];
- 
--  SAFE_FILE_PRINTF(cleanup, testfile, testfile);
--  SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
-+  SAFE_FILE_PRINTF(cleanup, testfile, "fchmodattest%d.txt");
-+  SAFE_FILE_PRINTF(cleanup, testfile2, "%s/fchmodattest%d.txt");
- 
-   fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
-   fds[3] = 100;
--- 
-2.8.1
-
diff --git 
a/meta/recipes-extended/ltp/ltp/0037-faccessat-and-fchmodat-Fix-build-warnings.patch
 
b/meta/recipes-extended/ltp/ltp/0037-faccessat-and-fchmodat-Fix-build-warnings.patch
new file mode 100644
index 00..99497d655a
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0037-faccessat-and-fchmodat-Fix-build-warnings.patch
@@ -0,0 +1,68 @@
+From 4141bdb441f7576a2e73abeb2a0fb1c7b8bd8647 Mon Sep 17 00:00:00 2001
+From: Naresh Kamboju 
+Date: Mon, 19 Jun 2017 19:01:21 +0530
+Subject: [PATCH 1/7] faccessat and fchmodat: Fix build warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixing below build warnings.
+
+ltp-full-20170516/testcases/kernel/s

[OE-core] [PATCH] bitbake.conf: Fix typo on variable name

2017-06-20 Thread Ricardo Ribalda Delgado
The variable is called ASSUME_PROVIDED, not ASSUME_PROVIDES.

Without this patch sdl-config is not properly linked into
build/tmp/hosttools and bitbake fails to find it.

Signed-off-by: Ricardo Ribalda Delgado 
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 80baec8d40d2..aa54e9266ba8 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -472,7 +472,7 @@ HOSTTOOLS += " \
 HOSTTOOLS += "ip ping ps scp ssh stty"
 
 # Link to sdl-config if using host SDL
-HOSTTOOLS += "${@bb.utils.contains('ASSUME_PROVIDES', 'libsdl-native', 
'sdl-config', '', d)}"
+HOSTTOOLS += "${@bb.utils.contains('ASSUME_PROVIDED', 'libsdl-native', 
'sdl-config', '', d)}"
 
 # Link to these if present
 HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc sftp socat sudo"
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] openssh: Atomically generate host keys

2017-06-20 Thread Joshua Watt
On Tue, 2017-06-20 at 10:52 +0200, Ulrich Ölmann wrote:
> On Tue, May 23, 2017 at 03:37:16PM +0100, Burton, Ross wrote:
> > On 7 May 2017 at 02:33, Joshua Watt  wrote:
> > > diff --git a/meta/recipes-
> > > connectivity/openssh/openssh/sshdgenkeys.service
> > > b/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
> > > index 148e6ad..af56404 100644
> > > --- a/meta/recipes-
> > > connectivity/openssh/openssh/sshdgenkeys.service
> > > +++ b/meta/recipes-
> > > connectivity/openssh/openssh/sshdgenkeys.service
> > > @@ -1,22 +1,14 @@
> > >  [Unit]
> > >  Description=OpenSSH Key Generation
> > >  RequiresMountsFor=/var /run
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_rsa_key
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_dsa_key
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_ecdsa_key
> > > -ConditionPathExists=!/var/run/ssh/ssh_host_ed25519_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_rsa_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_dsa_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_ecdsa_key
> > > -ConditionPathExists=!/etc/ssh/ssh_host_ed25519_key
> > > 
> > 
> > Can you not continue to use ConditionPathExists to only run this
> > unit if it
> > needs to run?  You can prepend the argument with | to make them
> > logical OR
> > instead of logical AND, if I'm reading this documentation
> > correctly.
> 
> Am I right that if we have a read-write mounted root-FS with already
> existing
> keys in /etc/ssh the service unit will nevertheless be started on
> _every_ boot
> now as the files which are checked for existance in /var/run/ssh are
> missing?

Yes. The service is actually run when the first ssh connection is made
(not at boot time), but it will do so on the first connection every
boot cycle. I don't know a way to do a complex conditional in systemd,
so this does the superset and makes sshd-check-key figure out if the
key actually needs generating or not. Perhaps there is a better way to
do this with the systemd conditional syntax that I am not aware of?
Ideally, the conditional checks in the systemd unit would be able to
use the SYSCONFDIR from /etc/default/ssh, but I'm not sure if that is
possible.

> 
> Best regards
> Ulrich
> -- 
> Pengutronix
> e.K.   | |
> Industrial Linux Solutions | http://www.pengutronix.d
> e/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-
> 0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917-
>  |

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] pkg-config: allow kernel to be build with esdk

2017-06-20 Thread Saul Wold

Ping on this patch?

It has been tested with a variety of shells (sh, bash, dash, ash).  Is
there any further concerns?

Sau!


On Wed, 2017-06-14 at 07:03 -0700, Saul Wold wrote:
> When the kernel's menuconfig target is called while using the esdk or
> an
> esdk-based container, the pkg-config info that is found is not
> correct.
> The pkg-config info is for the target, but we need the eSDK's
> information
> in order to build the host based menuconfig.
> 
> The new pkg-config script checks both that it's in SDK and being
> called
> from the check-lxdialog script in order to limit the scope of when
> the
> pkg-config automagically switches to pkg-config-native.
> 
> This script also replaces the default pkg-config-native script.
> 
> [YOCTO #11155]
> 
> Signed-off-by: Saul Wold 
> ---
>  .../pkgconfig/pkgconfig/pkg-config.in  | 22
> ++
>  meta/recipes-devtools/pkgconfig/pkgconfig_git.bb   | 14 ++
> 
>  2 files changed, 32 insertions(+), 4 deletions(-)
>  create mode 100644 meta/recipes-devtools/pkgconfig/pkgconfig/pkg-
> config.in
> 
> diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
> b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
> new file mode 100644
> index 000..dabec47
> --- /dev/null
> +++ b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +do_native=0
> +
> +parentpid=`ps -o ppid= -p $$`
> +parentpid_info=`ps -wo comm= -o args= -p $parentpid`
> +
> +# in this case we are in the esdk and being called from
> +# the kernel's make menuconfig
> +if [ "pkg-config-native" = "`basename $0`" ] ||
> +   ([ "$OE_SKIP_SDK_CHECK" = "1" ] &&
> +( echo $parentpid_info | grep -q check-lxdialog )) ; then
> + do_native=1
> +fi
> +
> +if [ $do_native -eq 1 ] ; then
> + PKG_CONFIG_PATH="@PATH_NATIVE@"
> + PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
> + unset PKG_CONFIG_SYSROOT_DIR
> +fi
> +
> +pkg-config.real "$@"
> diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> index e634021..3ec7458 100644
> --- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> +++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> @@ -12,6 +12,7 @@ SRCREV = "edf8e6f0ea77ede073f07bff0d2ae1fc7a38103b"
>  PV = "0.29.2+git${SRCPV}"
>  
>  SRC_URI = "git://anongit.freedesktop.org/pkg-config \
> +   file://pkg-config.in \
> file://pkg-config-native.in \
> file://fix-glib-configure-libtool-usage.patch \
> file://0001-glib-gettext.m4-Update-AM_GLIB_GNU_GETTEXT-
> to-match-.patch \
> @@ -47,11 +48,16 @@ FILES_${PN} += "${datadir}/aclocal/pkg.m4"
>  # specifying an appropriate provide.
>  RPROVIDES_${PN} += "pkgconfig(pkg-config)"
>  
> +do_install_append () {
> + mv ${D}${bindir}/pkg-config ${D}${bindir}/pkg-config.real
> + sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
> + -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
> + < ${WORKDIR}/pkg-config.in > ${B}/pkg-config
> + install -m755 ${B}/pkg-config ${D}${bindir}/pkg-config
> +}
> +
>  # Install a pkg-config-native wrapper that will use the native
> sysroot instead
>  # of the MACHINE sysroot, for using pkg-config when building native
> tools.
>  do_install_append_class-native () {
> -sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
> --e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
> -< ${WORKDIR}/pkg-config-native.in > ${B}/pkg-config-native
> -install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config-
> native
> + install -m755 ${B}/pkg-config ${D}${bindir}/pkg-config-
> native
>  }
> -- 
> 2.7.4
> 
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCHv2 1/2] libdnf: update to 0.9.1

2017-06-20 Thread Alexander Kanavin
Signed-off-by: Alexander Kanavin 
---
 meta/recipes-devtools/libdnf/{libdnf_git.bb => libdnf_0.9.1.bb} | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
 rename meta/recipes-devtools/libdnf/{libdnf_git.bb => libdnf_0.9.1.bb} (94%)

diff --git a/meta/recipes-devtools/libdnf/libdnf_git.bb 
b/meta/recipes-devtools/libdnf/libdnf_0.9.1.bb
similarity index 94%
rename from meta/recipes-devtools/libdnf/libdnf_git.bb
rename to meta/recipes-devtools/libdnf/libdnf_0.9.1.bb
index 2acbd89659a..e5c47bf8dbe 100644
--- a/meta/recipes-devtools/libdnf/libdnf_git.bb
+++ b/meta/recipes-devtools/libdnf/libdnf_0.9.1.bb
@@ -10,8 +10,7 @@ SRC_URI = "git://github.com/rpm-software-management/libdnf \

file://0001-Get-parameters-for-both-libsolv-and-libsolvext-libdn.patch \
"
 
-PV = "0.8.1"
-SRCREV = "233287f4f80e24a917d5f6a26967f54080ffa255"
+SRCREV = "d5ecb17c0fde4f99c6a80e6f162510465b8d28f9"
 
 S = "${WORKDIR}/git"
 
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCHv2 2/2] dnf: update to 2.5.1

2017-06-20 Thread Alexander Kanavin
Drop 0001-Revert-proper-check-of-releasever-when-using-install.patch
as the problem has been solved upstream.

Signed-off-by: Alexander Kanavin 
---
 ...er-check-of-releasever-when-using-install.patch | 105 -
 .../dnf/{dnf_git.bb => dnf_2.5.1.bb}   |   4 +-
 2 files changed, 1 insertion(+), 108 deletions(-)
 delete mode 100644 
meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
 rename meta/recipes-devtools/dnf/{dnf_git.bb => dnf_2.5.1.bb} (94%)

diff --git 
a/meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
 
b/meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
deleted file mode 100644
index 879ecfa30d7..000
--- 
a/meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From 8cd0503612573c455f34db74cd1c2216ed25b69c Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin 
-Date: Wed, 12 Apr 2017 15:42:06 +0300
-Subject: [PATCH] Revert "proper check of releasever, when using installroot
- (RhBug:1417542)"
-
-This reverts commit 3ddf684b7c67a2b384aa99dde53d8a43218f2e68, as it's causing
-breakage when installing packages into a pristin rootfs. Upstream has been 
notified:
-https://bugzilla.redhat.com/show_bug.cgi?id=1441636
-
-Upstream-Status: Inappropriate [pending proper fix]
-Signed-off-by: Alex Kanavin 

- dnf/rpm/__init__.py | 59 +
- doc/command_ref.rst |  3 +--
- 2 files changed, 29 insertions(+), 33 deletions(-)
-
-diff --git a/dnf/rpm/__init__.py b/dnf/rpm/__init__.py
-index 5976acd6..1d50e6a0 100644
 a/dnf/rpm/__init__.py
-+++ b/dnf/rpm/__init__.py
-@@ -30,38 +30,35 @@ def detect_releasever(installroot):
- # :api
- """Calculate the release version for the system."""
- 
--# if installroot is empty dir releasever is None,
--# that's why releasever is checked from '/'
--for root in [installroot, "/"]:
--ts = transaction.initReadOnlyTransaction(root=root)
--ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS))
--for distroverpkg in dnf.const.DISTROVERPKG:
--try:
--idx = ts.dbMatch('provides', distroverpkg)
--except (TypeError, rpm.error) as e:
--raise dnf.exceptions.Error('Error: %s' % str(e))
--if not len(idx):
--continue
--try:
--hdr = next(idx)
--except StopIteration:
--msg = 'Error: rpmdb failed to list provides. Try: rpm 
--rebuilddb'
--raise dnf.exceptions.Error(msg)
--releasever = hdr['version']
--try:
--off = hdr[rpm.RPMTAG_PROVIDENAME].index(distroverpkg)
--flag = hdr[rpm.RPMTAG_PROVIDEFLAGS][off]
--ver = hdr[rpm.RPMTAG_PROVIDEVERSION][off]
--if flag == rpm.RPMSENSE_EQUAL and ver:
--if hdr['name'] != distroverpkg:
--# override the package version
--releasever = ver
--except (ValueError, KeyError, IndexError):
--pass
-+ts = transaction.initReadOnlyTransaction(root=installroot)
-+ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS))
-+for distroverpkg in dnf.const.DISTROVERPKG:
-+try:
-+idx = ts.dbMatch('provides', distroverpkg)
-+except (TypeError, rpm.error) as e:
-+raise dnf.exceptions.Error('Error: %s' % str(e))
-+if not len(idx):
-+continue
-+try:
-+hdr = next(idx)
-+except StopIteration:
-+msg = 'Error: rpmdb failed to list provides. Try: rpm --rebuilddb'
-+raise dnf.exceptions.Error(msg)
-+releasever = hdr['version']
-+try:
-+off = hdr[rpm.RPMTAG_PROVIDENAME].index(distroverpkg)
-+flag = hdr[rpm.RPMTAG_PROVIDEFLAGS][off]
-+ver = hdr[rpm.RPMTAG_PROVIDEVERSION][off]
-+if flag == rpm.RPMSENSE_EQUAL and ver:
-+if hdr['name'] != distroverpkg:
-+# override the package version
-+releasever = ver
-+except (ValueError, KeyError, IndexError):
-+pass
- 
--if is_py3bytes(releasever):
--releasever = str(releasever, "utf-8")
--return releasever
-+if is_py3bytes(releasever):
-+releasever = str(releasever, "utf-8")
-+return releasever
- return None
- 
- 
-diff --git a/doc/command_ref.rst b/doc/command_ref.rst
-index 77e885ab..3dd451b5 100644
 a/doc/command_ref.rst
-+++ b/doc/command_ref.rst
-@@ -205,8 +205,7 @@ Options
-  Note: You may also want to use the command-line option
-  ``--releasever=`` when creating the installroot otherwise the
-  *$releasever* value is taken from th

Re: [OE-core] [Openembedded-architecture] OE-Core/Yocto Project's first CVE (CVE-2017-9731)

2017-06-20 Thread Paul Eggleton
On Tuesday, 20 June 2017 3:27:15 PM CEST you wrote:
> On 2017-06-20 04:30 AM, Paul Eggleton wrote:
> > On Monday, 19 June 2017 5:31:10 PM CEST Sean Hudson wrote:
> >> On 2017-06-19 09:05 AM, Mark Hatle wrote:
> >>> It would be reasonable to write up a 'best practices' type document. 
> >>> Explaining that simply due to the nature of building many of these
> >>> things will be 'leaked' and where some of them are leaked through.
> >>> (Package generation, compilation, etc for instance.)
> >>
> >> That sounds reasonable, although, TBH, if someone is adding credentials
> >> to their SRC_URIs, I would expect that a best practice would be ignored.
> >>  Perhaps adding a detection routine that emitted a warning during
> >> parsing for credentials in the SRC_URI might be warranted?  Thoughts?
> > 
> > This might be useful yes. I think the stumbling block is that at the
> > moment we would have to have it off by default and then the user is almost
> > certainly not going to know to turn it on. Perhaps this is another thing 
> > that we might check in a "production" vs. "development" mode where the
> > user can easily switch to the former to enable a set of more stringent 
> > checks.
> 
> I'm not sure I follow.  What would prevent us from turning on a warning
> that detected credentials in a SRC_URI by default?  Even with Richard's
> change to prevent the information from propagating into the .ipk, it
> seems useful to notify the user.  Personally, I'd like to know if one of
> the recipes I'm using has such information in it regardless of whether
> I'm generating a development or a production image.

You might, sure, but if you're in an environment where during development your 
source is on a server requiring such credentials then it's going to be a bit 
annoying to keep seeing that warning.

Anyway, there's certainly no harm in adding such a check, whether it's on by 
default or not is a separate issue.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [Openembedded-architecture] OE-Core/Yocto Project's first CVE (CVE-2017-9731)

2017-06-20 Thread Sean Hudson
On 2017-06-20 04:30 AM, Paul Eggleton wrote:
> On Monday, 19 June 2017 5:31:10 PM CEST Sean Hudson wrote:
>> On 2017-06-19 09:05 AM, Mark Hatle wrote:
>>> It would be reasonable to write up a 'best practices' type document. 
>>> Explaining that simply due to the nature of building many of these things
>>> will be 'leaked' and where some of them are leaked through.  (Package
>>> generation, compilation, etc for instance.)
>>
>> That sounds reasonable, although, TBH, if someone is adding credentials
>> to their SRC_URIs, I would expect that a best practice would be ignored.
>>  Perhaps adding a detection routine that emitted a warning during
>> parsing for credentials in the SRC_URI might be warranted?  Thoughts?
> 
> This might be useful yes. I think the stumbling block is that at the moment we
> would have to have it off by default and then the user is almost certainly not
> going to know to turn it on. Perhaps this is another thing that we might 
> check 
> in a "production" vs. "development" mode where the user can easily switch to
> the former to enable a set of more stringent checks.

I'm not sure I follow.  What would prevent us from turning on a warning
that detected credentials in a SRC_URI by default?  Even with Richard's
change to prevent the information from propagating into the .ipk, it
seems useful to notify the user.  Personally, I'd like to know if one of
the recipes I'm using has such information in it regardless of whether
I'm generating a development or a production image.


-- 
Sean



signature.asc
Description: OpenPGP digital signature
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/2] dnf: update to 2.5.1

2017-06-20 Thread Alexander Kanavin
Drop 0001-Revert-proper-check-of-releasever-when-using-install.patch
as the problem has been solved upstream.

Signed-off-by: Alexander Kanavin 
---
 ...er-check-of-releasever-when-using-install.patch | 105 -
 meta/recipes-devtools/dnf/dnf_git.bb   |   5 +-
 2 files changed, 2 insertions(+), 108 deletions(-)
 delete mode 100644 
meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch

diff --git 
a/meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
 
b/meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
deleted file mode 100644
index 879ecfa30d7..000
--- 
a/meta/recipes-devtools/dnf/dnf/0001-Revert-proper-check-of-releasever-when-using-install.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From 8cd0503612573c455f34db74cd1c2216ed25b69c Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin 
-Date: Wed, 12 Apr 2017 15:42:06 +0300
-Subject: [PATCH] Revert "proper check of releasever, when using installroot
- (RhBug:1417542)"
-
-This reverts commit 3ddf684b7c67a2b384aa99dde53d8a43218f2e68, as it's causing
-breakage when installing packages into a pristin rootfs. Upstream has been 
notified:
-https://bugzilla.redhat.com/show_bug.cgi?id=1441636
-
-Upstream-Status: Inappropriate [pending proper fix]
-Signed-off-by: Alex Kanavin 

- dnf/rpm/__init__.py | 59 +
- doc/command_ref.rst |  3 +--
- 2 files changed, 29 insertions(+), 33 deletions(-)
-
-diff --git a/dnf/rpm/__init__.py b/dnf/rpm/__init__.py
-index 5976acd6..1d50e6a0 100644
 a/dnf/rpm/__init__.py
-+++ b/dnf/rpm/__init__.py
-@@ -30,38 +30,35 @@ def detect_releasever(installroot):
- # :api
- """Calculate the release version for the system."""
- 
--# if installroot is empty dir releasever is None,
--# that's why releasever is checked from '/'
--for root in [installroot, "/"]:
--ts = transaction.initReadOnlyTransaction(root=root)
--ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS))
--for distroverpkg in dnf.const.DISTROVERPKG:
--try:
--idx = ts.dbMatch('provides', distroverpkg)
--except (TypeError, rpm.error) as e:
--raise dnf.exceptions.Error('Error: %s' % str(e))
--if not len(idx):
--continue
--try:
--hdr = next(idx)
--except StopIteration:
--msg = 'Error: rpmdb failed to list provides. Try: rpm 
--rebuilddb'
--raise dnf.exceptions.Error(msg)
--releasever = hdr['version']
--try:
--off = hdr[rpm.RPMTAG_PROVIDENAME].index(distroverpkg)
--flag = hdr[rpm.RPMTAG_PROVIDEFLAGS][off]
--ver = hdr[rpm.RPMTAG_PROVIDEVERSION][off]
--if flag == rpm.RPMSENSE_EQUAL and ver:
--if hdr['name'] != distroverpkg:
--# override the package version
--releasever = ver
--except (ValueError, KeyError, IndexError):
--pass
-+ts = transaction.initReadOnlyTransaction(root=installroot)
-+ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS))
-+for distroverpkg in dnf.const.DISTROVERPKG:
-+try:
-+idx = ts.dbMatch('provides', distroverpkg)
-+except (TypeError, rpm.error) as e:
-+raise dnf.exceptions.Error('Error: %s' % str(e))
-+if not len(idx):
-+continue
-+try:
-+hdr = next(idx)
-+except StopIteration:
-+msg = 'Error: rpmdb failed to list provides. Try: rpm --rebuilddb'
-+raise dnf.exceptions.Error(msg)
-+releasever = hdr['version']
-+try:
-+off = hdr[rpm.RPMTAG_PROVIDENAME].index(distroverpkg)
-+flag = hdr[rpm.RPMTAG_PROVIDEFLAGS][off]
-+ver = hdr[rpm.RPMTAG_PROVIDEVERSION][off]
-+if flag == rpm.RPMSENSE_EQUAL and ver:
-+if hdr['name'] != distroverpkg:
-+# override the package version
-+releasever = ver
-+except (ValueError, KeyError, IndexError):
-+pass
- 
--if is_py3bytes(releasever):
--releasever = str(releasever, "utf-8")
--return releasever
-+if is_py3bytes(releasever):
-+releasever = str(releasever, "utf-8")
-+return releasever
- return None
- 
- 
-diff --git a/doc/command_ref.rst b/doc/command_ref.rst
-index 77e885ab..3dd451b5 100644
 a/doc/command_ref.rst
-+++ b/doc/command_ref.rst
-@@ -205,8 +205,7 @@ Options
-  Note: You may also want to use the command-line option
-  ``--releasever=`` when creating the installroot otherwise the
-  *$releasever* value is taken from the rpmdb within the installroot (and thus
-- it is empty at time of c

[OE-core] [PATCH 1/2] libdnf: update to 0.9.1

2017-06-20 Thread Alexander Kanavin
Signed-off-by: Alexander Kanavin 
---
 meta/recipes-devtools/libdnf/libdnf_git.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/libdnf/libdnf_git.bb 
b/meta/recipes-devtools/libdnf/libdnf_git.bb
index 2acbd89659a..adc8c686d06 100644
--- a/meta/recipes-devtools/libdnf/libdnf_git.bb
+++ b/meta/recipes-devtools/libdnf/libdnf_git.bb
@@ -10,8 +10,8 @@ SRC_URI = "git://github.com/rpm-software-management/libdnf \

file://0001-Get-parameters-for-both-libsolv-and-libsolvext-libdn.patch \
"
 
-PV = "0.8.1"
-SRCREV = "233287f4f80e24a917d5f6a26967f54080ffa255"
+PV = "0.9.1"
+SRCREV = "d5ecb17c0fde4f99c6a80e6f162510465b8d28f9"
 
 S = "${WORKDIR}/git"
 
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 3/3 v2] meta: Fix return value checks from subprocess.call()'s

2017-06-20 Thread Mikko.Rapeli
Hi,

On Thu, Jun 01, 2017 at 06:53:14PM +0300, Mikko Rapeli wrote:
> Python function subprocess.call() returns the return value of the
> executed process. If return values are not checked, errors may
> go unnoticed and bad things can happen.
> 
> Change all callers of subprocess.call() which do not check for
> the return value to use subprocess.check_call() which raises
> CalledProcessError if the subprocess returns with non-zero value.
> 
> https://docs.python.org/2/library/subprocess.html#using-the-subprocess-module
> 
> All users of the function were found with:
> 
> $ git grep "subprocess\.call" | \
>   egrep -v 'if.*subprocess\.call|=\ 
> +subprocess\.call|return.*subprocess\.call'
> 
> Tested similar patch on top of yocto jethro. Only compile tested
> core-image-minimal on poky master branch.

The bitbake and scripts parts from this patch series were merged already, but
this not.

Are there problems with this patch?

-Mikko

> Signed-off-by: Mikko Rapeli 
> ---
>  meta/classes/archiver.bbclass| 2 +-
>  meta/classes/cml1.bbclass| 2 +-
>  meta/classes/kernel-module-split.bbclass | 2 +-
>  meta/classes/sstate.bbclass  | 4 ++--
>  meta/lib/oeqa/utils/buildproject.py  | 2 +-
>  meta/lib/oeqa/utils/targetbuild.py   | 4 ++--
>  meta/recipes-extended/cups/cups.inc  | 2 +-
>  7 files changed, 9 insertions(+), 9 deletions(-)
> 
> v2:
> split patches to bitbake, meta and scripts
> 
> v1:
> http://lists.openembedded.org/pipermail/openembedded-core/2017-May/136901.html
> 
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index 2c04557..703eacb 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -288,7 +288,7 @@ def create_diff_gz(d, src_orig, src, ar_outdir):
>  os.chdir(dirname)
>  out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF'))
>  diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, 
> basename, out_file)
> -subprocess.call(diff_cmd, shell=True)
> +subprocess.check_call(diff_cmd, shell=True)
>  bb.utils.remove(src_patched, recurse=True)
>  
>  # Run do_unpack and do_patch
> diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
> index 38e6613..eb8e790 100644
> --- a/meta/classes/cml1.bbclass
> +++ b/meta/classes/cml1.bbclass
> @@ -63,7 +63,7 @@ python do_diffconfig() {
>  
>  if isdiff:
>  statement = 'diff --unchanged-line-format= --old-line-format= 
> --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment
> -subprocess.call(statement, shell=True)
> +subprocess.check_call(statement, shell=True)
>  
>  shutil.copy(configorig, config)
>  
> diff --git a/meta/classes/kernel-module-split.bbclass 
> b/meta/classes/kernel-module-split.bbclass
> index 5e10dcf..1035525 100644
> --- a/meta/classes/kernel-module-split.bbclass
> +++ b/meta/classes/kernel-module-split.bbclass
> @@ -47,7 +47,7 @@ python split_kernel_module_packages () {
>  tf = tempfile.mkstemp()
>  tmpfile = tf[1]
>  cmd = "%sobjcopy -j .modinfo -O binary %s %s" % 
> (d.getVar("HOST_PREFIX") or "", file, tmpfile)
> -subprocess.call(cmd, shell=True)
> +subprocess.check_call(cmd, shell=True)
>  f = open(tmpfile)
>  l = f.read().split("\000")
>  f.close()
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 0a12935..f446c3d 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -404,7 +404,7 @@ python sstate_hardcode_path_unpack () {
>  return
>  
>  bb.note("Replacing fixme paths in sstate package: %s" % 
> (sstate_hardcode_cmd))
> -subprocess.call(sstate_hardcode_cmd, shell=True)
> +subprocess.check_call(sstate_hardcode_cmd, shell=True)
>  
>  # Need to remove this or we'd copy it into the target directory and 
> may 
>  # conflict with another writer
> @@ -453,7 +453,7 @@ def sstate_clean_manifest(manifest, d, prefix=None):
>  if os.path.exists(manifest + ".postrm"):
>  import subprocess
>  os.chmod(postrm, 0o755)
> -subprocess.call(postrm, shell=True)
> +subprocess.check_call(postrm, shell=True)
>  oe.path.remove(postrm)
>  
>  oe.path.remove(manifest)
> diff --git a/meta/lib/oeqa/utils/buildproject.py 
> b/meta/lib/oeqa/utils/buildproject.py
> index 487f08b..721f35d 100644
> --- a/meta/lib/oeqa/utils/buildproject.py
> +++ b/meta/lib/oeqa/utils/buildproject.py
> @@ -52,4 +52,4 @@ class BuildProject(metaclass=ABCMeta):
>  
>  def clean(self):
>  self._run('rm -rf %s' % self.targetdir)
> -subprocess.call('rm -f %s' % self.localarchive, shell=True)
> +subprocess.check_call('rm -f %s' % self.localarchive, shell=True)
> diff --git a/meta/lib/oeqa/utils/targetbuild.py 
> b/meta/lib/oeqa/utils/targetbuild.py
> index 9249fa2..1202d57 100644
> --- a/meta/lib/oeqa/utils/targetbuild.p

Re: [OE-core] [PATCH v3] image_types.bbclass: Prompt error message on missing setting in UBI and UBIFS

2017-06-20 Thread Andrea Adami
On Mon, Jun 19, 2017 at 9:36 PM,   wrote:
> From: Choong YinThong 
>
> Prompt error message to guide user add argument
> MKUBIFS_ARGS and UBINIZE_ARGS in local.conf on
> every UBI and UBIFS image creation.
>
> [YOCTO #11589]
>
> Signed-off-by: Choong YinThong 
> ---
>  meta/classes/image_types.bbclass | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/meta/classes/image_types.bbclass 
> b/meta/classes/image_types.bbclass
> index 7749b00..48338ac 100644
> --- a/meta/classes/image_types.bbclass
> +++ b/meta/classes/image_types.bbclass
> @@ -145,6 +145,14 @@ UBI_VOLNAME ?= "${MACHINE}-rootfs"
>  multiubi_mkfs() {
> local mkubifs_args="$1"
> local ubinize_args="$2"
> +
> +# Added prompt error message for ubi and ubifs image creation.
> +if [ -z "$mkubifs_args"] || [ -z "$ubinize_args" ]; then
> +bberror "MKUBIFS_ARGS and UBINIZE_ARGS argument have to set in 
> local.conf for UBI and UBIFS image creation."

Why in local.conf ? It is not globally valid if you do multi-machine builds.
I'd say the right place is the machine.conf in the BSP layer.

Andrea

> +bberror "Detail please visit this link 
> http://www.linux-mtd.infradead.org/faq/ubifs.html";
> +return
> +fi
> +
> if [ -z "$3" ]; then
> local vname=""
> else
> --
> 2.7.4
>
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/2] lib/oe/distro_check: drop Mandriva from create_distro_packages_list()

2017-06-20 Thread Joshua Lock
Mandriva is no longer maintained, with its last release having been in
2011. It's no longer useful as a yard-stick distro, therefore drop it from
distro_check.create_distro_packages_list()

Signed-off-by: Joshua Lock 
---
 meta/lib/oe/distro_check.py | 8 
 1 file changed, 8 deletions(-)

diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index 7a727dd..e775c3a 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -83,13 +83,6 @@ def get_latest_released_opensuse_source_package_list(d):
 package_names |= 
get_source_package_list_from_url("http://download.opensuse.org/update/leap/%s/oss/src/";
 % latest, "updates", d)
 return latest, package_names
 
-def get_latest_released_mandriva_source_package_list(d):
-"Returns list of all the name os packages in the latest mandriva distro"
-latest = 
find_latest_numeric_release("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/";,
 d)
-package_names = 
get_source_package_list_from_url("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/main/release/";
 % latest, "main", d)
-package_names |= 
get_source_package_list_from_url("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/main/updates/";
 % latest, "updates", d)
-return latest, package_names
-
 def get_latest_released_clear_source_package_list(d):
 latest = 
find_latest_numeric_release("https://download.clearlinux.org/releases/";, d)
 package_names = 
get_source_package_list_from_url("https://download.clearlinux.org/releases/%s/clear/source/SRPMS/";
 % latest, "main", d)
@@ -162,7 +155,6 @@ def create_distro_packages_list(distro_check_dir, d):
 ("Ubuntu", 
get_latest_released_ubuntu_source_package_list),
 ("Fedora", 
get_latest_released_fedora_source_package_list),
 ("openSUSE", 
get_latest_released_opensuse_source_package_list),
-("Mandriva", 
get_latest_released_mandriva_source_package_list),
 ("Clear", 
get_latest_released_clear_source_package_list),
)
 
-- 
2.9.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2] lib/oe/distro_check: update openSUSE to use Leap url formats

2017-06-20 Thread Joshua Lock
Since openSUSE switched to their dual development model of Leap and
Tumbleweed the urls we need to check for package lists has changed. Update
get_latest_released_opensuse_source_package_list() to use the new Leap
urls.

Signed-off-by: Joshua Lock 
---
 meta/lib/oe/distro_check.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index 37f04ed..7a727dd 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -77,10 +77,10 @@ def get_latest_released_fedora_source_package_list(d):
 
 def get_latest_released_opensuse_source_package_list(d):
 "Returns list of all the name os packages in the latest opensuse distro"
-latest = 
find_latest_numeric_release("http://download.opensuse.org/source/distribution/",d)
+latest = 
find_latest_numeric_release("http://download.opensuse.org/source/distribution/leap";,
 d)
 
-package_names = 
get_source_package_list_from_url("http://download.opensuse.org/source/distribution/%s/repo/oss/suse/src/";
 % latest, "main", d)
-package_names |= 
get_source_package_list_from_url("http://download.opensuse.org/update/%s/src/"; 
% latest, "updates", d)
+package_names = 
get_source_package_list_from_url("http://download.opensuse.org/source/distribution/leap/%s/repo/oss/suse/src/";
 % latest, "main", d)
+package_names |= 
get_source_package_list_from_url("http://download.opensuse.org/update/leap/%s/oss/src/";
 % latest, "updates", d)
 return latest, package_names
 
 def get_latest_released_mandriva_source_package_list(d):
@@ -161,7 +161,7 @@ def create_distro_packages_list(distro_check_dir, d):
 ("Debian", 
get_latest_released_debian_source_package_list),
 ("Ubuntu", 
get_latest_released_ubuntu_source_package_list),
 ("Fedora", 
get_latest_released_fedora_source_package_list),
-("OpenSuSE", 
get_latest_released_opensuse_source_package_list),
+("openSUSE", 
get_latest_released_opensuse_source_package_list),
 ("Mandriva", 
get_latest_released_mandriva_source_package_list),
 ("Clear", 
get_latest_released_clear_source_package_list),
)
-- 
2.9.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [Openembedded-architecture] OE-Core/Yocto Project's first CVE (CVE-2017-9731)

2017-06-20 Thread Paul Eggleton
On Monday, 19 June 2017 5:31:10 PM CEST Sean Hudson wrote:
> On 2017-06-19 09:05 AM, Mark Hatle wrote:
> > It would be reasonable to write up a 'best practices' type document. 
> > Explaining that simply due to the nature of building many of these things
> > will be 'leaked' and where some of them are leaked through.  (Package
> > generation, compilation, etc for instance.)
> 
> That sounds reasonable, although, TBH, if someone is adding credentials
> to their SRC_URIs, I would expect that a best practice would be ignored.
>  Perhaps adding a detection routine that emitted a warning during
> parsing for credentials in the SRC_URI might be warranted?  Thoughts?

This might be useful yes. I think the stumbling block is that at the moment we
would have to have it off by default and then the user is almost certainly not
going to know to turn it on. Perhaps this is another thing that we might check 
in a "production" vs. "development" mode where the user can easily switch to
the former to enable a set of more stringent checks.

FWIW it's not quite the same thing but some of what you might want to do when
moving to production is described in this section of the manual (which, full
disclosure, I had a hand in writing):

  
http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#making-images-more-secure

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] openssh: Atomically generate host keys

2017-06-20 Thread Ulrich Ölmann
On Tue, May 23, 2017 at 03:37:16PM +0100, Burton, Ross wrote:
> On 7 May 2017 at 02:33, Joshua Watt  wrote:
> > diff --git a/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
> > b/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
> > index 148e6ad..af56404 100644
> > --- a/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
> > +++ b/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
> > @@ -1,22 +1,14 @@
> >  [Unit]
> >  Description=OpenSSH Key Generation
> >  RequiresMountsFor=/var /run
> > -ConditionPathExists=!/var/run/ssh/ssh_host_rsa_key
> > -ConditionPathExists=!/var/run/ssh/ssh_host_dsa_key
> > -ConditionPathExists=!/var/run/ssh/ssh_host_ecdsa_key
> > -ConditionPathExists=!/var/run/ssh/ssh_host_ed25519_key
> > -ConditionPathExists=!/etc/ssh/ssh_host_rsa_key
> > -ConditionPathExists=!/etc/ssh/ssh_host_dsa_key
> > -ConditionPathExists=!/etc/ssh/ssh_host_ecdsa_key
> > -ConditionPathExists=!/etc/ssh/ssh_host_ed25519_key
> >
> 
> Can you not continue to use ConditionPathExists to only run this unit if it
> needs to run?  You can prepend the argument with | to make them logical OR
> instead of logical AND, if I'm reading this documentation correctly.

Am I right that if we have a read-write mounted root-FS with already existing
keys in /etc/ssh the service unit will nevertheless be started on _every_ boot
now as the files which are checked for existance in /var/run/ssh are missing?

Best regards
Ulrich
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] connman: fix build-time warning with sysvinit

2017-06-20 Thread Maxin B. John
Due to recent modifications related to systemd, sysvinit builds began
to show this warning:

WARNING: connman-1.34-r0 do_package: connman: NOT adding alternative
provide /etc/resolv.conf: /etc/resolv-conf.connman does not exist

Fix this warning by making those updates specific to systemd.

Signed-off-by: Maxin B. John 
---
 meta/recipes-connectivity/connman/connman.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-connectivity/connman/connman.inc 
b/meta/recipes-connectivity/connman/connman.inc
index ab18f2f..7e05c80 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -70,9 +70,9 @@ SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
 SYSTEMD_SERVICE_${PN}-wait-online = "connman-wait-online.service"
 
 ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_${PN} ="resolv-conf"
-ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.connman"
-ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
+ALTERNATIVE_${PN} = 
"${@bb.utils.contains('DISTRO_FEATURES','systemd','resolv-conf','',d)}"
+ALTERNATIVE_TARGET[resolv-conf] = 
"${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv-conf.connman','',d)}"
+ALTERNATIVE_LINK_NAME[resolv-conf] = 
"${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv.conf','',d)}"
 
 do_install_append() {
if 
${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
-- 
2.4.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 4/4] wic: fix restoring of original fstab

2017-06-20 Thread Diego Rondini
Hi Ed,

> Wic updates fstab if mount points are specified in .wks.
> After partition images are created the original fstab is restored.
> However, if exception is raised when partition image being prepared
> wic doesn't restore original fstab. This can cause duplication of
> added lines in fstab when 'wic create' runs next time.
> 
> Wrapping call of 'prepare' method and restoring original fstab
> even if exception occurs should fix this.
> 
> [YOCTO #11633]
> 
> Signed-off-by: Ed Bartosh 

I've applied the patch locally, and deliberately caused some WicError 
exceptions: the resulting fstab correctly has only one mount entry. So this 
seems to fix #11633.

Tested-by: Diego Rondini 

Thanks for taking care of this,
Diego
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 1/4] package.py: Add function strip_execs

2017-06-20 Thread Tobias Hagelborn
Strip all executables in a directory.
Utility function  placed in oe-package together with run_strip.
strip_execs is based on strip_sysroot from staging.bbclass
Moving out datastore references in favor of function parameters.

Signed-off-by: Tobias Hagelborn 
---
 meta/lib/oe/package.py | 105 +
 1 file changed, 105 insertions(+)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 52c5f16..43748b2 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -45,6 +45,111 @@ def runstrip(arg):
 return
 
 
+def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, 
qa_already_stripped=False):
+"""
+Strip executable code (like executables, shared libraries) _in_place_
+- Based on sysroot_strip in staging.bbclass
+:param dstdir: directory in which to strip files
+:param strip_cmd: Strip command (usually ${STRIP})
+:param libdir: ${libdir} - strip .so files in this directory
+:param base_libdir: ${base_libdir} - strip .so files in this directory
+:param qa_already_stripped: Set to True if already-stripped' in 
${INSANE_SKIP}
+This is for proper logging and messages only.
+"""
+import stat, errno, oe.path, oe.utils
+
+os.chdir(dstdir)
+
+# Return type (bits):
+# 0 - not elf
+# 1 - ELF
+# 2 - stripped
+# 4 - executable
+# 8 - shared library
+# 16 - kernel module
+def isELF(path):
+type = 0
+ret, result = oe.utils.getstatusoutput("file \"%s\"" % 
path.replace("\"", "\\\""))
+
+if ret:
+bb.error("split_and_strip_files: 'file %s' failed" % path)
+return type
+
+# Not stripped
+if "ELF" in result:
+type |= 1
+if "not stripped" not in result:
+type |= 2
+if "executable" in result:
+type |= 4
+if "shared" in result:
+type |= 8
+return type
+
+
+elffiles = {}
+inodes = {}
+libdir = os.path.abspath(dstdir + os.sep + libdir)
+base_libdir = os.path.abspath(dstdir + os.sep + base_libdir)
+
+#
+# First lets figure out all of the files we may have to process
+#
+for root, dirs, files in os.walk(dstdir):
+for f in files:
+file = os.path.join(root, f)
+
+try:
+ltarget = oe.path.realpath(file, dstdir, False)
+s = os.lstat(ltarget)
+except OSError as e:
+(err, strerror) = e.args
+if err != errno.ENOENT:
+raise
+# Skip broken symlinks
+continue
+if not s:
+continue
+# Check its an excutable
+if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & 
stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
+or ((file.startswith(libdir) or 
file.startswith(base_libdir)) and ".so" in f):
+# If it's a symlink, and points to an ELF file, we capture the 
readlink target
+if os.path.islink(file):
+continue
+
+# It's a file (or hardlink), not a link
+# ...but is it ELF, and is it already stripped?
+elf_file = isELF(file)
+if elf_file & 1:
+if elf_file & 2:
+if qa_already_stripped:
+bb.note("Skipping file %s from %s for 
already-stripped QA test" % (file[len(dstdir):], pn))
+else:
+bb.warn("File '%s' from %s was already stripped, 
this will prevent future debugging!" % (file[len(dstdir):], pn))
+continue
+
+if s.st_ino in inodes:
+os.unlink(file)
+os.link(inodes[s.st_ino], file)
+else:
+inodes[s.st_ino] = file
+# break hardlink
+bb.utils.copyfile(file, file)
+elffiles[file] = elf_file
+
+#
+# Now strip them (in parallel)
+#
+sfiles = []
+for file in elffiles:
+elf_file = int(elffiles[file])
+#bb.note("Strip %s" % file)
+sfiles.append((file, elf_file, strip_cmd))
+
+oe.utils.multiprocess_exec(sfiles, runstrip)
+
+
+
 def file_translate(file):
 ft = file.replace("@", "@at@")
 ft = ft.replace(" ", "@space@")
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 3/4] package.py: strip_execs: Support for .ko modules

2017-06-20 Thread Tobias Hagelborn
* Support stripping of .ko modules verifying file extension and
  check of content "vermagic="
* Minor refactoring (removing lint errors)

Signed-off-by: Tobias Hagelborn 
---
 meta/lib/oe/package.py | 44 +---
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 43748b2..f749f07 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -56,9 +56,12 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, 
qa_already_stripped=
 :param qa_already_stripped: Set to True if already-stripped' in 
${INSANE_SKIP}
 This is for proper logging and messages only.
 """
-import stat, errno, oe.path, oe.utils
+import stat, errno, oe.path, oe.utils, mmap
 
-os.chdir(dstdir)
+# Detect .ko module by searching for "vermagic=" string
+def is_kernel_module(path):
+with open(path) as f:
+return mmap.mmap(f.fileno(), 0, 
prot=mmap.PROT_READ).find(b"vermagic=") >= 0
 
 # Return type (bits):
 # 0 - not elf
@@ -67,31 +70,33 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, 
qa_already_stripped=
 # 4 - executable
 # 8 - shared library
 # 16 - kernel module
-def isELF(path):
-type = 0
-ret, result = oe.utils.getstatusoutput("file \"%s\"" % 
path.replace("\"", "\\\""))
+def is_elf(path):
+exec_type = 0
+ret, result = oe.utils.getstatusoutput(
+"file \"%s\"" % path.replace("\"", "\\\""))
 
 if ret:
 bb.error("split_and_strip_files: 'file %s' failed" % path)
-return type
+return exec_type
 
 # Not stripped
 if "ELF" in result:
-type |= 1
+exec_type |= 1
 if "not stripped" not in result:
-type |= 2
+exec_type |= 2
 if "executable" in result:
-type |= 4
+exec_type |= 4
 if "shared" in result:
-type |= 8
-return type
-
+exec_type |= 8
+if "relocatable" in result and is_kernel_module(path):
+exec_type |= 16
+return exec_type
 
 elffiles = {}
 inodes = {}
-libdir = os.path.abspath(dstdir + os.sep + libdir)
-base_libdir = os.path.abspath(dstdir + os.sep + base_libdir)
-
+libdir = os.path.abspath(os.path.join(dstdir, libdir.lstrip(os.sep)))
+base_libdir = os.path.abspath(os.path.join(dstdir, 
base_libdir.lstrip(os.sep)))
+exec_mask = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
 #
 # First lets figure out all of the files we may have to process
 #
@@ -111,15 +116,16 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, 
base_libdir, qa_already_stripped=
 if not s:
 continue
 # Check its an excutable
-if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & 
stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
-or ((file.startswith(libdir) or 
file.startswith(base_libdir)) and ".so" in f):
+if s[stat.ST_MODE] & exec_mask \
+or ((file.startswith(libdir) or 
file.startswith(base_libdir)) and ".so" in f) \
+or file.endswith('.ko'):
 # If it's a symlink, and points to an ELF file, we capture the 
readlink target
 if os.path.islink(file):
 continue
 
 # It's a file (or hardlink), not a link
 # ...but is it ELF, and is it already stripped?
-elf_file = isELF(file)
+elf_file = is_elf(file)
 if elf_file & 1:
 if elf_file & 2:
 if qa_already_stripped:
@@ -132,6 +138,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, 
qa_already_stripped=
 os.unlink(file)
 os.link(inodes[s.st_ino], file)
 else:
+# break hardlinks so that we do not strip the original.
 inodes[s.st_ino] = file
 # break hardlink
 bb.utils.copyfile(file, file)
@@ -143,7 +150,6 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, 
qa_already_stripped=
 sfiles = []
 for file in elffiles:
 elf_file = int(elffiles[file])
-#bb.note("Strip %s" % file)
 sfiles.append((file, elf_file, strip_cmd))
 
 oe.utils.multiprocess_exec(sfiles, runstrip)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 4/4] devtool: deploy-target: Support stripped libs and execs

2017-06-20 Thread Tobias Hagelborn
New devtool deploy-target option --strip which enables deploying
stripped binaries, saving some space on target.

* Copies the files of ${D} into a new directory and strips them in place
* Used oe.package.strip_execs for stripping directory
* Added devtool.conf option "strip" for changing default behavior

Config example:
[Deploy]
strip = true

[YOCTO #11227]

Signed-off-by: Tobias Hagelborn 
---
 scripts/lib/devtool/deploy.py | 32 
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 04c34cb..96b877e 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -16,12 +16,16 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 """Devtool plugin containing the deploy subcommands"""
 
+import logging
 import os
+import shutil
 import subprocess
-import logging
 import tempfile
-import shutil
+
+import bb.utils
 import argparse_oe
+import oe
+
 from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, 
DevtoolError
 
 logger = logging.getLogger('devtool')
@@ -140,9 +144,9 @@ def _prepare_remote_script(deploy, verbose=False, 
dryrun=False, undeployall=Fals
 return '\n'.join(lines)
 
 
+
 def deploy(args, config, basepath, workspace):
 """Entry point for the devtool 'deploy' subcommand"""
-import re
 import math
 import oe.recipeutils
 
@@ -170,6 +174,17 @@ def deploy(args, config, basepath, workspace):
 'recipe? If so, the install step has not installed 
'
 'any files.' % args.recipename)
 
+if args.strip and not args.dry_run:
+# Fakeroot copy to new destination
+srcdir = recipe_outdir
+recipe_outdir = os.path.join(rd.getVar('WORKDIR', True), 
'deploy-target-stripped')
+if os.path.isdir(recipe_outdir):
+bb.utils.remove(recipe_outdir, True)
+exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), 
recipe_outdir), shell=True)
+os.environ['PATH'] = ':'.join([os.environ['PATH'], 
rd.getVar('PATH', True) or ''])
+oe.package.strip_execs(args.recipename, recipe_outdir, 
rd.getVar('STRIP', True), rd.getVar('libdir', True),
+rd.getVar('base_libdir', True))
+
 filelist = []
 ftotalsize = 0
 for root, _, files in os.walk(recipe_outdir):
@@ -189,7 +204,6 @@ def deploy(args, config, basepath, workspace):
 print('  %s' % item)
 return 0
 
-
 extraoptions = ''
 if args.no_host_check:
 extraoptions += '-o UserKnownHostsFile=/dev/null -o 
StrictHostKeyChecking=no'
@@ -301,6 +315,7 @@ def undeploy(args, config, basepath, workspace):
 
 def register_commands(subparsers, context):
 """Register devtool subcommands from the deploy plugin"""
+
 parser_deploy = subparsers.add_parser('deploy-target',
   help='Deploy recipe output files to 
live target machine',
   description='Deploys a recipe\'s 
build output (i.e. the output of the do_install task) to a live target machine 
over ssh. By default, any existing files will be preserved instead of being 
overwritten and will be restored if you run devtool undeploy-target. Note: this 
only deploys the recipe itself and not any runtime dependencies, so it is 
assumed that those have been installed on the target beforehand.',
@@ -313,6 +328,15 @@ def register_commands(subparsers, context):
 parser_deploy.add_argument('-p', '--no-preserve', help='Do not preserve 
existing files', action='store_true')
 parser_deploy.add_argument('--no-check-space', help='Do not check for 
available space before deploying', action='store_true')
 parser_deploy.add_argument('-P', '--port', default='22', help='Port to use 
for connection to the target')
+
+strip_opts = parser_deploy.add_mutually_exclusive_group(required=False)
+strip_opts.add_argument('-S', '--strip',
+   help='Strip executables prior to deploying 
(default: %(default)s). '
+'The default value of this option can be 
controlled by setting the strip option in the [Deploy] section to True or 
False.',
+   
default=oe.types.boolean(context.config.get('Deploy', 'strip', default='0')),
+   action='store_true')
+strip_opts.add_argument('--no-strip', help='Do not strip executables prior 
to deploy', dest='strip', action='store_false')
+
 parser_deploy.set_defaults(func=deploy)
 
 parser_undeploy = subparsers.add_parser('undeploy-target',
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 2/4] staging.bbclass: Make use of oe.package.strip_execs

2017-06-20 Thread Tobias Hagelborn
Make use of the library function oe.package.strip_execs for stripping
sysroot executables. oe.packge.strip_execs is based on code previously
residing in sysroot_strip.

Signed-off-by: Tobias Hagelborn 
---
 meta/classes/staging.bbclass | 108 ++-
 1 file changed, 13 insertions(+), 95 deletions(-)

diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 1bb22aa..fe82294 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -68,101 +68,19 @@ sysroot_stage_all() {
 }
 
 python sysroot_strip () {
-import stat, errno
-
-dvar = d.getVar('SYSROOT_DESTDIR')
-pn = d.getVar('PN')
-
-os.chdir(dvar)
-
-# Return type (bits):
-# 0 - not elf
-# 1 - ELF
-# 2 - stripped
-# 4 - executable
-# 8 - shared library
-# 16 - kernel module
-def isELF(path):
-type = 0
-ret, result = oe.utils.getstatusoutput("file \"%s\"" % 
path.replace("\"", "\\\""))
-
-if ret:
-bb.error("sysroot_strip: 'file %s' failed" % path)
-return type
-
-# Not stripped
-if "ELF" in result:
-type |= 1
-if "not stripped" not in result:
-type |= 2
-if "executable" in result:
-type |= 4
-if "shared" in result:
-type |= 8
-return type
-
-
-elffiles = {}
-inodes = {}
-libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
-baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir"))
-if (d.getVar('INHIBIT_SYSROOT_STRIP') != '1'):
-#
-# First lets figure out all of the files we may have to process
-#
-for root, dirs, files in os.walk(dvar):
-for f in files:
-file = os.path.join(root, f)
-
-try:
-ltarget = oe.path.realpath(file, dvar, False)
-s = os.lstat(ltarget)
-except OSError as e:
-(err, strerror) = e.args
-if err != errno.ENOENT:
-raise
-# Skip broken symlinks
-continue
-if not s:
-continue
-# Check its an excutable
-if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & 
stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
-or ((file.startswith(libdir) or 
file.startswith(baselibdir)) and ".so" in f):
-# If it's a symlink, and points to an ELF file, we capture 
the readlink target
-if os.path.islink(file):
-continue
-
-# It's a file (or hardlink), not a link
-# ...but is it ELF, and is it already stripped?
-elf_file = isELF(file)
-if elf_file & 1:
-if elf_file & 2:
-if 'already-stripped' in (d.getVar('INSANE_SKIP_' 
+ pn) or "").split():
-bb.note("Skipping file %s from %s for 
already-stripped QA test" % (file[len(dvar):], pn))
-else:
-bb.warn("File '%s' from %s was already 
stripped, this will prevent future debugging!" % (file[len(dvar):], pn))
-continue
-
-if s.st_ino in inodes:
-os.unlink(file)
-os.link(inodes[s.st_ino], file)
-else:
-inodes[s.st_ino] = file
-# break hardlink
-bb.utils.copyfile(file, file)
-elffiles[file] = elf_file
-
-#
-# Now strip them (in parallel)
-#
-strip = d.getVar("STRIP")
-sfiles = []
-for file in elffiles:
-elf_file = int(elffiles[file])
-#bb.note("Strip %s" % file)
-sfiles.append((file, elf_file, strip))
-
-oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
+inhibit_sysroot = d.getVar('INHIBIT_SYSROOT_STRIP', True)
+if inhibit_sysroot and oe.types.boolean(inhibit_sysroot):
+return 0
+
+dstdir = d.getVar('SYSROOT_DESTDIR', True)
+pn = d.getVar('PN', True)
+libdir = os.path.abspath(dstdir + os.sep + d.getVar("libdir", True))
+base_libdir = os.path.abspath(dstdir + os.sep + d.getVar("base_libdir", 
True))
+qa_already_stripped = 'already-stripped' in (d.getVar('INSANE_SKIP_' + pn, 
True) or "").split()
+strip_cmd = d.getVar("STRIP", True)
+
+oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir,
+   qa_already_stripped=qa_already_stripped)
 }
 
 do_populate_sysroot[dirs] = "${SYSROOT_DESTDIR}"
-- 
2.1.4

-- 
___
Openembedded-core mailin